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 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"); } } }
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 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(); } } }