亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imageutility.cs

?? 非常不錯的學校在線考試分析系統
?? CS
?? 第 1 頁 / 共 2 頁
字號:
namespace ASPNET.StarterKit.Communities {

    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Collections;
    using System.Text.RegularExpressions;
    using System.IO;
    using System.Web;
    using System.Drawing;
    using System.Drawing.Imaging;


    //*********************************************************************
    //
    // ImageUtility Class
    //
    // Contains static methods for working with images.
    //
    //*********************************************************************

	public class ImageUtility {



        //*********************************************************************
        //
        // GetSectionImage Method
        //
        // Returns a byte array containing a section image. 
        //
        //*********************************************************************

    	public static byte[] GetSectionImage(int sectionID, int imageID, int width, int height, bool isThumbnail) {
		    string contentType = String.Empty;
		    byte[] image = null;
            int returnWidth = -1;
            int returnHeight = -1;
            bool returnThumbnail = false;
		
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdGet = new SqlCommand("Community_ImagesGetSectionImage", conPortal);
			cmdGet.CommandType = CommandType.StoredProcedure;

			cmdGet.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdGet.Parameters.Add("@sectionID", sectionID);
			cmdGet.Parameters.Add("@imageID", imageID);
	   	    cmdGet.Parameters.Add("@width", width);
			cmdGet.Parameters.Add("@height", height);
		    cmdGet.Parameters.Add("@isThumbnail", isThumbnail);

			conPortal.Open();
			SqlDataReader dr = cmdGet.ExecuteReader();
			if (dr.Read()) {
			    contentType = (string)dr["Image_ContentType"]; 
			    image =  (byte[])dr["Image_ImageData"];
                returnWidth = (int)dr["Width"];
                returnHeight = (int)dr["Height"];
                returnThumbnail = Convert.ToBoolean(dr["IsThumbnail"]);
			}
			conPortal.Close();
			
			// if no resize, just return
			if (returnWidth == width && returnHeight == height && returnThumbnail == isThumbnail)
			 return image;

		    // Perform resize
		    image = ModifyImage(image, width, height, contentType, isThumbnail);

		    // Save Resized Image
			SqlCommand cmdSave = new SqlCommand("Community_ImagesSaveSizedSectionImage", conPortal);
			cmdSave.CommandType = CommandType.StoredProcedure;

			cmdSave.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdSave.Parameters.Add("@imageID", imageID);
	   	    cmdSave.Parameters.Add("@sizedImageWidth", width);
			cmdSave.Parameters.Add("@sizedImageHeight", height);
		    cmdSave.Parameters.Add("@SizedImageIsThumbnail", isThumbnail);
		    cmdSave.Parameters.Add("@sizedImageData", SqlDbType.Image).Value = image;
		  
		    conPortal.Open();
		    cmdSave.ExecuteNonQuery();
		    conPortal.Close(); 
			
			return image;
		}




        //*********************************************************************
        //
        // GetCommunityImage Method
        //
        // Returns a byte array containing a community image. 
        //
        //*********************************************************************

    	public static SqlDataReader GetCommunityImage(string fileName) {
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdGet = new SqlCommand("Community_ImagesGetCommunityImage", conPortal);
			cmdGet.CommandType = CommandType.StoredProcedure;
			cmdGet.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdGet.Parameters.Add("@fileName", fileName);

			conPortal.Open();
			return cmdGet.ExecuteReader(CommandBehavior.CloseConnection);
		}



        //*********************************************************************
        //
        // GetAllCommunityImages Method
        //
        // Returns a list of all the images in this community. 
        //
        //*********************************************************************

    	public static DataSet GetAllCommunityImages() {
			SqlDataAdapter dadGet = new SqlDataAdapter("Community_ImagesGetCommunityImages", CommunityGlobals.ConnectionString);
			dadGet.SelectCommand.CommandType = CommandType.StoredProcedure;
			dadGet.SelectCommand.Parameters.Add("@communityID", CommunityGlobals.CommunityID);

            DataSet dstImages = new DataSet();
            dadGet.Fill(dstImages);
            return dstImages;      
		}



        //*********************************************************************
        //
        // AddCommunityImage Method
        //
        // Adds a new community image to the database. 
        //
        //*********************************************************************

        public static string AddCommunityImage(CommunityImageType imageType, HttpPostedFile proposedFile) {
            // Make sure that the posted file has content
            if (proposedFile == null || proposedFile.ContentLength == 0)
                return null; 


    		string imgFileName = proposedFile.FileName.Remove(0,proposedFile.FileName.LastIndexOf("\\")+1);
			string imgContentType = proposedFile.ContentType;
			if (imgContentType == "image/jpeg")
			{
				imgContentType = "image/pjpeg";
			} 
            // Make sure that the posted file is actually an image
            if (!IsImageFile(imgFileName))
                return null;
            
            
            // Process the image into byte array
			Stream imgStream = proposedFile.InputStream;
			int imgLen = proposedFile.ContentLength;
			byte[] imgBinaryData = new byte[imgLen];
			int n = imgStream.Read(imgBinaryData,0,imgLen);

            // Add the image to the database
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdAdd = new SqlCommand("Community_ImagesAddCommunityImage", conPortal);
			cmdAdd.CommandType = CommandType.StoredProcedure;

            cmdAdd.Parameters.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
            cmdAdd.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdAdd.Parameters.Add("@fileName", imgFileName);
			cmdAdd.Parameters.Add("@contentType", imgContentType);
			cmdAdd.Parameters.Add("@imageType", imageType);
            cmdAdd.Parameters.Add("@imageData", SqlDbType.Image).Value = imgBinaryData;

			conPortal.Open();
            int result = cmdAdd.ExecuteNonQuery();
            conPortal.Close();
            
            return imgFileName;                    
        }



        //*********************************************************************
        //
        // DeleteCommunityImage Method
        //
        // Removes a community image from the database. 
        //
        //*********************************************************************

        public static void DeleteCommunityImage(string imageName) {
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdDelete = new SqlCommand("Community_ImagesDeleteCommunityImage", conPortal);
			cmdDelete.CommandType = CommandType.StoredProcedure;

            cmdDelete.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
			cmdDelete.Parameters.Add("@fileName", imageName);
        
            conPortal.Open();
            cmdDelete.ExecuteNonQuery();
            conPortal.Close();       
        }



        //*********************************************************************
        //
        // AddSectionImage Method
        //
        // Adds a section image to the database. 
        //
        //*********************************************************************

        public static int AddSectionImage(int contentPageID, HttpPostedFile proposedFile) {
            // Make sure that the posted file has content
            if (proposedFile == null || proposedFile.ContentLength == 0)
                return -1; 

    		string imgFileName = proposedFile.FileName.Remove(0,proposedFile.FileName.LastIndexOf("\\")+1);
			string imgContentType = proposedFile.ContentType;
			if (imgContentType == "image/jpeg")
			{
				imgContentType = "image/pjpeg";
			} 

            // Make sure that the posted file is actually an image
            if (!IsImageFile(imgFileName))
                return -1;
            
            // Process the image into byte array
			Stream imgStream = proposedFile.InputStream;
			int imgLen = proposedFile.ContentLength;
			byte[] imgBinaryData = new byte[imgLen];
			int n = imgStream.Read(imgBinaryData,0,imgLen);

            // Add the image to the database
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand cmdAdd = new SqlCommand("Community_ImagesAddSectionImage", conPortal);
			cmdAdd.CommandType = CommandType.StoredProcedure;

            cmdAdd.Parameters.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
            cmdAdd.Parameters.Add("@communityID", CommunityGlobals.CommunityID);
            cmdAdd.Parameters.Add("@contentPageID", contentPageID);
			cmdAdd.Parameters.Add("@imageName", imgFileName);
			cmdAdd.Parameters.Add("@contentType", imgContentType);
            cmdAdd.Parameters.Add("@imageData", SqlDbType.Image).Value = imgBinaryData;

			conPortal.Open();
            cmdAdd.ExecuteNonQuery();
            int result = (int)cmdAdd.Parameters["@RETURN_VALUE"].Value;
            conPortal.Close();
            
            return result;                    
        }


