Beispiel #1
0
        /// <summary>
        /// 增加活动实例
        /// </summary>
        /// <param name="model"></param>
        public void Add(wf_workflowspecifics model)
        {
            Entities db = new Entities();

            db.wf_workflowspecifics.Add(model);
            db.SaveChanges();
        }
Beispiel #2
0
        /// <summary>
        /// 获取主要内容
        /// </summary>
        /// <param name="WFSID">活动流程实例编号</param>
        /// <returns></returns>
        public string GetContentPath(string WFSID)
        {
            string               contentPath = string.Empty;
            Entities             db          = new Entities();
            wf_workflowspecifics model       = db.wf_workflowspecifics.SingleOrDefault(a => a.wfsid == WFSID);

            if (model != null)
            {
                string sql = "";
                if (model.tablename == "sm_citizenservices")
                {
                    sql = "select REMARK1 from " + model.tablename + " where citizenid='" + model.tablenameid + "'";
                }
                //else if (model.tablename == "XTGL_ZFSJS")
                //{
                //    sql = "select REMARK1 from " + model.tablename + " where ZFSJID='" + model.tablenameid + "'";
                //}
                //else if (model.tablename == "GCGL_SIMPLES")
                //{
                //    sql = "select REMARK1 from " + model.tablename + " where SIMPLEGCID='" + model.tablenameid + "'";
                //}

                IEnumerable <string> list = db.Database.SqlQuery <string>(sql).ToList();
                if (list != null && list.Count() > 0)
                {
                    contentPath = list.ToList()[0];
                }
            }
            return(contentPath);
        }
Beispiel #3
0
        /// <summary>
        /// 获取单个流程实例根据工作流编号
        /// </summary>
        /// <param name="WFID">工作流编号</param>
        /// <returns></returns>
        public wf_workflowspecifics GetSingle(string WFSID)
        {
            Entities             db    = new Entities();
            wf_workflowspecifics model = db.wf_workflowspecifics.SingleOrDefault(a => a.wfsid == WFSID);

            return(model);
        }
Beispiel #4
0
        /// <summary>
        /// 更新活动实例
        /// </summary>
        /// <param name="model"></param>
        public void Update(wf_workflowspecifics model)
        {
            Entities             db     = new Entities();
            wf_workflowspecifics result = db.wf_workflowspecifics.SingleOrDefault(a => a.wfsid == model.wfsid);

            if (result != null)
            {
                result.status        = model.status;
                result.wfsname       = model.wfsname;
                result.currentwfsaid = model.currentwfsaid;
                result.filestatus    = model.filestatus;
                db.SaveChanges();
            }
        }
Beispiel #5
0
        /// <summary>
        /// 流程提交
        /// </summary>
        /// <param name="workflow">流程实例模型</param>
        /// <param name="TableModel">具体表模型</param>
        /// <returns></returns>
        public string WF_Submit(WorkFlowClass workflow, object TableModel)
        {
            #region 获取数据
            string tableName     = workflow.FunctionName;  //获取表名
            string WFID          = workflow.WFID;          //工作流编号
            string WFDID         = workflow.WFDID;         //工作流环节编号
            string WFSID         = workflow.WFSID;         //活动实例编号
            string WFSAID        = workflow.WFSAID;        //当前环节实例编号
            string dealContent   = workflow.DEALCONTENT;   //会签意见
            string NextWFDID     = workflow.NextWFDID;     //下一个环节编号
            string NextWFUSERIDS = workflow.NextWFUSERIDS; //获取下一个环节的用户
            string IsSendMsg     = workflow.IsSendMsg;     //是否发送短信
            string Remark        = workflow.Remark;
            string processmode   = workflow.processmode;
            string satisfaction  = workflow.satisfaction;
            #endregion

            #region 增加/修改 对应的流程
            string TABLENAMEID = string.Empty; //对应表数据编号
            string WFSNAME     = string.Empty; //活动流程名称
            switch (workflow.FunctionName)
            {
            case "sm_citizenservices":    //市民服务基础表
                TABLENAMEID = function_citizenservices(out WFSNAME, workflow.WFSID, (sm_citizenservices)TableModel);
                break;

            case "yh_yhtasks":    //养护任务基础表
                TABLENAMEID = function_yhtasks(out WFSNAME, workflow.WFSID, (yh_yhtasks)TableModel);
                break;

            case "zxzz_tasks":    //专项整治基础表
                TABLENAMEID = function_specialtasks(out WFSNAME, workflow.WFSID, (zxzz_tasks)TableModel);
                break;

            case "audit_project_w":    //行政审批基础表
                TABLENAMEID = workflow.syncrowguid;
                break;

            default:
                break;
            }
            #endregion

            #region 检查是否存在当前实例,如果不存在则增加当前活动实例

            wf_workflowspecifics WFSModel = null;
            if (!string.IsNullOrEmpty(workflow.WFSID))
            {
                WFSModel = new WF_WorkFlowSpecificDAL().GetSingle(workflow.WFSID);
                if (WFSModel == null)
                {
                    WFSID = "";
                }
                else
                {
                    WFSModel.wfsname = WFSNAME;
                    new WF_WorkFlowSpecificDAL().Update(WFSModel);
                }
            }

            if (string.IsNullOrEmpty(WFSID))
            {
                WFSModel              = new wf_workflowspecifics();
                WFSModel.wfsid        = GetNewId();
                WFSModel.wfid         = WFID;
                WFSModel.tablename    = tableName;
                WFSModel.createuserid = workflow.WFCreateUserID;
                WFSModel.createtime   = DateTime.Now;
                WFSModel.status       = 1;
                WFSModel.tablenameid  = TABLENAMEID;
                WFSModel.wfsname      = WFSNAME;
                new WF_WorkFlowSpecificDAL().Add(WFSModel);
                WFSID = WFSModel.wfsid;
            }
            #endregion

            #region 增加活动实例具体的流程

            #region 更新当前环节
            decimal oldStatus;//当前环节是否已经处理完成 1:未处理,2已经处理
            //更新或者增加当前流程的具体事例---返回当前环节编号
            WFSAID = function_WF_DealCurentActivity(WFSAID, WFSID, workflow.WFCreateUserID.Value, 2, WFDID, out oldStatus);
            //更新或者增加当前环节用户处理的意见---返回当前环节用户需要处理的编号
            string WFSUID = function_WF_DealCurentActivityUser(WFSAID, workflow.WFCreateUserID.Value, dealContent, 2, DateTime.Now, "false", WFSNAME, workflow.WFCreateUserID.Value, Remark, processmode, satisfaction);
            //增加当前处理用户的附件
            switch (workflow.FunctionName)
            {
            case "sm_citizenservices":    //市民服务
                function_WF_WorkFlowAttrach_smsj(WFSUID, workflow.files, workflow.FileSource);
                break;

            case "yh_yhtasks":    //养护任务
                function_WF_WorkFlowAttrach_smsj(WFSUID, workflow.files, workflow.FileSource);
                break;

            case "zxzz_tasks":    //专项整治
                function_WF_WorkFlowAttrach_smsj(WFSUID, workflow.files, workflow.FileSource);
                break;

            case "audit_project_w":    //行政审批基础表
                function_WF_WorkFlowAttrach_smsj(WFSUID, workflow.files, workflow.FileSource);
                break;

            default:
                break;
            }

            #endregion
            //当前状态为处理,则说明是第一个人处理,则需要增加下一个环节,如果当前环节已经处理,则不需要增加下一个环节
            string NextWFSAID = "";
            if (oldStatus == 1)
            {
                //获取该环节是否为最后一个环节
                wf_workflowdetails wfdModel = new WF_WorkFlowDetailDAL().GetSingle(NextWFDID);
                //如果下一个环节的子环节存在,则状态为执行中,内容为空,否则下一个环节状态为结束,内容为已结束
                int    status_wfsa  = 0;
                string content_wfsa = string.Empty;
                if (wfdModel != null && !string.IsNullOrEmpty(wfdModel.nextid))
                {
                    status_wfsa  = 1;
                    content_wfsa = "";
                }
                else
                {
                    //结束该流程
                    WFSModel = new WF_WorkFlowSpecificDAL().GetSingle(WFSID);
                    if (WFSModel != null)
                    {
                        WFSModel.status = 2;
                        new WF_WorkFlowSpecificDAL().Update(WFSModel);
                    }
                    status_wfsa  = 2;
                    content_wfsa = "已结束";
                }

                #region 增加下一个环节

                //增加环节
                NextWFSAID = function_WF_DealCurentActivity("", WFSID, workflow.WFCreateUserID.Value, status_wfsa, NextWFDID, out oldStatus);

                #region 更新活动实例的当前环节编号
                WFSModel = new WF_WorkFlowSpecificDAL().GetSingle(WFSID);
                if (WFSModel != null)
                {
                    WFSModel.currentwfsaid = NextWFSAID;
                    WFSModel.status        = status_wfsa;
                    new WF_WorkFlowSpecificDAL().Update(WFSModel);
                }
                #endregion

                //增加下一个环节的能操作的用户
                if (!string.IsNullOrEmpty(NextWFUSERIDS))
                {
                    string[] NextWFUSERIDS_split = NextWFUSERIDS.Split(',');
                    foreach (var item in NextWFUSERIDS_split)
                    {
                        decimal  userid;
                        DateTime?dealTime = null;
                        if (decimal.TryParse(item, out userid))
                        {
                            if (status_wfsa == 2)
                            {
                                userid    = workflow.WFCreateUserID.Value;
                                dealTime  = DateTime.Now;
                                IsSendMsg = "false";
                            }
                            //增加流程能操作的用户
                            function_WF_DealCurentActivityUser(NextWFSAID, (int)userid, content_wfsa, status_wfsa, dealTime, IsSendMsg, WFSNAME, workflow.WFCreateUserID, Remark, processmode, satisfaction);
                        }
                    }
                }

                #endregion
            }
            #endregion
            return(WFSID + "," + NextWFSAID + "," + TABLENAMEID);
        }