using System;
using System
using System
using System
using System
using System
using System
using System
using System
using System
using System
using System
using System
using KunslyNetDll
using HunMSM
namespace HunMSM
/**//// <summary>
/// 圖片上傳
/// </summary>
public partial class _upphoto : System
public string sPath =
public string extension;
public string path;
public string fileName;
public string smobile;
protected void Page_Load(object sender
// 在此處放置用戶代碼以初始化頁面
AddControl();
if (Session[
Response
else
smobile = Session[
if(!this
DropDownPhotoType();
DropDownPhotoColl();
}
}
void AddControl()#region void AddControl()
/**//// <summary>
/// 添加控件
/// </summary>
private void AddControl()
Control ctrl;
sPath = KunslyWebPage
//頭
ctrl = LoadControl(sPath +
HolderHead
//左邊框
ctrl = LoadControl(sPath +
HolderLeft
//底部
ctrl = LoadControl(sPath +
HolderBottom
}
#endregion
Web 窗體設計器生成的代碼#region Web 窗體設計器生成的代碼
override protected void OnInit(EventArgs e)
//
// CODEGEN: 該調用是 ASP
//
InitializeComponent();
base
}
/**//// <summary>
/// 設計器支持所需的方法
/// 此方法的內容
/// </summary>
private void InitializeComponent()
}
#endregion
protected void Button
int ncount = GetRecordCount();
if (ncount ==
KunslyWebPage
return;
}
// Response
//else
//{
if(UploadFile
//Response
KunslyWebPage
return;
}
// else
// {
if (txtMessage
KunslyWebPage
return;
}
//Response
extension = Path
if (extension !=
KunslyWebPage
return;
}
//Response
if (UploadFile
KunslyWebPage
return;
}
fileName = DateTime
path = Server
updata();
}
void updata()#region void updata()
void updata()
//這個過程可以更新的數據庫
UploadFile
int width
System
image
width=image
height=image
newheight=height*newwidth/width;
Bitmap bm = new Bitmap(image
bm
image
LblShowPhoto
LblShowPhoto
string strtxtMessage = txtMessage
strtxtMessage = strtxtMessage
strtxtMessage = strtxtMessage
strtxtMessage = strtxtMessage
string strSql =
strSql +=
strSql +=
strSql +=
strSql +=
strSql +=
strSql +=
strSql += DdlPhotoColl
SqlConnection dbConn = DbConnection
SqlCommand dbCmd = new SqlCommand(strSql
dbCmd
dbCmd
dbConn
image
bm
}
#endregion
void DropDownPhotoType()#region void DropDownPhotoType()
void DropDownPhotoType()
//這個過程是將照片類型綁定
string strSql =
SqlConnection dbConn = DbConnection
SqlCommand dbCmd = new SqlCommand(strSql
SqlDataReader dbReader = dbCmd
DdlPhotoType
while (dbReader
DdlPhotoType
}
dbReader
dbConn
}
#endregion
void DropDownPhotoColl()#region void DropDownPhotoColl()
void DropDownPhotoColl()
//這個過程是將相冊類型綁定
string strSql =
SqlConnection dbConn = DbConnection
SqlCommand dbCmd = new SqlCommand(strSql
SqlDataReader dbReader = dbCmd
DdlPhotoColl
while (dbReader
DdlPhotoColl
}
dbReader
dbConn
}
#endregion
int GetRecordCount()#region int GetRecordCount()
/**//// <summary>
/// 取得記錄數
/// </summary>
/// <returns></returns>
private int GetRecordCount()
string strSql =
strSql +=
strSql +=
SqlConnection dbConn = DbConnection
SqlCommand dbCmd = new SqlCommand(strSql
SqlDataReader dbReader = dbCmd
int nCount =
if(dbReader
nCount = Convert
dbReader
dbConn
return nCount;
}
#endregion
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12300.html