        //*********************************************************************
        //
        // UpdateSectionImage Method
        //
        // Updates a section image in the database. 
        //
        //*********************************************************************

        public static void UpdateSectionImage(int imageID, HttpPostedFile proposedFile) {
            // Make sure that the posted file has content
            if (proposedFile == null || proposedFile.ContentLength == 0)
                return; 

    		string imgFileName = proposedFile.FileName.Remove(0,proposedFile.FileName.LastIndexOf("\\")+1);
			string imgContentType = proposedFile.ContentType;
			if (imgContentType == "image/jpeg")
			{
				imgContentType = "image/pjpeg";
			} 

            // Make sure that the posted file is actually an image
            if (!IsImageFile(imgFileName))
                return;

            // Process the image into byte array
			Stream imgStream = proposedFile.InputStream;
			int imgLen = proposedFile.ContentLength;
			byte[] imgBinaryData = new byte[imgLen];
			int n = imgStream.Read(imgBinaryData,0,imgLen);

            // Update the image in the database
			SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品视频一区| 久久99在线观看| 欧美韩日一区二区三区四区| 欧美变态口味重另类| 欧美一区二区三区免费视频 | 日韩精品一区二区三区四区视频| 精品视频一区三区九区| 欧美又粗又大又爽| 欧美日韩欧美一区二区| 91久久精品网| 欧美日韩你懂的| 精品三级在线看| 国产亚洲美州欧州综合国| 欧美激情在线免费观看| 亚洲精品国产一区二区精华液 | 日本系列欧美系列| 麻豆精品蜜桃视频网站| 激情六月婷婷综合| 成人高清在线视频| 欧美午夜在线观看| 精品日韩在线一区| 国产欧美精品区一区二区三区| 国产日韩av一区二区| 亚洲色图20p| 奇米777欧美一区二区| 国产美女一区二区| 欧美日本视频在线| 国产欧美精品在线观看| 亚洲综合一区在线| 国产精品一区二区x88av| 91伊人久久大香线蕉| 欧美一级理论性理论a| 国产精品超碰97尤物18| 日韩精品三区四区| 成人黄动漫网站免费app| 欧美精品在线一区二区三区| 国产欧美一区二区三区在线老狼| 一区二区三区不卡在线观看| 麻豆国产精品视频| caoporm超碰国产精品| 制服丝袜激情欧洲亚洲| 中文字幕乱码一区二区免费| 亚洲va欧美va天堂v国产综合| 国产精品一区二区久久精品爱涩 | 精品亚洲国产成人av制服丝袜 | 欧美视频在线播放| 久久久99久久精品欧美| 亚洲国产精品人人做人人爽| 国产老妇另类xxxxx| 欧美日韩国产首页| 国产精品久久福利| 国产精品一区二区无线| 日韩一区二区在线看片| 亚洲综合一二区| av在线播放不卡| 日韩免费高清视频| 亚洲va欧美va人人爽午夜| 白白色 亚洲乱淫| 久久精品一区二区| 理论电影国产精品| 91精品国产色综合久久久蜜香臀| 一卡二卡欧美日韩| 99久久精品国产一区二区三区 | 欧美日韩一级片网站| 中文字幕一区二区三| 国产白丝精品91爽爽久久 | 99国产麻豆精品| 国产精品国产三级国产三级人妇 | 亚洲第一在线综合网站| 色一情一伦一子一伦一区| 国产欧美1区2区3区| 九九热在线视频观看这里只有精品| 欧美高清激情brazzers| 天天操天天干天天综合网| 欧美视频在线观看一区二区| 亚洲444eee在线观看| 欧美亚洲综合网| 亚洲bt欧美bt精品| 日韩一区二区视频| 国产一区欧美日韩| 日本一区二区三区四区| 成人午夜又粗又硬又大| 亚洲欧美综合网| 色中色一区二区| 亚洲高清免费一级二级三级| 欧美嫩在线观看| 秋霞电影一区二区| 久久精品男人的天堂| 高清成人免费视频| 亚洲黄色录像片| 91麻豆精品国产91久久久更新时间 | 中文字幕成人av| 99re在线视频这里只有精品| 亚洲免费av观看| 日韩一区二区三| 成人免费av网站| 亚洲一线二线三线视频| 日韩欧美中文一区| 成人av在线电影| 午夜欧美视频在线观看| 精品国产一区二区在线观看| 国产伦精品一区二区三区免费| 国产精品美女久久久久久| 欧美在线观看一二区| 国产又黄又大久久| 亚洲黄色性网站| 国产色91在线| 欧美日本视频在线| 成人性视频网站| 亚洲成人精品一区| 欧美国产日产图区| 欧美精品一卡两卡| 成人午夜碰碰视频| 天堂成人免费av电影一区| 国产亚洲综合在线| 欧美视频一区二区三区在线观看| 精品一区二区三区视频在线观看 | 亚洲成人av电影| 2023国产一二三区日本精品2022| 91网站在线播放| 国产乱码精品一区二区三区忘忧草| 国产精品麻豆久久久| 日韩欧美国产三级电影视频| 色婷婷狠狠综合| 国产精品一区在线观看你懂的| 亚洲va国产天堂va久久en| 中文字幕中文字幕一区| 欧美电影免费观看高清完整版在线| 91亚洲资源网| 国产福利视频一区二区三区| 日本免费新一区视频| 亚洲一级二级三级在线免费观看| 中文字幕在线免费不卡| 精品国产麻豆免费人成网站| 欧美日韩久久一区二区| 色综合久久精品| 不卡视频在线观看| 成人一区二区三区视频| 国产一区二区主播在线| 免费看欧美美女黄的网站| 婷婷激情综合网| 舔着乳尖日韩一区| 亚洲一区二区三区自拍| 亚洲欧美日韩久久| 亚洲欧美二区三区| 亚洲人成影院在线观看| 亚洲精品中文在线| 一区二区三区四区视频精品免费| 国产精品嫩草99a| 亚洲国产精品国自产拍av| 久久婷婷综合激情| 久久久噜噜噜久噜久久综合| 欧美精品一区在线观看| 国产日韩亚洲欧美综合| 欧美激情中文字幕一区二区| 26uuu色噜噜精品一区二区| 2017欧美狠狠色| 国产女人18毛片水真多成人如厕| 国产欧美视频在线观看| 国产精品超碰97尤物18| 一级女性全黄久久生活片免费| 亚洲高清免费视频| 琪琪一区二区三区| 国产成人精品免费视频网站| 国产精品 日产精品 欧美精品| 成人白浆超碰人人人人| 色视频成人在线观看免| 在线不卡欧美精品一区二区三区| 欧美一区二区三区视频在线观看| 久久婷婷综合激情| 亚洲精品一二三| 美女脱光内衣内裤视频久久影院| 黄色日韩三级电影| 91视频www| 日韩欧美成人一区| 18欧美亚洲精品| 日本欧美久久久久免费播放网| 国产一区二区三区精品欧美日韩一区二区三区 | 热久久一区二区| 成人精品鲁一区一区二区| 欧美图区在线视频| 久久久av毛片精品| 午夜欧美电影在线观看| 国产麻豆精品一区二区| 欧洲国内综合视频| 久久久久9999亚洲精品| 亚洲一区免费视频| 国产99久久久国产精品潘金网站| 欧美在线不卡一区| 国产精品免费网站在线观看| 五月婷婷欧美视频| 91亚洲精品一区二区乱码| 日韩精品一区二区在线| 一区二区三区四区在线| 国产99久久精品| 精品国产区一区| 视频一区欧美日韩| 色哟哟国产精品| 国产精品久久久久久久第一福利| 六月丁香婷婷色狠狠久久|