示例#1
0
        /// <summary>
        /// 发送申请单
        /// </summary>
        /// <param name="context"></param>
        private void sendTask(HttpContext context)
        {
            string json        = string.Empty;
            string TASK_CODE   = context.Request["TASK_CODE"];
            string DEFINE_CODE = context.Request["DEFINE_CODE"];

            try
            {
                WorkFlow.Model.FLOW_TASK model = WorkFlow.BLL.Operate.GetTask(TASK_CODE);
                if (model.STATUS != "0") //状态为0,启动流程
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"流程已经启动,无法再次启动!\"}";
                }
                else
                {
                    bool re = WorkFlow.BLL.Operate.StartFlow(TASK_CODE, DEFINE_CODE, CFunctions.getUserId(context), "");
                    if (re)
                    {
                        json = "{\"IsSuccess\":\"true\",\"Message\":\"发送成功!\"}";
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"发送失败!\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"" + ex.ToString() + "!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
示例#2
0
        /// <summary>
        /// 添加申请单
        /// </summary>
        /// <param name="context"></param>
        private void addTask(HttpContext context)
        {
            string json = string.Empty;

            WorkFlow.Model.FLOW_TASK model = new WorkFlow.Model.FLOW_TASK();
            model.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
            model.DEFINE_CODE = context.Request["DEFINE_CODE"];
            model.TASK_CODE   = context.Request["TASK_CODE"];
            model.TASK_TILTE  = context.Request["TASK_TILTE"];
            model.STATUS      = context.Request["STATUS"];
            model.TASK_TYPE   = context.Request["TASK_TYPE"];
            model.ADD_EMP     = CFunctions.getUserId(context);//context.Request["ADD_EMP"];
            model.ADD_TIME    = DateTime.Now;
            model.TASK_JSON   = context.Request["TASK_JSON"];
            //model.ADD_EMP
            bool result = WorkFlow.BLL.Operate.AddTask(model);

            if (result)
            {
                json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
            }
            else
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
示例#3
0
        /// <summary>
        /// 审核流程
        /// </summary>
        /// <param name="context"></param>
        private void Audit(HttpContext context)
        {
            string json      = string.Empty;
            string TASK_CODE = context.Request["TASK_CODE"];
            string SEQ       = context.Request["SEQ"];
            string reason    = context.Request["REASON"];//审批理由

            try
            {
                WorkFlow.Model.FLOW_TASK model = WorkFlow.BLL.Operate.GetTask(TASK_CODE);

                if (model.STATUS == "E")
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"流程已经结束,无法操作!\"}";
                    context.Response.ContentType = "application/json";
                    context.Response.Write(json);
                    context.ApplicationInstance.CompleteRequest();
                    return;
                }

                if (model.SEQ != SEQ) //是否已经处理过了
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"流程已经审核,无法再次操作!\"}";
                }
                else
                {
                    string meesage = "";
                    bool   re      = WorkFlow.BLL.Operate.AuditStep(TASK_CODE, SEQ, CFunctions.getUserId(context), CFunctions.getRoleId(context), reason, ref meesage);
                    if (re)
                    {
                        json = "{\"IsSuccess\":\"true\",\"Message\":\"审核成功!\"}";
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"审核失败," + meesage + "!\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"" + ex.ToString() + "!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }