<%@ WebHandler Language="C#" Class="updateSOT" %> using System; using eMIS; using System.Web; using System.Web.SessionState; public class updateSOT : IHttpHandler,IRequiresSessionState { DbOperate dbo = null; int gindex = 0; public void ProcessRequest(HttpContext context) { string allParm = context.Request.QueryString["parm"].ToString(); string xwlb = context.Request.QueryString["xwlb"].ToString(); string userid = context.Session["userid"].ToString(); if(userid == null || userid == "") { context.Response.Write("0"); return; } string wwwroot = context.Request.ApplicationPath; if (wwwroot == "/") wwwroot = ""; dbo = new DbOperate(); string sql = ""; string[] parmAttr = allParm.Split(','); try { string rid = getRID(); if (rid == "") { context.Response.Write("0"); } else { sql = "insert into zh_sot(id,gcrq,ryid,部门,pc,bgcry,bgcrbm,bgcbmld,gcdd,yxj,xwms,fj,lb,bh) select '" + rid + "',"; foreach (string item in parmAttr) { sql += "'" + item + "',"; } sql += "'" + xwlb + "',"; string bh = getBH(context); sql += bh; //Log.WriteLog(context.Server.MapPath(wwwroot + "/app_wx/hse/logs"), "sql语句为:" + sql); int i = dbo.ExNonQuery(sql); if (i > 0) { eMIS.WebManager.Flow flow = new eMIS.WebManager.Flow(); bool finalresult = flow.CreateInstance(context, "48434872701", userid, rid); //Log.WriteLog(context.Server.MapPath(wwwroot + "/app_wx/hse/logs"), "流程执行结果为:" + finalresult.ToString()); if (!finalresult) { context.Response.Write("0"); } else { context.Response.Write(rid); } } else { context.Response.Write("0"); } } } catch (Exception e) { context.Response.Write("0"); } } private string getBH(HttpContext context) { DataManager dm = new DataManager(); InstanceManager inst = new InstanceManager(context, dm, "484344930"); int idx = inst.EditControlIDIndex["27"]; ControlManager cm = inst.EditControls[idx]; return cm.Value; } private string getRID() { string id = ""; if (gindex > 3) { return ""; } else { string sql = "select next value for seq_id"; id = dbo.executeScalar(sql).ToString(); if (id == null || id == "") { gindex++; id = getRID(); } } return id; } public bool IsReusable { get { return false; } } }