Exemplo n.º 1
0
        private void Add(HttpContext context)
        {
            string json = "";

            try
            {   //1.获取参数
                string ApplicationNo = context.Request["ApplicationNo"].ToString();
                //2.判断申请单号是否存在
                string sql = "";
                if (!string.IsNullOrEmpty(ApplicationNo))
                {
                    sql += " and applicationno='" + ApplicationNo + "'";
                }
                if (cantBll.GetList(sql).Count > 0)
                {
                    json = "{IsSuccess:false,Message:'申请单号已经存在'}";
                }
                else
                {
                    string ApplicantName    = context.Request["ApplicantName"].ToString();
                    string OrganizationName = context.Request["OrganizationName"].ToString();
                    string Organizationid   = context.Request["Organizationid"].ToString();
                    string Submitdate       = context.Request["Submitdate"].ToString();
                    string Applicantamount  = context.Request["Applicantamount"].ToString();
                    string Approveamount    = context.Request["Approveamount"].ToString();
                    string Instructions     = context.Request["Instructions"].ToString();

                    //2.实例化实体类对象
                    WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT cant = new MODEL.Capital.TBL_CAPITALAPPLICANT();
                    cant.capitalapplicantid = Guid.NewGuid().ToString().ToUpper();
                    //cant.Applicantname = ApplicantName;
                    cant.applicantname   = ApplicantName;
                    cant.applicantamount = decimal.Parse(Applicantamount);
                    cant.applicationno   = ApplicationNo;
                    cant.approveamount   = decimal.Parse(Approveamount);
                    cant.instructions    = Instructions;
                    //cant.Organizationid = Organizationid;
                    cant.organizationid = Organizationid;
                    cant.remitdate      = DateTime.Now.ToString();
                    cant.submitdate     = DateTime.Now.ToString();
                    if (cantBll.Insert(cant))
                    {
                        json = "{IsSuccess:true,Message:'添加成功'}";
                    }
                    else
                    {
                        json = "{IsSuccess:true,Message:'添加失败'}";
                    }
                }
            }
            catch (Exception ex)
            {
                json = "{IsSuccess:true,Message:'" + ex.Message + "'}";
                throw;
            }
            json = JsonConvert.SerializeObject(json);
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 2
0
        private void Update(HttpContext context)
        {
            string json = "";

            try
            {
                //1.获取参数
                string ApplicantName = context.Request["ApplicantName"].ToString();
                //string OrganizationName = context.Request["OrganizationName"].ToString();
                string Organizationid = context.Request["Organizationid"].ToString();
                //string Submitdate = context.Request["Submitdate"].ToString();
                string Applicantamount = context.Request["Applicantamount"].ToString();
                string Approveamount   = context.Request["Approveamount"].ToString();
                string Instructions    = context.Request["Instructions"].ToString();
                string ApplicationNo   = context.Request["ApplicationNo"].ToString();
                //2.实例化实体类对象
                WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT cant = new MODEL.Capital.TBL_CAPITALAPPLICANT();
                cant.capitalapplicantid = context.Request["capitalapplicantid"].ToString();
                cant.applicantname      = ApplicantName;
                cant.applicantamount    = decimal.Parse(Applicantamount);
                cant.applicationno      = ApplicationNo;
                cant.approveamount      = decimal.Parse(Approveamount);
                cant.instructions       = Instructions;
                cant.organizationid     = Organizationid;
                cant.remitdate          = context.Request["submitdate"].ToString();
                cant.submitdate         = context.Request["submitdate"].ToString();
                if (cantBll.Update(cant))
                {
                    json = "{IsSuccess:true,Message:'编辑成功'}";
                }
                else
                {
                    json = "{IsSuccess:true,Message:'编辑失败'}";
                }
            }
            catch (Exception ex)
            {
                json = "{IsSuccess:true,Message:'" + ex.Message + "'}";
                throw;
            }
            json = JsonConvert.SerializeObject(json);
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 3
0
        private void updateFlow(HttpContext context)
        {
            string json = string.Empty;

            //返回数据的格式
            WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT model = new MODEL.Capital.TBL_CAPITALAPPLICANT();//材料计划

            string cant = context.Request["data"];

            string type = context.Request["type"];

            try
            {
                List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> >(cant);

                if (list.Count > 0)
                {
                    model = list[0];

                    WorkFlow.Model.FLOW_TASK task = WorkFlow.BLL.Operate.GetTask(model.applicationno);

                    bool result = cantBll.Update(model);

                    string message = "";
                    bool   re      = WorkFlow.BLL.Operate.UpdateTaskJson(model.applicationno, cant, ref message);


                    if (re)
                    {
                        if (type == "send")
                        {
                            if (task != null)
                            {
                                if (task.STATUS != "0")
                                {
                                    json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,该计划的流程正在审批中!\"}";
                                }
                                else
                                {
                                    //发送流程
                                    re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, CFunctions.getUserId(context), "");
                                    if (re)
                                    {
                                        json = "{\"IsSuccess\":\"true\",\"Message\":\"发起成功!\"}";
                                    }
                                    else
                                    {
                                        json = "{\"IsSuccess\":\"false\",\"Message\":\"该流程已经启动!\"}";
                                    }
                                }
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"false\",\"Message\":\"发起失败,流程任务数据不存在!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"true\",\"Message\":\"修改成功!\"}";
                        }
                    }
                    else
                    {
                        json = "{\"IsSuccess\":\"false\",\"Message\":\"操作失败!\"}";
                    }
                }
                else
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据!\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据失败!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 4
0
        private void addFlow(HttpContext context)
        {
            string json = string.Empty;

            //返回数据的格式
            WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT model = new MODEL.Capital.TBL_CAPITALAPPLICANT(); //材料计划
            string cantid = ComFunction.GetId();                                                      //计划主键ID
            string cant   = context.Request["data"];
            string type   = context.Request["type"];

            try
            {
                List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> list = JsonConvert.DeserializeObject <List <WZGL.MODEL.Capital.TBL_CAPITALAPPLICANT> >(cant);

                if (list.Count > 0)
                {
                    list[0].capitalapplicantid = cantid;
                    model = list[0];
                    string sql = "";
                    if (!string.IsNullOrEmpty(model.applicationno))
                    {
                        sql += " and applicationno='" + model.applicationno + "'";
                    }
                    if (cantBll.GetList(sql).Count > 0)
                    {
                        if (type == "send")
                        {
                            string code     = model.applicationno;
                            string def_code = CFunctions.getFlowDefineId(context, "63211695-E9DD-4977-912F-0E5A04DD6F01");
                            //发送流程
                            bool re = WorkFlow.BLL.Operate.StartFlow(code, def_code, WZGL.WEB.Common.CFunctions.getUserId(context), "");
                            if (re)
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"发起流程成功!\"}";
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"false\",\"Message\":\"该流程已经启动!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"false\",\"Message\":\"申请单号已经存在!\"}";
                        }
                    }
                    else
                    {
                        bool result = cantBll.Insert(model);
                        WorkFlow.Model.FLOW_TASK task = new WorkFlow.Model.FLOW_TASK();
                        task.TASK_ID     = Guid.NewGuid().ToString().ToUpper();
                        task.DEFINE_CODE = CFunctions.getFlowDefineId(context, "63211695-E9DD-4977-912F-0E5A04DD6F01");
                        task.TASK_CODE   = model.applicationno;// "CLJH" + DateTime.Now.ToString("yyyyMMddHHmmss"); ;
                        task.TASK_TILTE  = "资金申请" + DateTime.Now.ToString("yyyyMMddHHmmss");
                        task.STATUS      = "0";
                        task.TASK_TYPE   = "63211695-E9DD-4977-912F-0E5A04DD6F01";
                        task.ADD_EMP     = WZGL.WEB.Common.CFunctions.getUserId(context); // "1";//context.Request["ADD_EMP"];
                        task.TASK_JSON   = cant;                                          // context.Request["TASK_JSON"];
                        result           = WorkFlow.BLL.Operate.AddTask(task);
                        if (result)
                        {
                            if (type == "send")
                            {
                                //发送流程
                                bool re = WorkFlow.BLL.Operate.StartFlow(task.TASK_CODE, task.DEFINE_CODE, WZGL.WEB.Common.CFunctions.getUserId(context), "");
                                if (re)
                                {
                                    json = "{\"IsSuccess\":\"true\",\"Message\":\"保存发起&流程成功!\"}";
                                }
                                else
                                {
                                    json = "{\"IsSuccess\":\"false\",\"Message\":\"保存发起&流程失败!\"}";
                                }
                            }
                            else
                            {
                                json = "{\"IsSuccess\":\"true\",\"Message\":\"添加成功!\"}";
                            }
                        }
                        else
                        {
                            json = "{\"IsSuccess\":\"false\",\"Message\":\"添加失败!\"}";
                        }
                    }
                }
                else
                {
                    json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据!\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"IsSuccess\":\"false\",\"Message\":\"解析数据失败!\"}";
            }
            context.Response.ContentType = "application/json";
            context.Response.Write(json);
            context.ApplicationInstance.CompleteRequest();
        }