示例#1
0
文件: workFlow.ashx.cs 项目: pcstx/OA
        private string getFormBase(int currentPages,int pageSize,FormBase fb)
        {
            string search = "";
            search += !string.IsNullOrEmpty(fb.FormName) ? " and FormName='" + fb.FormName + "'" : "";
            search += !string.IsNullOrEmpty(fb.FormDesc)  ? " and FormDesc='" + fb.FormDesc + "'" : "";
            search += fb.FormTypeID !=0 ? " and FormTypeID='" + fb.FormTypeID + "'" : "";

            DataTable dtFormBase = DbHelper.GetInstance().GetDBRecords("*", "Workflow_FormBase", "Useflag='1'" +search, "DisplayOrder", pageSize, currentPages);
            string total = DbHelper.GetInstance().ExecSqlResult("select count(*) from Workflow_FormBase where Useflag='1'"+search);
            List<FormBase> lft = new List<FormBase>();

            foreach (DataRow dr in dtFormBase.Rows)
            {
                FormBase ft = new FormBase();
                ft.FormID = Convert.ToInt32(dr["FormID"]);
                ft.FormName = dr["FormName"].ToString();
                ft.FormDesc = dr["FormDesc"].ToString();
                ft.FormTypeID = Convert.ToInt32(dr["FormTypeID"]);
                ft.DisplayOrder = Convert.ToInt32(dr["DisplayOrder"]);
                ft.Useflag = dr["Useflag"].ToString();
                lft.Add(ft);
            }

            var griddata = new { Rows = lft,Total=total };
            string json = new JavaScriptSerializer().Serialize(griddata);

            return json;
        }
示例#2
0
文件: workFlow.ashx.cs 项目: pcstx/OA
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string type = context.Request["type"];

            if (type == "toHtml")
            {
                int workflowID =Convert.ToInt32(context.Request["WorkflowID"]);
                string Html= DBtoHtml(workflowID);
                context.Response.Write(Html);
            }
            else if (type == "CheckWorkflowName")
            {
                string WorkflowName = context.Request["WorkflowName"];
                string sql = "select count(*) from Workflow_Base where WorkflowName='"+WorkflowName+"';";
                int result = Convert.ToInt32(DbHelper.GetInstance().ExecSqlResult(sql));
                context.Response.Write(result);
            }
             else if (type == "FormBase")
            {
                string FormName=    context.Request["FormName"];
                string FormDesc = context.Request["FormDesc"];
                int FormTypeID = Convert.ToInt32(context.Request["FormTypeID"]);

                int currentPages =Convert.ToInt32(context.Request["page"]);
                int pagesize =Convert.ToInt32(context.Request["pagesize"]);

                FormBase fb = new FormBase();
                fb.FormName = FormName;
                fb.FormDesc = FormDesc;
                fb.FormTypeID = FormTypeID;

                string json = getFormBase(currentPages,pagesize,fb);
                context.Response.Write(json);
            }
            else if (type == "FlowTypeID")
            {
               string json= getFormType();
               context.Response.Write(json);
            }
            else if(type=="workflowBase")
            {
                string jsonStr = context.Request["json"];
                int result = CreateWorkFlow(jsonStr);   //增加工作流
                context.Response.Write(result);
            }
            else  //流程
            {
                  string flowNode = context.Request["flownode"];
                  string nodeLink = context.Request["nodeLink"];
                  string WorkflowID = context.Request["WorkflowID"];
                  Dictionary<string, int> dic_wfn = new Dictionary<string, int>();
                  int startNode = 0;

                  delWorkFlow(WorkflowID);  //删除现有的

                  int nodeFlag= AddFlowNode(flowNode, dic_wfn,ref startNode); //增加节点

                  if (nodeFlag == 0)
                  {
                     nodeFlag=  AddNodeLink(nodeLink, dic_wfn,startNode);  //增加连线
                  }

                  context.Response.Write(nodeFlag);
            }
        }