//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //写系统日志start HyoaClass.Hyoa_log Hyoa_log = new HyoaClass.Hyoa_log(); Hyoa_log.ID = System.Guid.NewGuid().ToString(); Hyoa_log.hy_createtime = System.DateTime.Now.ToString(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } Hyoa_log.hy_oppip = userip; Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString(); Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString(); //新文档时 HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept(); if (this.txtop.Value == "add") { Hyoa_dept.hy_deptid = this.hy_deptid.Text; Hyoa_dept.hy_deptname = this.hy_deptname.Text; Hyoa_dept.hy_deptsort = System.Int32.Parse(this.hy_deptsort.Text.ToString()); Hyoa_dept.hy_isenabled = this.hy_isenabled.SelectedValue.ToString(); Hyoa_dept.hy_createtime = System.DateTime.Now.ToString(); Hyoa_dept.Insert(); Hyoa_log.hy_opptype = "新增"; Hyoa_log.hy_oppcontent = "新增部门:" + this.hy_deptname.Text; } else { Hyoa_dept.hy_deptid = this.txtdocid.Value; Hyoa_dept.hy_deptname = this.hy_deptname.Text; Hyoa_dept.hy_deptsort = System.Int32.Parse(this.hy_deptsort.Text.ToString()); Hyoa_dept.hy_isenabled = this.hy_isenabled.SelectedValue.ToString(); Hyoa_dept.Update(); Hyoa_log.hy_opptype = "修改"; Hyoa_log.hy_oppcontent = "修改部门:" + this.hy_deptname.Text; } Hyoa_log.Insert(); //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept(); if (this.txtop.Value == "add") { Hyoa_dept.hy_deptid = this.hy_deptid.Text ; Hyoa_dept.hy_deptname = this.hy_deptname.Text ; Hyoa_dept.hy_deptsort = System.Int32.Parse (this.hy_deptsort.Text.ToString ()); Hyoa_dept.hy_isenabled = this.hy_isenabled.SelectedValue.ToString(); Hyoa_dept.hy_createtime = System.DateTime.Now.ToString(); Hyoa_dept.Insert(); } else { Hyoa_dept.hy_deptid = this.txtdocid.Value; Hyoa_dept.hy_deptname = this.hy_deptname.Text; Hyoa_dept.hy_deptsort = System.Int32.Parse(this.hy_deptsort.Text.ToString()); Hyoa_dept.hy_isenabled = this.hy_isenabled.SelectedValue.ToString(); Hyoa_dept.Update(); } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }