Exemple #1
0
        public NFMT.Common.ResultModel Submit(UserModel user, IModel obj, ITaskProvider taskProvider, MasterEnum masterEnum)
        {
            ResultModel result = new ResultModel();

            //提交审核
            NFMT.WorkFlow.BLL.FlowMasterBLL flowMasterBLL = new NFMT.WorkFlow.BLL.FlowMasterBLL();
            result = flowMasterBLL.Get(user, (int)masterEnum);
            if (result.ResultStatus != 0)
                return result;
            NFMT.WorkFlow.Model.FlowMaster flowMaster = result.ReturnValue as NFMT.WorkFlow.Model.FlowMaster;

            NFMT.WorkFlow.Model.DataSource source = new NFMT.WorkFlow.Model.DataSource()
            {
                BaseName = obj.DataBaseName,
                TableCode = obj.TableName,
                DataStatus = NFMT.Common.StatusEnum.待审核,
                RowId = obj.Id,
                ViewUrl = flowMaster.ViewUrl,
                EmpId = user.EmpId,
                ApplyTime = DateTime.Now,
                ApplyTitle = string.Empty,
                ApplyMemo = string.Empty,
                ApplyInfo = string.Empty,
                ConditionUrl = flowMaster.ConditionUrl,
                RefusalUrl = flowMaster.RefusalUrl,
                SuccessUrl = flowMaster.SuccessUrl,
                DalName = obj.DalName,
                AssName = obj.AssName
            };

            result = taskProvider.Create(user,obj);
            if (result.ResultStatus != 0)
                return result;

            NFMT.WorkFlow.Model.Task task = result.ReturnValue as NFMT.WorkFlow.Model.Task;
            if (task == null)
            {
                result.ResultStatus = -1;
                result.Message = "创建任务失败";
                return result;
            }
            task.MasterId = flowMaster.MasterId;

            NFMT.WorkFlow.FlowOperate flowOperate = new NFMT.WorkFlow.FlowOperate();
            result = flowOperate.AuditAndCreateTask(user, obj, flowMaster, source, task);

            return result;
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";

            int masterId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["masterId"]) || !int.TryParse(context.Request.Form["masterId"], out masterId) || masterId <= 0)
            {
                context.Response.Write("流程模版序号错误");
                context.Response.End();
            }

            int id = 0;
            if (string.IsNullOrEmpty(context.Request.Form["id"]) || !int.TryParse(context.Request.Form["id"], out id) || id <= 0)
            {
                context.Response.Write("序号错误");
                context.Response.End();
            }

            NFMT.User.BLL.BlocBLL blocBLL = new NFMT.User.BLL.BlocBLL();
            NFMT.Common.ResultModel result = blocBLL.Get(user, id);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            NFMT.User.Model.Bloc bloc = result.ReturnValue as NFMT.User.Model.Bloc;

            NFMT.WorkFlow.BLL.FlowMasterBLL flowMasterBLL = new NFMT.WorkFlow.BLL.FlowMasterBLL();
            result = flowMasterBLL.Get(user, masterId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            NFMT.WorkFlow.Model.FlowMaster flowMaster = result.ReturnValue as NFMT.WorkFlow.Model.FlowMaster;

            NFMT.WorkFlow.Model.DataSource source = new NFMT.WorkFlow.Model.DataSource()
            {
                //DataBaseName = "NFMT_User",
                TableName = "dbo.Bloc",
                DataStatus = NFMT.Common.StatusEnum.待审核,
                RowId = id,//BlocId
                ViewUrl = flowMaster.ViewUrl,
                EmpId = user.EmpId,
                ApplyTime = DateTime.Now,
                ApplyTitle = string.Empty,
                ApplyMemo = string.Empty,
                ApplyInfo = string.Empty,
                RefusalUrl = flowMaster.RefusalUrl,
                SuccessUrl = flowMaster.SuccessUrl,
                DalName = string.IsNullOrEmpty(bloc.DalName) ? "NFMT.User.DAL.BlocDAL" : bloc.DalName,
                AssName = string.IsNullOrEmpty(bloc.AssName) ? "NFMT.User" : bloc.AssName
            };

            NFMT.WorkFlow.Model.Task task = new NFMT.WorkFlow.Model.Task()
            {
                MasterId = masterId,
                TaskName = string.Format("{0} 审核", bloc.BlocName)
            };

            result = blocBLL.Submit(user, new NFMT.User.Model.Bloc() { Id = id });
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            //NFMT.WorkFlow.FlowOperate flowOperate = new NFMT.WorkFlow.FlowOperate();
            //result = flowOperate.CreateTask(user, flowMaster, source, task);
            //if (result.ResultStatus == 0)
            //{
            //    context.Response.Write("提交审核成功");
            //}
            //else
            //{
            //    context.Response.Write(result.Message);
            //}
        }
        public void ProcessRequest(HttpContext context)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";

            int masterId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["mid"]) || !int.TryParse(context.Request.Form["mid"], out masterId) || masterId <= 0)
            {
                context.Response.Write("流程模版序号错误");
                context.Response.End();
            }

            if (string.IsNullOrEmpty(context.Request.Form["model"]))
            {
                context.Response.Write("实体不可为空");
                context.Response.End();
            }

            string taskName = context.Request.Form["tname"];
            if (string.IsNullOrEmpty(taskName))
            {
                context.Response.Write("任务名称不可为空");
                context.Response.End();
            }

            string taskConnext = context.Request.Form["tConnext"];
            if (string.IsNullOrEmpty(taskConnext))
            {
                context.Response.Write("任务内容不可为空");
                context.Response.End();
            }

            var obj = serializer.Deserialize<NFMT.Common.AuditModel>(context.Request.Form["model"]);
            if (obj == null)
            {
                context.Response.Write("实体转换出错");
                context.Response.End();
            }

            //if (obj.Status != NFMT.Common.StatusEnum.已录入)
            //{
            //    context.Response.Write("非已录入状态下不能提交审核");
            //    context.Response.End();
            //}

            NFMT.WorkFlow.BLL.FlowMasterBLL flowMasterBLL = new NFMT.WorkFlow.BLL.FlowMasterBLL();
            NFMT.Common.ResultModel result = flowMasterBLL.Get(user, masterId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            NFMT.WorkFlow.Model.FlowMaster flowMaster = result.ReturnValue as NFMT.WorkFlow.Model.FlowMaster;

            NFMT.WorkFlow.Model.DataSource source = new NFMT.WorkFlow.Model.DataSource()
            {
                BaseName = obj.DataBaseName,
                TableCode = obj.TableName,
                DataStatus = NFMT.Common.StatusEnum.待审核,
                RowId = obj.Id,
                ViewUrl = flowMaster.ViewUrl,
                EmpId = user.EmpId,
                ApplyTime = DateTime.Now,
                ApplyTitle = string.Empty,
                ApplyMemo = string.Empty,
                ApplyInfo = string.Empty,
                ConditionUrl = flowMaster.ConditionUrl,
                RefusalUrl = flowMaster.RefusalUrl,
                SuccessUrl = flowMaster.SuccessUrl,
                DalName = obj.DalName,
                AssName = obj.AssName
            };

            NFMT.WorkFlow.Model.Task task = new NFMT.WorkFlow.Model.Task()
            {
                MasterId = masterId,
                TaskName = taskName,
                TaskConnext = taskConnext
            };

            NFMT.WorkFlow.FlowOperate flowOperate = new NFMT.WorkFlow.FlowOperate();
            result = flowOperate.AuditAndCreateTask(user, obj, flowMaster, source, task);
            if (result.ResultStatus == 0)
                context.Response.Write("提交审核成功");
            else
                context.Response.Write(result.Message);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Utility.VerificationUtility ver = new Utility.VerificationUtility();
                //ver.JudgeOperate(this.Page, 22, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 });

                NFMT.Common.UserModel user = NFMTSite.Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                string directURL = string.Format("{0}WorkFlow/TaskList.aspx", NFMT.Common.DefaultValue.NfmtSiteName);

                this.navigation1.Routes.Add("待审核任务列表", directURL);
                this.navigation1.Routes.Add("待审核任务明细", string.Empty);

                int nodeId = 0;//taskNodeId
                if (nodeId == 0 && (string.IsNullOrEmpty(Request.QueryString["NodeId"]) || !int.TryParse(Request.QueryString["NodeId"], out nodeId)))
                    Response.Redirect(directURL);

                this.hidId.Value = nodeId.ToString();

                //获取任务节点
                NFMT.WorkFlow.BLL.TaskNodeBLL taskNodeBLL = new NFMT.WorkFlow.BLL.TaskNodeBLL();
                result = taskNodeBLL.Get(user, nodeId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.TaskNode taskNode = result.ReturnValue as NFMT.WorkFlow.Model.TaskNode;
                if (taskNode == null || taskNode.TaskNodeId <= 0)
                    Response.Redirect(directURL);

                if (taskNode.NodeStatus != NFMT.Common.StatusEnum.待审核 || taskNode.EmpId != user.EmpId)
                    Response.Redirect(directURL);

                //获取节点
                NFMT.WorkFlow.BLL.NodeBLL nodeBLL = new NFMT.WorkFlow.BLL.NodeBLL();
                result = nodeBLL.Get(user, taskNode.NodeId);
                if (result.ResultStatus == 0)
                {
                    NFMT.WorkFlow.Model.Node node = result.ReturnValue as NFMT.WorkFlow.Model.Node;
                    if (node == null || node.NodeId <= 0)
                        Response.Redirect(directURL);

                    nodeType = node.NodeType;
                }

                //获取任务
                NFMT.WorkFlow.BLL.TaskBLL taskBLL = new NFMT.WorkFlow.BLL.TaskBLL();
                result = taskBLL.Get(user, taskNode.TaskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                NFMT.WorkFlow.Model.Task task = result.ReturnValue as NFMT.WorkFlow.Model.Task;
                if (task == null || task.TaskId <= 0 || task.TaskStatus != NFMT.Common.StatusEnum.已生效)
                    Response.Redirect(directURL);

                //获取任务附件
                NFMT.WorkFlow.BLL.TaskAttachBLL taskAttachBLL = new NFMT.WorkFlow.BLL.TaskAttachBLL();
                result = taskAttachBLL.GetTaskAttachByTaskId(user, task.TaskId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                List<NFMT.WorkFlow.Model.TaskAttach> taskAttachs = result.ReturnValue as List<NFMT.WorkFlow.Model.TaskAttach>;
                if (taskAttachs == null && !taskAttachs.Any())
                    Response.Redirect(directURL);

                string aids = string.Empty;
                foreach (NFMT.WorkFlow.Model.TaskAttach taskAttach in taskAttachs)
                {
                    aids += taskAttach.AttachId + ",";
                }
                if (!string.IsNullOrEmpty(aids))
                    aids = aids.Substring(0, aids.Length - 1);

                //获取任务附件
                NFMT.Operate.BLL.AttachBLL attachBLL = new NFMT.Operate.BLL.AttachBLL();
                result = attachBLL.GetAttachByAttachIds(user, aids);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                attachs = result.ReturnValue as List<NFMT.Operate.Model.Attach>;
                if (attachs != null && attachs.Any())
                    hasAttachs = true;

                this.hidtaskId.Value = task.TaskId.ToString();

                //if (task.TaskStatus != NFMT.Common.StatusEnum.已生效)
                //    Response.Redirect(directURL);

                //获取数据源
                NFMT.WorkFlow.BLL.DataSourceBLL dataSourceBLL = new NFMT.WorkFlow.BLL.DataSourceBLL();
                result = dataSourceBLL.Get(user, task.DataSourceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(directURL);

                dataSource = result.ReturnValue as NFMT.WorkFlow.Model.DataSource;
                if (dataSource == null || dataSource.SourceId <= 0)
                    Response.Redirect(directURL);

                //判断该任务节点是否需要操作,如有,则跳转到相应界面
                NFMT.WorkFlow.BLL.TaskOperateBLL taskOperateBLL = new NFMT.WorkFlow.BLL.TaskOperateBLL();
                result = taskOperateBLL.GetByTaskNodeId(user, taskNode.TaskNodeId);
                if (result.ResultStatus == 0)
                {
                    NFMT.WorkFlow.Model.TaskOperate taskOperate = result.ReturnValue as NFMT.WorkFlow.Model.TaskOperate;
                    try
                    {
                        Response.Redirect(string.Format(taskOperate.OperateUrl, dataSource.RowId.ToString(), taskNode.TaskNodeId));
                    }
                    catch (Exception ex)
                    {
                        this.WarmAlert(ex.Message, "#");
                    }
                }

                this.spTaskName.InnerText = task.TaskName;
                NFMT.User.Model.Employee emp = NFMT.User.UserProvider.Employees.FirstOrDefault(temp => temp.EmpId == dataSource.EmpId);
                if (emp != null)
                    this.spTaskApplyPerson.InnerText = emp.Name;
                this.spTaskApplyTime.InnerText = dataSource.ApplyTime.ToString();
                this.spTaskMemo.InnerText = task.TaskConnext;
                //this.spTaskStatus.InnerText = task.TaskStatusName;
                //this.spTaskFlowDesc.InnerText = task.FlowDescribtion;

                this.viewUrl = string.IsNullOrEmpty(dataSource.ViewUrl.Trim()) ? "#" : string.Format("{0}{1}", NFMT.Common.DefaultValue.NfmtSiteName, string.Format(dataSource.ViewUrl, dataSource.RowId));

                NFMT.Operate.AttachType attachType = attachBLL.GetAttachTypeByModel(new NFMT.Common.AuditModel() { TableName = dataSource.TableCode });
                attachTypeId = (int)attachType;
            }
        }
Exemple #5
0
        //提交审核
        protected void Button1_Click(object sender, EventArgs e)
        {
            NFMT.WorkFlow.BLL.FlowMasterBLL flowMasterBLL = new NFMT.WorkFlow.BLL.FlowMasterBLL();
            NFMT.WorkFlow.BLL.DataSourceBLL dataSourceBLL = new NFMT.WorkFlow.BLL.DataSourceBLL();
            NFMT.WorkFlow.FlowOperate flowOperate = new NFMT.WorkFlow.FlowOperate();

            NFMT.WorkFlow.Model.FlowMaster flowMaster = flowMasterBLL.Get(user, 8).ReturnValue as NFMT.WorkFlow.Model.FlowMaster;

            NFMT.WorkFlow.Model.DataSource source = new NFMT.WorkFlow.Model.DataSource()
            {
                //DataBaseName = "NFMT",
                TableName = "Area",
                DataStatus = NFMT.Common.StatusEnum.待审核,
                RowId = 1,
                ViewUrl = string.Empty,
                //TaskId = taskid,
                EmpId = 1,
                ApplyTime = DateTime.Now,
                ApplyTitle = string.Empty,
                ApplyMemo = string.Empty,
                ApplyInfo = string.Empty,
                RefusalUrl = string.Format("{0}WorkFlow/Handler/SuccessHandler.ashx",NFMT.Common.DefaultValue.NfmtSiteName),
                SuccessUrl = string.Format("{0}WorkFlow/Handler/SuccessHandler.ashx",NFMT.Common.DefaultValue.NfmtSiteName)
            };

            //int taskid = Convert.ToInt32(flowOperate.CreateTask(user, flowMaster, source, new NFMT.WorkFlow.Model.Task()
            //{
            //    MasterId = 8,
            //    TaskName = "区域审核",
            //    TaskStatus = NFMT.Common.StatusEnum.待审核
            //}).ReturnValue);
        }