protected void btnSubmit_Click(object sender, EventArgs e) { if (txtRemark.Text == "") { CommonFunction.Alert(Literal1, "请留下您的宝贵意见建议"); return; } Model.ServiceVote vote = new Model.ServiceVote(); vote.SV_ZH = rdozh.SelectedValue; vote.SV_GY = rdogy.SelectedValue; vote.SV_SF = rdosf.SelectedValue; vote.SV_HJ = rdohj.SelectedValue; vote.SV_TC = rdotc.SelectedValue; vote.SV_GL = rdogl.SelectedValue; vote.SV_YJ = rdoyj.SelectedValue; vote.SV_ZA = rdoza.SelectedValue; vote.SV_SS = rdoss.SelectedValue; vote.SV_GC = rdogc.SelectedValue; vote.SV_CS = rdocs.SelectedValue; vote.SV_CY = rdocy.SelectedValue; vote.SV_KF = rdokf.SelectedValue; vote.SV_JY = rdojy.SelectedValue; vote.SV_QX = rdoqx.SelectedValue; vote.SV_SID = ((ServiceInfo)Session["serviceinfo"]).S_ID; vote.SV_Remark = txtRemark.Text.Trim(); int result = DataAccess.ServiceVoteService.Insert_ServiceVote(vote); if (result > 0) { CommonFunction.Alert(Literal1, "提交成功,谢谢您的参与"); txtRemark.Text = ""; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strContent = Request.Form["t_contents"].ToString(); if (strContent == "") { CommonFunction.Alert(Literal1, "文章内容不能为空"); return; } ServiceNews news = new ServiceNews(); news.N_Title = txtTitle.Text; news.N_Content = strContent; news.N_SID = ((UserInfo)Session["ServiceUser"]).U_SID; news.N_NewsType = ViewState["tid"].ToString(); news.N_From = txtForm.Text; news.N_Time = DateTime.Parse(txtdate.Text); if (ViewState["strAction"].ToString() == "add") { ServiceNewService.Insert_News(news); } else if (ViewState["strAction"].ToString() == "update") { news.N_ID = Convert.ToInt32(ViewState["nid"]); ServiceNewService.Update_News(news); } CommonFunction.AlertAndRedirect(Literal1, "操作成功", "blank.aspx"); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strContent = Request.Form["t_contents"].ToString(); if (strContent == "") { CommonFunction.Alert(Literal1, "文章内容不能为空"); return; } ServiceItem item = new ServiceItem(); item.I_Title = txtTitle.Text; item.I_Content = strContent; item.I_SID = ((UserInfo)Session["ServiceUser"]).U_SID; item.I_MID = ViewState["mid"].ToString(); if (ViewState["strAction"].ToString() == "add") { ServiceItemService.Insert_ServiceItem(item); } else if (ViewState["strAction"].ToString() == "update") { item.I_ID = Convert.ToInt32(ViewState["iid"]); ServiceItemService.Update_ServiceItem(item); } CommonFunction.AlertAndRedirect(Literal1, "操作成功", "blank.aspx"); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (txtName.Text == "") { CommonFunction.Alert(Literal1, "请输入服务区名称"); return; } if (ServiceInfoService.IsExist_ServiceInfo(txtName.Text)) { CommonFunction.Alert(Literal1, "该服务区名称已经存在"); return; } ServiceInfo info = new ServiceInfo(); info.S_Name = txtName.Text; info.S_Star = ddlStar.Text; info.S_Type = ddlType.Text; info.S_City = ddlCity.Text; info.S_Welcome = txtName.Text + " 欢迎您!"; info.S_HID = Convert.ToInt32(ddlGs.SelectedValue); ServiceInfoService.Insert_ServiceInfo(info); CommonFunction.Alert(Literal1, "添加成功"); txtName.Text = ""; }
protected void btnLogin_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { return; } if (txtPwd.Text.Trim() == "") { return; } UserInfo info = null; info = UserInfoService.Get_UserInfo(txtName.Text.Trim()); if (info != null && CommonFunction.Decrypt(info.U_Pwd, "gsgl") == txtPwd.Text.Trim() && info.U_DepartId == 7) { Session["reportuser"] = info; Response.Redirect("main.aspx"); } else { CommonFunction.Alert(Literal1, "用户名或密码错误"); return; } }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { if (txtName.Text.Trim() == "") { CommonFunction.Alert(Literal1, "请输入用户名"); return; } if (txtPwd.Text.Trim() == "") { CommonFunction.Alert(Literal1, "请输入密码"); return; } if (Session["CheckCode"].ToString() != txtCode.Text) { CommonFunction.Alert(Literal1, "验证码错误"); return; } UserInfo info = null; info = UserInfoService.Get_UserInfo(txtName.Text.Trim()); if (info != null && CommonFunction.Decrypt(info.U_Pwd, "gsgl") == txtPwd.Text.Trim() && info.U_DepartId != 7) { Session["GsglInfo"] = info; Response.Redirect("MainMgr.aspx"); } else { CommonFunction.Alert(Literal1, "用户名或密码错误"); return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (txtUName.Text.Trim() == "") { return; } if (txtContent.Text.Trim() == "") { return; } MessageBoard mess = new MessageBoard(); mess.M_UName = txtUName.Text.Trim(); mess.M_Content = txtContent.Text.Trim(); mess.M_SID = ((ServiceInfo)Session["serviceinfo"]).S_ID; mess.M_Emotion = ""; int result = MessageBoardService.Insert_MessageBoard(mess); if (result > 0) { txtUName.Text = ""; txtContent.Text = ""; CommonFunction.Alert(Literal1, "提交成功,谢谢您的参与!"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Session["CheckCode"].ToString() != txtCode.Text.Trim()) { CommonFunction.Alert(Literal1, "验证码错误"); txtCode.Focus(); return; } UserInfo info = null; info = UserInfoService.Get_UserInfoEntity(txtName.Text.Trim()); //txtName.Text = CommonFunction.Decrypt(info.U_LoginPwd, "roadkey"); if (info != null && CommonFunction.Decrypt(info.U_LoginPwd, "roadkey") == txtPwd.Text) { Session["RoadUser"] = info; Session.Timeout = 600; Response.Redirect("main.aspx"); } else { CommonFunction.Alert(Literal1, "用户名或密码错误,请重新输入"); txtPwd.Focus(); return; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strContent = Request.Form["t_contents"].ToString(); if (cboxPic.Checked) { if (ViewState["strAction"].ToString() == "add" && (!FUploadImg.HasFile || !FUploadView.HasFile)) { CommonFunction.Alert(Literal1, "请上传缩略图和图片!"); return; } string fileName = CommonFunction.Get_DynamicString() + FUploadImg.FileName; string vfileName = CommonFunction.Get_DynamicString() + FUploadView.FileName; string filePath = Server.MapPath("~/newsimages/" + fileName); string vfilePath = Server.MapPath("~/newsimages/" + vfileName); if (FUploadImg.HasFile) { if (!CommonFunction.Is_FileUploadSuccessfully(FUploadImg, Literal1, filePath, new string[] { ".gif", ".jpg", ".jpeg" })) { return; } ViewState["ImgPath"] = fileName; } if (FUploadView.HasFile) { if (!CommonFunction.Is_FileUploadSuccessfully(FUploadView, Literal1, vfilePath, new string[] { ".gif", ".jpg", ".jpeg" })) { return; } ViewState["ImgView"] = vfileName; } ViewState["ImgIco"] = "图片新闻"; } NewsInfo news = new NewsInfo(); news.N_Title = txtTitle.Text; news.N_From = txtFrom.Text; news.N_Content = PubClass.Tool.CheckStr(strContent); news.N_ImgPath = ViewState["ImgPath"].ToString(); news.N_ImgView = ViewState["ImgView"].ToString(); news.N_HotIco = txtRemarkContent.Text.Trim(); news.N_PicIco = ViewState["ImgIco"].ToString(); news.N_Time = txtTime.Text; news.N_TID = Convert.ToInt32(((DataTable)ViewState["dtType"]).Rows[0]["T_ID"]); if (ViewState["strAction"].ToString() == "update") { news.N_ID = Convert.ToInt32(ViewState["nid"]); NewsInfoService.Update_NewsInfoWithTime(news); } else if (ViewState["strAction"].ToString() == "add") { NewsInfoService.Insert_NewsInfoWithTime(news); } CommonFunction.AlertAndRedirect(Literal1, "操作成功", "ImageTextRemarkNewsMgr.aspx?tid=" + Convert.ToInt32(((DataTable)ViewState["dtType"]).Rows[0]["T_ID"])); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (txtName.Text == "") { CommonFunction.Alert(Literal1, "请输入模块名称"); return; } ServiceModel model = new ServiceModel(); model.M_Name = txtName.Text; model.M_ParentID = Convert.ToInt32(ddlModel.SelectedValue); ServiceModelService.Insert_ServiceModel(model); CommonFunction.Alert(Literal1, "添加成功"); txtName.Text = ""; }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { UserInfo info = (UserInfo)Session["ServiceUser"]; if (txtOldPwd.Text.Trim() != info.U_Pwd) { CommonFunction.Alert(Literal1, "原始密码不正确"); return; } info.U_Pwd = txtNewPwd.Text.Trim(); info.U_Remark = txtRemark.Text; UserInfoService.Update_User(info); CommonFunction.Alert(Literal1, "修改成功"); Session["ServiceUser"] = info; }
/// <summary> /// 保存服务区基本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveInfo_Click(object sender, ImageClickEventArgs e) { if (txtStake.Text.Trim() == "") { CommonFunction.Alert(Literal1, "请输入里程桩号"); return; } if (txtStakeNum.Text.Trim() == "") { CommonFunction.Alert(Literal1, "请输入里程数"); return; } if (!CommonFunction.Is_Nonnegative(txtStakeNum.Text.Trim())) { CommonFunction.Alert(Literal1, "里程数为非负值"); return; } ServiceInfo dtInfo = (ServiceInfo)ViewState["dtInfo"]; dtInfo.S_Star = ddlStar.Text; dtInfo.S_HID = Convert.ToInt32(ddlGs.SelectedValue); dtInfo.S_Type = ddlType.Text; dtInfo.S_Stake = txtStake.Text; dtInfo.S_Phone = txtPhone.Text; dtInfo.S_Service = txtServices.Text; dtInfo.S_StakeNum = Convert.ToDouble(txtStakeNum.Text); dtInfo.S_City = ddlCity.Text; dtInfo.S_Welcome = txtWelcome.Text.Trim(); dtInfo.S_Remark = txtRemark.Text; dtInfo.S_CYRemark = txtCYRemark.Text; dtInfo.S_CSRemark = txtCSRemark.Text; dtInfo.S_ZSRemark = txtZSRemark.Text; dtInfo.S_JYZRemark = txtJYZRemark.Text; dtInfo.S_QXRemark = txtQXRemark.Text; dtInfo.S_TCSRemark = txtTCSRemark.Text; dtInfo.S_WSJRemark = txtWSJRemark.Text; dtInfo.S_FWDWRemark = txtFWDWRemark.Text; ServiceInfoService.Update_ServiceBasicInfo(dtInfo); ViewState["dtInfo"] = dtInfo; CommonFunction.Alert(Literal1, "修改成功"); }
protected void btnAdd_Click(object sender, ImageClickEventArgs e) { if (UserInfoService.IsExistUserInfo(txtName.Text.Trim())) { CommonFunction.Alert(Literal1, "该用户名已存在"); return; } UserInfo info = new UserInfo(); info.U_Name = txtName.Text.Trim(); info.U_Pwd = txtPwd.Text.Trim(); info.U_Remark = txtRemark.Text; info.U_Power = 1; info.U_SID = Convert.ToInt32(ddlService.SelectedValue); UserInfoService.Insert_User(info); CommonFunction.Alert(Literal1, "添加成功"); txtName.Text = ""; txtRemark.Text = ""; }
/// <summary> /// 文件上传 /// </summary> /// <param name="fileUpload">上传控件</param> /// <param name="path">上传路径</param> /// <param name="allowExtension">允许上传文件的后缀名</param> /// <returns></returns> public static bool Is_FileUploadSuccessfully(FileUpload fileUpload, Literal lit, string path, string[] allowExtension) { bool fileOK = false; if (!fileUpload.HasFile) { CommonFunction.Alert(lit, "选择上传的文件"); return(false); } string fileExtension = System.IO.Path.GetExtension(fileUpload.FileName).ToLower(); for (int i = 0; i < allowExtension.Length; i++) { if (fileExtension == allowExtension[i]) { fileOK = true; break; } } if (!fileOK) { CommonFunction.Alert(lit, "文件的格式不正确"); return(false); } //if (fileUpload.PostedFile.ContentLength > 1024 * 500) //{ // CommonFunction.Alert("文件不能大于500KB"); // return false; //} try { fileUpload.PostedFile.SaveAs(path); CommonFunction.Alert(lit, "上传成功!"); return(true); } catch (Exception ex) { CommonFunction.Alert(lit, "上传失败"); return(false); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (!FileUpload1.HasFile) { CommonFunction.Alert(Literal1, "请选择要上传的文件"); return; } string fileName = CommonFunction.Get_DynamicString() + FileUpload1.FileName; string filePath = Server.MapPath("~/DownLoad/" + fileName); int fileSzie = Convert.ToInt32(FileUpload1.PostedFile.ContentLength / 1024); FileUpload1.PostedFile.SaveAs(filePath); FileDownload download = new FileDownload(); download.FD_Title = txtTitle.Text; download.FD_FTID = Convert.ToInt32(((DataTable)ViewState["dtType"]).Rows[0]["FT_ID"]); download.FD_Path = fileName; download.FD_Size = fileSzie + "KB"; download.FD_CreateDate = txtTime.Text; FileDownloadService.Insert_FileDownload(download); CommonFunction.AlertAndRedirect(Literal1, "上传成功", "FileDownloadMgr.aspx?ftid=" + Convert.ToInt32(((DataTable)ViewState["dtType"]).Rows[0]["FT_ID"])); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (FUploadXls.HasFile == false) { CommonFunction.Alert(Literal1, "请您选择Excel文件"); return; } string IsXls = System.IO.Path.GetExtension(FUploadXls.FileName).ToString().ToLower(); if (IsXls != ".xls") { CommonFunction.Alert(Literal1, "只可以选择Excel文件"); return; } string filename = CommonFunction.Get_DynamicString() + ".xls"; string filePath = Server.MapPath("~/AdminMgr/xls/" + filename); FUploadXls.PostedFile.SaveAs(filePath); DataSet ds = ExcelSqlConnection(filePath, filename); DataTable dt = ds.Tables[0]; if (dt == null || dt.Rows.Count == 0) { CommonFunction.Alert(Literal1, "'Excel表为空表,无数据!"); return; } for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][1] == null || dt.Rows[i][1].ToString().Trim() == "") { continue; } string sqlStr = "INSERT INTO Main_OverRunInfo" + "([OI_LicencePlate]" + ",[OI_Length]" + " ,[OI_Width]" + " ,[OI_Heigth]" + " ,[OI_GoodsName]" + " ,[OI_Weight]" + " ,[OI_Path]" + " ,[OI_CreateDate]" + " ,[OI_PassDate]" + " ,[OI_TransUnit]" + " ,[OI_PassCode]" + " ,[OI_Remark])" + " VALUES(" + " '" + dt.Rows[i][1] + "'" + " ,'" + dt.Rows[i][2] + "'" + " ,'" + dt.Rows[i][3] + "'" + " ,'" + dt.Rows[i][4] + "'" + " ,'" + dt.Rows[i][5] + "'" + " ,'" + dt.Rows[i][6] + "'" + " ,'" + dt.Rows[i][7] + "'" + " ,'" + dt.Rows[i][8] + "'" + " ,'" + dt.Rows[i][9] + "'" + " ,'" + dt.Rows[i][10] + "'" + " ,'" + dt.Rows[i][11] + "'" + " ,'" + dt.Rows[i][12] + "')"; DBHelper.ExecuteCommand(sqlStr); } CommonFunction.AlertAndRedirect(Literal1, "导入完毕", "ChaoXianMgr.aspx"); }