예제 #1
0
    /// <summary>
    /// 提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!VertifyOverTime())
        {
            return;
        }

        if (!BeforeSubmit())
        {
            return;
        }
        string id = ViewState["FormID"].ToString();

        var dataInfo = SaveFormData();

        Countersign1.SaveData(true);//会签数据保存
        Countersign_Group1.SaveData(true);
        if (dataInfo != null)
        {
            uploadAttachments.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion


            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10109");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                string instId = SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString());
                if (!string.IsNullOrEmpty(instId))
                {
                    SaveWorkItem();
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    IFrameHelper.DownloadLocalFileUrl(instId);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
예제 #2
0
    /// <summary>
    /// 提交事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Submit_Click(object sender, EventArgs e)
    {
        string id       = ViewState["FormID"].ToString();
        var    dataInfo = SaveFormData();

        //如何设置
        Countersign1.SaveData(true);//会签数据保存
        Countersign_Group1.SaveData(true);

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion

            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("2006");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            int wfInstanceId = 0; //process instance id
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString()))
                {
                    //保存工作流条目
                    SaveWorkItem();
                    DisplayMessage.ExecuteJs("alert('提交成功');");
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");
    }
예제 #3
0
    /// <summary>
    /// 保存数据
    /// </summary>
    private void SaveData()
    {
        var info = BizContext.OA_InstructionOfWY.FirstOrDefault(x => x.FormID == FormId);

        //info.LeadersSelected = lblApprovers.Text;
        info.IsReportToGroup = cblIsReportToGroup.SelectedValue;
        info.IsReportToWY    = cblIsReportToWY.SelectedValue;
        info.LeadersSelected = SaveLeadersSelected();

        WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(info.FormID);

        Countersign1.ProcId = workFlowInstance.InstanceId;
        Countersign1.SaveData(true);
        Countersign_Group1.ProcId = workFlowInstance.InstanceId;
        Countersign_Group1.SaveData(true);

        BizContext.SubmitChanges();
    }
예제 #4
0
    /// <summary>
    /// 保存工作流实例
    /// </summary>
    /// <param name="p"></param>
    /// <param name="dateTime"></param>
    /// <param name="p_2"></param>
    /// <returns></returns>
    private bool SaveWorkFlowInstance(string WfStatus, DateTime?SumitTime, string WfInstanceId)
    {
        bool             result           = false;
        WorkFlowInstance workFlowInstance = null;

        try
        {
            workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormId);
            bool isEdit = false;
            if (workFlowInstance == null)
            {
                workFlowInstance              = new WorkFlowInstance();
                workFlowInstance.InstanceId   = Guid.NewGuid().ToString();
                workFlowInstance.CreateAtTime = DateTime.Now;
                //appid和应用管理创建新的管理的应用号是一致的
                workFlowInstance.AppId            = "2006";
                workFlowInstance.CreateDeptCode   = ddlDepartName.SelectedItem.Value.ToString();
                workFlowInstance.CreateDeptName   = ddlDepartName.SelectedItem.Text;
                workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.FormTitle        = tbTitle.Text;
            }
            else
            {
                isEdit = true;
                workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.FormTitle        = tbTitle.Text;
                workFlowInstance.AppId            = "2006";
            }
            workFlowInstance.FormId   = FormId;
            workFlowInstance.WfStatus = WfStatus;
            if (SumitTime != null)
            {
                workFlowInstance.SumitTime = SumitTime;
            }

            if (WfInstanceId != "")
            {
                workFlowInstance.WfInstanceId = WfInstanceId;
            }

            if (!isEdit)
            {
                result = wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance);
            }
            else
            {
                result = wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance);
            }
            FlowRelated1.ProcId = workFlowInstance.InstanceId;
            //会签
            Countersign1.ProcId       = workFlowInstance.InstanceId;
            Countersign_Group1.ProcId = workFlowInstance.InstanceId;
            Countersign1.SaveData(true);//会签数据保存
            Countersign_Group1.SaveData(true);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(result);
    }
예제 #5
0
    private bool SaveWorkFlowInstance(JC_BidScalingInfo obj, string WfStatus, DateTime?SumitTime, string WfInstanceId)
    {
        string methodName = "SaveWorkFlowInstance";

        Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN);
        bool             result           = false;
        WorkFlowInstance workFlowInstance = null;

        try
        {
            workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(obj.FormID);
            bool isEdit = false;
            if (workFlowInstance == null)
            {
                workFlowInstance                  = new WorkFlowInstance();
                workFlowInstance.InstanceId       = Guid.NewGuid().ToString();
                workFlowInstance.CreateDeptCode   = ddlDepartName.SelectedItem.Value.ToString();
                workFlowInstance.CreateDeptName   = ddlDepartName.SelectedItem.Text;
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.AppId            = "1003";
            }
            else
            {
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
                isEdit = true;
            }
            workFlowInstance.FormId    = obj.FormID;
            workFlowInstance.FormTitle = obj.Title;
            workFlowInstance.WfStatus  = WfStatus;
            if (SumitTime != null)
            {
                workFlowInstance.SumitTime = SumitTime;
            }

            if (WfInstanceId != "")
            {
                workFlowInstance.WfInstanceId = WfInstanceId;
            }

            if (!isEdit)
            {
                result = wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance);
            }
            else
            {
                result = wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance);
            }
            FlowRelated1.ProcId = workFlowInstance.InstanceId;
            string StartDeptId = ddlDepartName.SelectedItem.Value;
            if (StartDeptId.Substring(0, StartDeptId.LastIndexOf('-')) != PKURGICode)
            {
                Countersign1.ProcId = workFlowInstance.InstanceId;
                Countersign1.SaveData(true);
                Countersign_Group1.ProcId = workFlowInstance.InstanceId;
                Countersign_Group1.SaveData(true);
            }
            else
            {
                Countersign_Group1.ProcId = workFlowInstance.InstanceId;
                Countersign_Group1.SaveData(true);
            }
        }
        catch (Exception ex)
        {
            Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
            throw ex;
        }

        Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
        return(result);
    }
예제 #6
0
    private string SaveWorkFlowInstance(string WfStatus, DateTime?SumitTime, string WfInstanceId)
    {
        bool             result           = false;
        WorkFlowInstance workFlowInstance = null;

        try
        {
            workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(FormId);
            bool isEdit = false;
            if (workFlowInstance == null)
            {
                workFlowInstance                  = new WorkFlowInstance();
                workFlowInstance.InstanceId       = Guid.NewGuid().ToString();
                workFlowInstance.CreateAtTime     = DateTime.Now;
                workFlowInstance.AppId            = "10109";
                workFlowInstance.CreateDeptCode   = CurrentEmployee.DepartCode;
                workFlowInstance.CreateDeptName   = CurrentEmployee.DepartName;
                workFlowInstance.CreateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.CreateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.FormTitle        = GetFormTitle();
            }
            else
            {
                isEdit = true;
                workFlowInstance.UpdateByUserCode = CurrentEmployee.EmployeeCode;
                workFlowInstance.UpdateByUserName = CurrentEmployee.EmployeeName;
                workFlowInstance.AppId            = "10109";
            }
            workFlowInstance.FormId   = FormId;
            workFlowInstance.WfStatus = WfStatus;
            if (SumitTime != null)
            {
                workFlowInstance.SumitTime = SumitTime;
            }

            if (WfInstanceId != "")
            {
                workFlowInstance.WfInstanceId = WfInstanceId;
            }

            if (!isEdit)
            {
                result = wf_WorkFlowInstance.AddWorkFlowInstance(workFlowInstance);
            }
            else
            {
                result = wf_WorkFlowInstance.UpdateWorkFlowInstance(workFlowInstance);
            }
            flowRelated.ProcId        = workFlowInstance.InstanceId;
            Countersign1.ProcId       = workFlowInstance.InstanceId;
            Countersign_Group1.ProcId = workFlowInstance.InstanceId;
            Countersign1.SaveData(true);//会签数据保存
            Countersign_Group1.SaveData(true);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(workFlowInstance == null ? "" : workFlowInstance.InstanceId);
    }