Beispiel #1
0
        /// <summary>
        /// 插入表单数据到DB
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        private bool InsertData(ProcessAction action)
        {
            bool result = false;

            try
            {
                this.FormId.Value  = this.lbl_formid.Text = TaskPage.FormID = FormID.SerialsNO("CDF");
                TaskPage.ProcessID = ddlProcessType.SelectedValue;
                this.State.Value   = "1";
                CustomFlow cf = CreateCustomFlowObject();
                //string approveNodeXml = K2.Common.K2Rule.GetApproveNodeXML(ddlProcessType.SelectedValue, "Reimbursement", CreateRequestXml()); //提交申请
                //string approveXml = K2.Common.K2Rule.GetApproveXML(approveNodeXml, CreateRequestXml());   //取得最终的xml

                cf.jqFlowChart = "";

                if (action == ProcessAction.SaveDraft || action == ProcessAction.Save)
                {
                    //cf.jqFlowChart = cfc.FlowChartJsonToXml_Approve(this.hfjqFlowChart.Value, hfEmployeeCode.Value);
                    cf.ProcessState = K2Utility.ProcessStatus.Draft.ToString();
                }
                else if (action == ProcessAction.SubmitCF || action == ProcessAction.SubmitDraft)
                {
                    cf.ProcessState = K2Utility.ProcessStatus.Running.ToString();
                }

                CustomFlowBLL bll = new CustomFlowBLL();
                if (bll.AddCustomFlow(cf))
                {
                    if (action == ProcessAction.SubmitCF)
                    {
                        bll.UpdateAttachStatusByAttachAttachCodes(cf.AttachIds);
                    }
                    result = true;
                }
                else
                {
                    result = false;
                }
                return(result);
            }
            catch (Exception ex)
            {
                LogUtil.Log.Error(ex.Message);
                return(false);       //异常和错误信息写入日志表中
            }
        }