111,126
社区成员
发帖
与我相关
我的任务
分享
fUlimage.SaveAs(webFilePath); // 使用 SaveAs 方法保存文件
MakeThumbnail(webFilePath, webFilePath_s, 115, 123, "Cut"); // 生成缩略图方法
if (!IsPostBack)
{
string newid = Convert.ToString(Request.QueryString["id"]);
if (newid != null)
{
DDlmenu.SelectedValue = sqldb.scr("select menu_id from new where new_id='" + newid + "'");
tbtitle.Text = sqldb.scr("select new_cn from new where new_id='"+newid+"'");
FCKnew.Value = sqldb.scr("select newC_cn from new where new_id='" + newid + "'");
}
else
{
string dmid = Convert.ToString(DDlmenu.SelectedValue);
}
}
catch (Exception ex)
{
PopMsgBox("提示:文件上传失败,失败原因:"+ex.Message);
}
}
else
{
PopMsgBox("提示:文件已经存在,请重命名后上传");
}
}
else
{
PopMsgBox("提示:文件类型不符");
}
}
else
{
PopMsgBox("提示:请上传图片");
}
}
protected void BtcanelNew_Click(object sender, EventArgs e)
{
DDlmenu.SelectedValue = "1";
tbtitle.Text = null;
FCKnew.Value = null;
}
protected void BtsubortNew_Click(object sender, EventArgs e)
{
string users = Session["UserLoginID"].ToString();
string usid = sqldb.scr("select manager_id from manager where manage_nm='" + users + "'");
string filetype = fUlimage.PostedFile.ContentType.ToString();
string name = fUlimage.PostedFile.FileName;
FileInfo file = new FileInfo(name);
string fileName = file.Name; // 文件名称
string fileName_s = "s_" + file.Name; // 缩略图文件名称
string webFilePath = Server.MapPath("file/" + fileName); // 服务器端文件路径
string webFilePath_s = Server.MapPath("file/" + fileName_s); // 服务器端缩略图路径
if (fUlimage.HasFile)
{
if (filetype == "image/bmp" || filetype == "image/gif" || filetype == "image/pjpg")
{
if (!File.Exists(webFilePath))
{
try
{
fUlimage.SaveAs(webFilePath); // 使用 SaveAs 方法保存文件
//AddShuiYinWord(webFilePath, webFilePath_sy);
//AddShuiYinPic(webFilePath, webFilePath_syp, webFilePath_sypf);
MakeThumbnail(webFilePath, webFilePath_s, 115, 123, "Cut"); // 生成缩略图方法
string Ntitle = tbtitle.Text;
string Ncontent = this.FCKnew.Value.ToString();
string Nmenu = this.DDlmenu.SelectedValue.ToString();
string newid = Convert.ToString(Request.QueryString["id"]);
if (newid == null)
{
if (Ntitle != "" && Ncontent != "" && usid != "" && Nmenu != "" && fileName_s!="")
{
string str = "insert into new(new_cn,newC_cn,usr_id,menu_id,new_pic) values('" + Ntitle + "','" + Ncontent + "','" + usid + "','" + Nmenu + "','" + fileName_s + "')";
if (sqldb.insert(str) == true)
{
PopMsgBox("保存成功!");
}
else
{
PopMsgBox("保存失败!");
}
}
else
{
PopMsgBox("不允许为空!");
}
}
else
{
if (Ntitle != "" && Ncontent != "" && usid != "" && newid != "" && fileName_s!="")
{
string strtitle = sqldb.scr("select new_cn from new where new_id='" + newid + "'");
tbtitle.Text = strtitle;
string strn = "update new set newC_cn='" + Ncontent + "' where new_id='" + newid + "' and new_cn='" + strtitle + "' and new_pic='" + fileName_s + "'";
if (sqldb.insert(strn) == true)
{
PopMsgBox("更新成功!");
}
else
{
PopMsgBox("更新失败!");
}
}
else
{
PopMsgBox("不允许为空!");
}
}
}