protected void btn_submit_Click(object sender, EventArgs e) { if (FilesAdd.PostedFile != null && FilesAdd.PostedFile.ContentLength > 0) { //string fn = System.IO.Path.GetFileName(FileAdd.PostedFile.FileName); string fn = string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now) + "_" + System.IO.Path.GetFileName(FilesAdd.PostedFile.FileName); string SaveLocation = Server.MapPath("LeaveFiles") + "\\" + fn; try { FilesAdd.PostedFile.SaveAs(SaveLocation); txt_FilesAdd = SaveLocation; //Response.Write("The file has been uploaded."); ShowMsgHelper.Alert("The file has been uploaded."); } catch (Exception ex) { //Response.Write("Error: " + ex.Message); ShowMsgHelper.Alert_Error("Error: " + ex.Message); } } else { //Response.Write("Please select a file to upload."); ShowMsgHelper.Alert_Wern("Please select a file to upload."); } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSumit_Click(object sender, EventArgs e) { Hashtable hs = new Hashtable(); //获取图片路径 if (hfImage.Value != imagepath) { string filename = fuPicture.FileName; if (!string.IsNullOrEmpty(filename)) { string type = (filename.Substring(filename.LastIndexOf(".") + 1)).ToLower(); //得到文件的后缀 if (type == "jpg" || type == "gif" || type == "bmp" || type == "png") { string name1 = Guid.NewGuid().ToString(); string name = name1.ToString() + "." + type; string fpath = HttpContext.Current.Server.MapPath("~\\upload\\image\\") + name; fuPicture.SaveAs(fpath); //将文件保存到fpath这个路径里面 CommonMethod.CreateThumbnail(fpath, HttpContext.Current.Server.MapPath("~\\upload\\image\\") + "SN" + name, 160, 160, false); //创建缩略图 hs["CentreLogo"] = name; //原记录中有图片信息。 if (!String.IsNullOrEmpty(imagepath)) { //删除原来的旧图片。 FileInfo file; file = new FileInfo(Server.MapPath("..") + "\\..\\upload\\image\\" + imagepath); file.Delete(); file = new FileInfo(Server.MapPath("..") + "\\..\\upload\\image\\" + "SN" + imagepath); file.Delete(); } } else { CommonMethod.Alert(this.Page, "不支持该格式的图标!支持jpg、gif、bmp、png"); return; } } } hs["Extension"] = this.txtExtension.Value; hs["HotelNameCode"] = this.txtHotelNameCode.Value; if (Request.QueryString["AdminHotelid"] != null) { //修改 if (DataFactory.SqlDataBase().UpdateByHashtable("Hotel_Admin", "AdminHotelid", Hdhoteladmin.Value, hs) > 0) { ShowMsgHelper.Alert("编辑成功!"); Response.Redirect("setcard.aspx?AdminHotelid=" + Hdhoteladmin.Value + "", false); } else { ShowMsgHelper.Alert_Error("编辑失败!"); } } }
protected void Button1_Click(object sender, EventArgs e) { int count = 0; StringBuilder SqlWhere = new StringBuilder(); IList <SqlParam> IList_param = new List <SqlParam>(); SqlWhere.Append("SELECT * "); SqlWhere.Append("FROM View_UserList U"); SqlWhere.Append(" WHERE 1=1 "); if (!string.IsNullOrEmpty(this.AreaName.Value)) { SqlWhere.AppendFormat(" AND AreaName='{0}' ", this.AreaName.Value); } if (!string.IsNullOrEmpty(this.EduBackName.Value)) { SqlWhere.AppendFormat(" AND EduBackName='{0}' ", this.EduBackName.Value); } if (!string.IsNullOrEmpty(this.EduTypeName.Value)) { SqlWhere.AppendFormat(" AND EduTypeName='{0}' ", this.EduTypeName.Value); } if (!string.IsNullOrEmpty(this.CompanyID.Value)) { SqlWhere.AppendFormat(" AND CompanyID='{0}' ", this.CompanyID.Value); } if (!string.IsNullOrEmpty(this.specName.Value)) { SqlWhere.AppendFormat(" AND specName='{0}' ", this.specName.Value); } if (!string.IsNullOrEmpty(this.status.Value)) { SqlWhere.AppendFormat(" AND status='{0}' ", this.status.Value); } if (!string.IsNullOrEmpty(this.sexText.Value)) { SqlWhere.AppendFormat(" AND sexText='{0}' ", this.sexText.Value); } if (!string.IsNullOrEmpty(this.Is985.Value)) { SqlWhere.AppendFormat(" AND Is985={0} ", this.Is985.Value); } if (!string.IsNullOrEmpty(this.Is211.Value)) { SqlWhere.AppendFormat(" AND Is211={0} ", this.Is211.Value); } if (!string.IsNullOrEmpty(this.IsFullDay.Value)) { SqlWhere.AppendFormat(" AND IsFullDay={0} ", this.IsFullDay.Value); } SqlWhere.Append(" AND Checks='是'"); SqlWhere.Append(" AND specName IS NOT NULL"); if (!string.IsNullOrEmpty(this.txt_Search.Value)) { SqlWhere.Append(" AND U." + this.Searchwhere.Value + " like @obj "); IList_param.Add(new SqlParam("@obj", '%' + this.txt_Search.Value.Trim() + '%')); } string webpath = peridal.ExportExcelFilebySQL(SqlWhere); if (webpath != "0") { ShowMsgHelper.showFaceMsg("导出成功!" + webpath); // ShowMsgHelper. } else { ShowMsgHelper.Alert("导出失败!请联系技术人员。电话:18638956262"); } }