public void ShowData() { if (Request["ID"] + "" == "") { Response.Redirect("RightsWarn.aspx"); } else { try { WebProject.BLL.BaseData.ZT_COM_WebInfo bll_WebInfo = new WebProject.BLL.BaseData.ZT_COM_WebInfo(); WebProject.Model.BaseData.ZT_COM_WebInfo model_WebInfo = bll_WebInfo.GetModel(Int32.Parse(Request["ID"].ToString())); this.lblID.Text = model_WebInfo.ID.ToString(); this.lblTitle.Text = model_WebInfo.Title.ToString(); this.lblFilePath.Text = model_WebInfo.FilePath.ToString(); this.lblWebURL.Text = model_WebInfo.WebURL.ToString(); this.lblKeyWords.Text = model_WebInfo.KeyWords.ToString(); this.lblDescription.Text = model_WebInfo.KeyWords.ToString(); } catch { Response.Redirect("RightsWarn.aspx"); } } }
protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LianJieDelete.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("lblID"); int ID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_WebInfo bll_WebInfo = new WebProject.BLL.BaseData.ZT_COM_WebInfo(); DeleteTitle += bll_WebInfo.GetModel(ID).Title + ","; bll_WebInfo.Delete(ID); } } 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 (this.txtTitle.Text.Trim() == "") { MessageBox.Show(this, "请输入网页标题!"); return; } if (this.txtWebUrl.Text.Trim() == "") { MessageBox.Show(this, "请输入链接地址!"); return; } if (this.txtKeyWords.Text.Trim() == "") { MessageBox.Show(this, "请输入关键字!"); return; } if (this.txtFilePath.Text.Trim() == "") { MessageBox.Show(this, "请输入文件路径!"); return; } if (this.txtDescription.Text.Trim() == "") { MessageBox.Show(this, "请输入网页描述!"); return; } try { WebProject.BLL.BaseData.ZT_COM_WebInfo bll_WebInfo = new WebProject.BLL.BaseData.ZT_COM_WebInfo(); WebProject.Model.BaseData.ZT_COM_WebInfo model_WebInfo = bll_WebInfo.GetModel(Int32.Parse(Request["ID"].ToString())); model_WebInfo.Title = this.txtTitle.Text.Trim(); model_WebInfo.WebURL = this.txtWebUrl.Text.Trim(); model_WebInfo.KeyWords = this.txtKeyWords.Text.Trim(); model_WebInfo.FilePath = this.txtFilePath.Text.Trim(); model_WebInfo.Description = this.txtDescription.Text.Trim(); bll_WebInfo.Update(model_WebInfo); LogManage.WriteLog(Request.UserHostAddress, "关键字管理", "修改关键字", "成功", "网页标题:" + model_WebInfo.Title + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); MessageBox.ShowAndRedirect(this, "修改关键字成功!", "WebInfoList.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("WebInfoDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblID"); int ID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_WebInfo bll_WebInfo = new WebProject.BLL.BaseData.ZT_COM_WebInfo(); LogManage.WriteLog(Request.UserHostAddress, "关键字管理", "删除关键字", "成功", "网页标题:" + bll_WebInfo.GetModel(ID).Title + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); bll_WebInfo.Delete(ID); //重新加载信息 ShowData(); } } }