//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); JpDepts.deptid = this.txtdeptid.Text; JpDepts.deptname = this.txtdeptname.Text; JpDepts.deptsort = System.Int32.Parse(this.txtdeptsort.Text.ToString()); JpDepts.factdeptid = ""; JpDepts.HeadUnit = ""; JpDepts.SubDept = ""; if (this.txtop.Value == "add") { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "新增", "新增组织记录[id:" + this.txtdeptid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpDepts.Insert(); } else { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "修改", "修改组织记录[id:" + this.txtdeptid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpDepts.Update(); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }