protected void btndelinfo_my_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); String[] v_uids = this.txtuids.Value.Split(','); string ls_filepath = ""; for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { //判断是否是当前用户的文档 string sql = "select * from hyc_" + txttableid.Value + " where DOCID='" + v_uids[i] + "'"; DataTable dt_judge = Hyoa_global.GetDataTable(sql); if (dt_judge.Rows.Count > 0) { if (dt_judge.Rows[0]["hy_djrid"].ToString() == Session["hyuid"].ToString()) { sql = "delete from hyc_" + txttableid.Value + " where DOCID='" + v_uids[i] + "'"; Hyoa_global.ExcuteSQL(sql); //删除文档时将待办事宜删除start HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy(); Hyoa_dbsy.DOCID = v_uids[i]; Hyoa_dbsy.Deletebydocid(v_uids[i]); //删除文档时将待办事宜删除end //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy start add by xf 20121016 HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl(); Hyoa_flowhistoryinfo_cl.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cl.DeleteByDOCID(); HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy(); Hyoa_flowhistoryinfo_cy.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cy.DeleteByDOCID(); //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy end //删的时候将附件也删除start HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dtfileatt = Hyoa_fileatt.GetfileattByFatherid(v_uids[i]); if (dtfileatt.Rows.Count > 0) { for (int k = 0; k < dtfileatt.Rows.Count; k++) { ls_filepath = Server.MapPath("~/") + dtfileatt.Rows[k]["hy_filepath"].ToString(); if (File.Exists(ls_filepath)) { System.IO.File.Delete(ls_filepath); } Hyoa_fileatt.ID = dtfileatt.Rows[k]["ID"].ToString(); Hyoa_fileatt.Delete(); } } //删的时候将附件也删除end } } } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); String[] v_uids = this.txtuids.Value.Split(','); string ls_filepath = ""; for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { string sql = "delete from hyc_" + txttableid.Value + " where DOCID='" + v_uids[i] + "'"; Hyoa_global.ExcuteSQL(sql); //删除文档时将待办事宜删除start HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy(); Hyoa_dbsy.DOCID = v_uids[i]; Hyoa_dbsy.Deletebydocid(v_uids[i]); //删除文档时将待办事宜删除end //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy start add by xf 20121016 HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl(); Hyoa_flowhistoryinfo_cl.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cl.DeleteByDOCID(); HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy(); Hyoa_flowhistoryinfo_cy.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cy.DeleteByDOCID(); //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy end //删的时候将附件也删除start HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dtfileatt = Hyoa_fileatt.GetfileattByFatherid(v_uids[i]); if (dtfileatt.Rows.Count > 0) { for (int k = 0; k < dtfileatt.Rows.Count; k++) { ls_filepath = Server.MapPath("~/") + dtfileatt.Rows[k]["hy_filepath"].ToString(); if (File.Exists(ls_filepath)) { System.IO.File.Delete(ls_filepath); } Hyoa_fileatt.ID = dtfileatt.Rows[k]["ID"].ToString(); Hyoa_fileatt.Delete(); } } //删的时候将附件也删除end //生成删除日志 start string ls_oppcontent = "表名:hyc_" + txttableid.Value + ";文档ID:" + v_uids[i] + "被删除。"; 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_opptype = "删除"; Hyoa_log.hy_oppcontent = ls_oppcontent; Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString(); Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString(); Hyoa_log.Insert(); //生成删除日志end } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
private void DataPlay() { //hy_json = "{\"success\":true,\"total\":\"60\",\"rows\":[{\"hy_mudelid\":\"111\",\"hy_mudelname\":\"1111\",\"hy_roleid\":\"111111\",\"hy_qqroleid\":\"111111\",\"hy_isenabled\":\"111111\"}]}"; string hy_json = ""; string ls_success = "true"; //调用方法成功 string ls_flag = "0"; //删除失败 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); string txtuids = ""; if (this.Request.Form["txtuids"] != null) txtuids = this.Request.Form["txtuids"].ToString(); string txttableid = ""; if (this.Request.Form["txttableid"] != null) txttableid = this.Request.Form["txttableid"].ToString(); String[] v_uids = txtuids.Split(','); string ls_filepath = ""; for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { string sql = "delete from hyc_" + txttableid + " where DOCID='" + v_uids[i] + "'"; Hyoa_global.ExcuteSQL(sql); //删除文档时将待办事宜删除start HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy(); Hyoa_dbsy.DOCID = v_uids[i]; Hyoa_dbsy.Deletebydocid(v_uids[i]); //删除文档时将待办事宜删除end //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy start add by xf 20121016 HyoaClass.Hyoa_flowhistoryinfo_cl Hyoa_flowhistoryinfo_cl = new HyoaClass.Hyoa_flowhistoryinfo_cl(); Hyoa_flowhistoryinfo_cl.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cl.DeleteByDOCID(); HyoaClass.Hyoa_flowhistoryinfo_cy Hyoa_flowhistoryinfo_cy = new HyoaClass.Hyoa_flowhistoryinfo_cy(); Hyoa_flowhistoryinfo_cy.DOCID = v_uids[i]; Hyoa_flowhistoryinfo_cy.DeleteByDOCID(); //删除文档对应的hyp_flowhistoryinfo_cl hyp_flowhistoryinfo_cy end //删的时候将附件也删除start HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dtfileatt = Hyoa_fileatt.GetfileattByFatherid(v_uids[i]); if (dtfileatt.Rows.Count > 0) { for (int k = 0; k < dtfileatt.Rows.Count; k++) { ls_filepath = Server.MapPath("~/") + dtfileatt.Rows[k]["hy_filepath"].ToString(); if (File.Exists(ls_filepath)) { System.IO.File.Delete(ls_filepath); } Hyoa_fileatt.ID = dtfileatt.Rows[k]["ID"].ToString(); Hyoa_fileatt.Delete(); } } //删的时候将附件也删除end //生成删除日志 start string ls_oppcontent = "表名:hyc_" + txttableid + ";文档ID:" + v_uids[i] + "被删除。"; 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_opptype = "删除"; Hyoa_log.hy_oppcontent = ls_oppcontent; Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString(); Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString(); Hyoa_log.Insert(); //生成删除日志end ls_flag = "1"; } } hy_json = "{\"success\":" + ls_success + ",\"flag\":\"" + ls_flag + "\"}"; Response.Write(hy_json); }