protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LiuYanDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { string DeleteTitle = ""; foreach (GridViewRow gr in this.GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[1].FindControl("Select"); if (cb.Checked) { //删除数据库信息 Label ll = (Label)gr.Cells[1].FindControl("lblLiuYanID"); int LiuYanID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); DeleteTitle += bll_LiuYan.GetModel(LiuYanID).MainInfo + ","; bll_LiuYan.Delete(LiuYanID); } } LogManage.WriteLog(Request.UserHostAddress, "留言管理", "删除留言", "成功", "留言主题:" + DeleteTitle.TrimEnd(',') + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); ShowData(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (Request["LiuYanID"] + "" == "") { Response.Redirect("RightsWarn.aspx"); } else { try { WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); WebProject.Model.BaseData.ZT_COM_LiuYan model_LiuYan = bll_LiuYan.GetModel(Int32.Parse(Request["LiuYanID"].ToString())); model_LiuYan.Reply = this.txtReply.Text.Trim(); model_LiuYan.ReplyTime = DateTime.Now; model_LiuYan.LastUpdateBy = SessionUtil.GetAdminSession().AdminNo; model_LiuYan.LastUpdateDate = DateTime.Now; bll_LiuYan.Update(model_LiuYan); LogManage.WriteLog(Request.UserHostAddress, "留言管理", "回复留言", "成功", "回复主题:" + model_LiuYan.MainInfo + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); MessageBox.ShowAndRedirect(this, "回复留言成功!", "LiuYanList.aspx"); } catch { Response.Redirect("RightsWarn.aspx"); } } } }
public void ShowLiuYanInfo() { int currentPage = Convert.ToInt32(this.dang.Text); //当前页 WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); DataSet ds = bll_LiuYan.GetList(" 1=1 "); this.count.Text = ds.Tables[0].Rows.Count.ToString(); if (ds.Tables[0].Rows.Count >= 0) { System.Web.UI.WebControls.PagedDataSource pds = new PagedDataSource(); pds.DataSource = ds.Tables[0].DefaultView; pds.AllowPaging = true; pds.PageSize = 5; //设置页面显示的数目 pds.CurrentPageIndex = currentPage - 1; //当前页面索引,索引号从0开始 this.countpage.Text = pds.PageCount.ToString();//总页数 if (currentPage == 1) { this.shou.Enabled = false; this.shang.Enabled = false; } else { this.shou.Enabled = true; this.shang.Enabled = true; } if (currentPage == pds.PageCount) { this.xia.Enabled = false; this.last.Enabled = false; } else { this.xia.Enabled = true; this.last.Enabled = true; } this.Repeater1.DataSource = pds; this.Repeater1.DataBind(); } else { this.lblMessage.Visible = true; this.countpage.Text = this.dang.Text; this.shou.Enabled = false; this.shang.Enabled = false; this.xia.Enabled = false; this.last.Enabled = false; } }
public void ShowData() { if (Request["LiuYanID"] + "" == "") { Response.Redirect("RightsWarn.aspx"); } else { try { WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); WebProject.Model.BaseData.ZT_COM_LiuYan model_LiuYan = bll_LiuYan.GetModel(Int32.Parse(Request["LiuYanID"].ToString())); this.lblAddress.Text = model_LiuYan.Address.ToString(); this.lblBody.Text = model_LiuYan.Body.ToString(); this.lblCompanyName.Text = model_LiuYan.CompanyName.ToString(); this.lblEmail.Text = model_LiuYan.Email.ToString(); this.lblFax.Text = model_LiuYan.Fax.ToString(); if (model_LiuYan.IsIndex.ToString() == "1") { this.lblIsIndex.Text = "已审核"; } else { this.lblIsIndex.Text = "未审核"; } this.lblMailNum.Text = model_LiuYan.MailNum.ToString(); this.lblMainInfo.Text = model_LiuYan.MainInfo.ToString(); this.lblMobile.Text = model_LiuYan.Mobile.ToString(); this.lblName.Text = model_LiuYan.Name.ToString(); this.lblReply.Text = model_LiuYan.Reply.ToString(); this.lblReplyTime.Text = model_LiuYan.ReplyTime.ToString(); if (model_LiuYan.Sex.ToString() == "1") { this.lblSex.Text = "男"; } else { this.lblSex.Text = "女"; } this.lblTelephone.Text = model_LiuYan.Telephone.ToString(); } catch { Response.Redirect("RightsWarn.aspx"); } } }
public void ShowData() { WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); DataSet ds = bll_LiuYan.GetList(""); if (ds.Tables[0].Rows.Count > 0) { this.lblMessage.Visible = false; this.btnDeleteSelect.Visible = true; this.GridView1.Visible = true; this.GridView1.DataSource = ds; this.GridView1.DataBind(); } else { this.lblMessage.Visible = true; this.btnDeleteSelect.Visible = false; this.GridView1.Visible = false; } }
protected void btnIsIndex_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { try { WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); WebProject.Model.BaseData.ZT_COM_LiuYan model_LiuYan = bll_LiuYan.GetModel(Int32.Parse(Request["LiuYanID"].ToString())); model_LiuYan.IsIndex = "1"; model_LiuYan.LastUpdateBy = SessionUtil.GetAdminSession().AdminNo; model_LiuYan.LastUpdateDate = DateTime.Now; bll_LiuYan.Update(model_LiuYan); MessageBox.ShowAndRedirect(this, "设为审核通过成功!", "LiuYanList.aspx"); } catch { Response.Redirect("RightsWarn.aspx"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (this.txtMainInfo.Text.Trim() == "") { MessageBox.Show(this, "请填写留言主题"); return; } else { if (this.txtName.Text.Trim() == "") { MessageBox.Show(this, "请填写您的姓名"); return; } else { string sex = "1"; if (this.sex1.Checked == false && this.sex2.Checked == false) { MessageBox.Show(this, "请选择性别"); return; } if (this.sex2.Checked) { sex = "0"; } else { if (this.txtMobile.Text.Trim() == "") { MessageBox.Show(this, "请填写您的手机号码"); return; } else { double u; if (!double.TryParse(this.txtMobile.Text, out u)) { MessageBox.Show(this, "手机号码必须为数字!"); return; } if (u <= 13000000000 || u >= 19000000000) { MessageBox.Show(this, "请填写正确的手机号码!");//判断输入框中的值是否为数字和是否溢出 return; } else { if (this.txtCompanyName.Text.Trim() == "") { MessageBox.Show(this, "请填写您的单位名称"); return; } else { if (this.txtAddress.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtBody.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtCompanyName.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtEmail.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtFax.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtMailNum.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtMainInfo.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtMobile.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtName.Text.Trim().ToLower().IndexOf("script") > 0 || this.txtTelephone.Text.Trim().ToLower().IndexOf("script") > 0) { MessageBox.Show(this, "留言信息内请不要包含非法字符!"); return; } if (CheckString.CheckSqlKeyWord(this.txtAddress.Text)==true || CheckString.CheckSqlKeyWord(this.txtBody.Text)==true || CheckString.CheckSqlKeyWord(this.txtCompanyName.Text)==true || CheckString.CheckSqlKeyWord(this.txtEmail.Text)==true || CheckString.CheckSqlKeyWord(this.txtFax.Text)==true || CheckString.CheckSqlKeyWord(this.txtMailNum.Text)==true || CheckString.CheckSqlKeyWord(this.txtMainInfo.Text)==true || CheckString.CheckSqlKeyWord(this.txtMobile.Text)==true || CheckString.CheckSqlKeyWord(this.txtName.Text)==true || CheckString.CheckSqlKeyWord(this.txtTelephone.Text)==true) { MessageBox.Show(this, "留言信息内请不要包含非法字符!"); return; } WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); WebProject.Model.BaseData.ZT_COM_LiuYan model_LiuYan = new WebProject.Model.BaseData.ZT_COM_LiuYan(); model_LiuYan.Address = this.txtAddress.Text.Trim(); model_LiuYan.Body = this.txtBody.Text.Trim(); model_LiuYan.CompanyName = this.txtCompanyName.Text.Trim(); model_LiuYan.Email = this.txtEmail.Text.Trim(); model_LiuYan.Fax = this.txtFax.Text.Trim(); model_LiuYan.MailNum = this.txtMailNum.Text.Trim(); model_LiuYan.MainInfo = this.txtMainInfo.Text.Trim(); model_LiuYan.Mobile = this.txtMobile.Text.Trim(); model_LiuYan.Name = this.txtName.Text.Trim(); model_LiuYan.Telephone = this.txtTelephone.Text.Trim(); model_LiuYan.Sex = sex.ToString(); bll_LiuYan.Add(model_LiuYan); MessageBox.ShowAndRedirect(this, "留言填写成功!", "Index.aspx"); } } } } } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LiuYanDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblLiuYanID"); int LiuYanID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); LogManage.WriteLog(Request.UserHostAddress, "留言管理", "删除留言", "成功", "留言主题:" + bll_LiuYan.GetModel(LiuYanID).MainInfo + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); bll_LiuYan.Delete(LiuYanID); //重新加载信息 ShowData(); } } }