Example #1
0
    protected void Save(string AppCode, string AddressToLink, string ClassName)
    {
        var dataProvider = DBContext.GetSysContext();
        var info         = dataProvider.WF_GetRelatedLinks.FirstOrDefault(x => x.AppCode == AppCode);

        if (info == null)
        {
            dataProvider.WF_GetRelatedLinks.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_GetRelatedLinks()
            {
                AppCode       = AppCode,
                AddressToLink = AddressToLink,
                ClassName     = ClassName,
                CreateTime    = DateTime.Now
            });
        }
        else
        {
            info.AddressToLink = AddressToLink;
            info.ClassName     = ClassName;
        }

        dataProvider.SubmitChanges();
        ProcessEndManage.EditEndInfos(Request.QueryString["appId"], AddressToLink, ClassName);
        DisplayMessage.ExecuteJs("alert('保存成功!');window.location.href='ProcessEndManage.aspx';");

        //DataProvider dataProvider = new DataProvider();
        //dataProvider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BPMConnectionString"].ConnectionString;
        //DataTable dataTableVerification = new DataTable();
        //dataTableVerification = dataProvider.ExecuteDataTable(string.Format("select 1 from [WF_GetRelatedLinks] where AddressToLink='{0}'and CLassName='{1}'", AddressToLink,ClassName), CommandType.Text);
        //ProcessEndManage.AlterEndInfos(Request.QueryString["appId"].ToString());
        //DataTable dataTableAlter=new DataTable();
        //dataTableAlter=dataProvider.ExecuteDataTable(string.Format("select 1 from [Wf_GetRelatedLinks] where appId='{0}'",AppCode),CommandType.Text);
    }
Example #2
0
    protected void Start()
    {
        string       strAppName      = txtAppName.Text;
        string       strWorkFlowName = txtWorkFlowName.Text;
        string       strFormName     = txtFormName.Text;
        int          isOpen          = cbIsOpen.Checked ? 1 : 0;
        DataProvider dataProvider    = new DataProvider();

        dataProvider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BPMConnectionString"].ConnectionString;
        DataTable dataTable = new DataTable();

        dataTable = dataProvider.ExecuteDataTable("select * from [WF_AppDict]", CommandType.Text);
        int       AppId = Convert.ToInt32(dataTable.Rows[dataTable.Rows.Count - 1]["AppId"]);
        DataTable dataTableVerification = new DataTable();

        dataTableVerification = dataProvider.ExecuteDataTable(string.Format("select 1 from [WF_AppDict] where AppName='{0}'", strAppName), CommandType.Text);
        if (dataTableVerification.Rows.Count > 0)
        {
            DisplayMessage.ExecuteJs("alert('应用名称不能与已经存在流程定义重复!')");
        }
        else
        {
            SqlCommand sqlCommandInsert = new SqlCommand();
            dataProvider.ExecuteNonQuery(string.Format("insert into [WF_AppDict] values ({0},'{1}',1,'{2}','{3}','{4}')", AppId + 1, strAppName, strWorkFlowName, strFormName, isOpen), CommandType.Text);
            DisplayMessage.ExecuteJs("alert('新增流程定义成功!');window.location.href='AppManage_List.aspx';");
        }
    }
Example #3
0
    protected void lbSelected_Command(object sender, CommandEventArgs e)
    {
        int result = 0;

        try
        {
            string userDomainName = e.CommandArgument.ToString();
            if (userDomainName.ToLower().Contains("founder\\"))
            {
                userDomainName = "founder\\" + userDomainName;
            }

            string Opinion = Request["optionTxt"];

            var appInfo = AppflowFactory.GetAppflow(_BPMContext.ProcID);
            appInfo.IsFromPC = true;
            bool isSuccess = appInfo.ChangeSign(_BPMContext.CurrentUser.LoginId, userDomainName, _BPMContext.Sn, _BPMContext.ProcID, Opinion);
            if (isSuccess)
            {
                result = 1;
            }
        }
        catch (Exception)
        {
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }
Example #4
0
    protected void Save(string appId, string appName, string workFlowName, string formName)
    {
        string appNameBefore = hideAppName.Value;

        if (appNameBefore == appName)
        {
            WF_AppDictManager.EditAppDict(appId, appName, workFlowName, formName, cbIsOpen.Checked);
            DisplayMessage.ExecuteJs("alert('保存成功!');window.location.href='AppManage_List.aspx';");
        }
        else
        {
            DataProvider dataProvider = new DataProvider();
            dataProvider.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["BPMConnectionString"].ConnectionString;
            DataTable dataTableVerification = new DataTable();
            dataTableVerification = dataProvider.ExecuteDataTable(string.Format("select 1 from [WF_AppDict] where AppName='{0}'", appName), CommandType.Text);
            if (dataTableVerification.Rows.Count > 0)
            {
                DisplayMessage.ExecuteJs("alert('应用名称已经存在流程定义重复!')");
            }
            else
            {
                WF_AppDictManager.EditAppDict(appId, appName, workFlowName, formName, cbIsOpen.Checked);
                DisplayMessage.ExecuteJs("alert('保存成功!');window.location.href='AppManage_List.aspx';");
            }
        }
    }
Example #5
0
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     if (_BPMContext.ProcInst != null)
     {
         new WF_WorkFlowInstance().UpdateNowStatusByFormID(FormId, "5");
         DisplayMessage.ExecuteJs("alert('操作成功'); window.close();");
     }
 }
Example #6
0
 /// <summary>
 /// 删除当前流程
 /// </summary>
 /// <returns></returns>
 protected void DelWorkflow()
 {
     if (_BPMContext.ProcInst != null)
     {
         new WF_WorkFlowInstance().UpdateNowStatusByFormID(FormId, "5");
         DisplayMessage.ExecuteJs("alert('操作成功'); window.close();");
     }
     else
     {
         DisplayMessage.ExecuteJs("window.close();");
     }
 }
Example #7
0
    protected void lbSelected_Command(object sender, CommandEventArgs e)
    {
        string FormId = Request["FormId"];

        if (string.IsNullOrWhiteSpace(FormId))
        {
            DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
            return;
        }
        CustomWorkflowDataProcess.SaveSessionDataToTemplation(FormId, e.CommandArgument.ToString());
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 1));
    }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string FormId = Request["FormId"];
         if (string.IsNullOrWhiteSpace(FormId))
         {
             DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
             return;
         }
         SettingOptions();
     }
 }
Example #9
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();

        //如果起始部门为空,则弹出对话框
        if (dataInfo.StartDeptId == null)
        {
            Alert("人力系统中缺少部门信息,请联系人力同事完善!");
        }

        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("10113");
            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('提交成功');");
                    AfterWorkflowStart();
                    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("提交失败");
    }
Example #10
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!BeforeSubmit())
        {
            return;
        }

        int    wfInstanceId = 0; //process instance id
        string id           = ViewState["FormID"].ToString();

        InstructionInfo dataInfo = SaveFormData();

        Countersign1.SaveData(true);//会签数据保存

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

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion
            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            WorkflowHelper.StartProcess(@"K2Workflow\ERP_Instruction", FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString()))
                {
                    SaveWorkItem();
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    DisplayMessage.ExecuteJs("alert('提交成功');");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
                    return;
                }
            }
        }

        Alert("提交失败");

        //WorkflowHelper.ApproveProcess
        //insert data to business object
    }
Example #11
0
    protected void lbSelected_Command(object sender, CommandEventArgs e)
    {
        string result = "";

        try
        {
            string Remark = e.CommandArgument.ToString();
            var    uInfo  = SysContext.V_Pworld_Department.FirstOrDefault(x => x.Remark == Remark);
            result = JsonHelper.JsonSerializer <V_Pworld_Department>(uInfo);
        }
        catch (Exception)
        {
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }
Example #12
0
    public void BindData(string user)
    {
        if (!string.IsNullOrEmpty(user))
        {
            user = user.ToLower().Replace("founder\\", "");
            DataTable dt = GetDataInfos(user);
            DataView  dv = dt.DefaultView;

            string proName   = tbxTitle.Text.ToString().Trim();
            string startTime = tbxBeginTime.Value.ToString().Trim();
            string endTime   = tbxEndTime.Value.ToString().Trim();

            StringBuilder searchSql = new StringBuilder();

            if (!string.IsNullOrEmpty(proName))
            {
                if (!Workflow_Common.ValidateQuery(proName))
                {
                    DisplayMessage.ExecuteJs("alert('查询字符无效');");
                    return;
                }
                searchSql.AppendFormat("FormTitle like '%{0}%'", proName);
            }
            if (!string.IsNullOrEmpty(startTime))
            {
                if (!string.IsNullOrEmpty(searchSql.ToString()))
                {
                    searchSql.Append(" and ");
                }
                searchSql.AppendFormat("ApproveAtTime>'{0}'", startTime);
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                if (!string.IsNullOrEmpty(searchSql.ToString()))
                {
                    searchSql.Append(" and ");
                }
                searchSql.AppendFormat("ApproveAtTime<'{0}'", endTime);
            }

            dv.RowFilter = searchSql.ToString();

            gvDataList.DataSource = dv.ToTable();
            gvDataList.DataBind();
        }
    }
Example #13
0
    protected void btnStart_Click(object sender, EventArgs e)
    {
        string appId       = txtAppID.Value.Trim();
        string appName     = txtAppName.Value.Trim();
        string appWorkFlow = txtWorkFlow.Value.Trim();
        string appFormName = txtFormName.Value.Trim();

        if (appId == "应用号")
        {
            appId = "";
        }
        if (appName == "应用名称")
        {
            appName = "";
        }
        if (appWorkFlow == "工作流名称")
        {
            appWorkFlow = "";
        }
        if (appFormName == "表单名称")
        {
            appFormName = "";
        }

        DataTable dataTable = new DataTable();

        dataTable = WF_AppDictManager.GetAppListByAppIdOrAppNameOrWorkFlowNameOrFormName(appId, appName, appWorkFlow, appFormName);
        if (dataTable.Rows.Count == 0)
        {
            DisplayMessage.ExecuteJs("alert('没有匹配的流程应用!');window.location.href='AppManage_List.aspx';");
        }

        rptList.DataSource = dataTable;
        rptList.DataBind();

        txtAppID.Value    = "应用号";
        txtAppName.Value  = "应用名称";
        txtWorkFlow.Value = "工作流名称";
        txtFormName.Value = "表单名称";
    }
Example #14
0
    private void Query()
    {
        string endTime = "";

        if (!string.IsNullOrEmpty(tbxEndTime.Value.ToString()))
        {
            endTime = (Convert.ToDateTime(tbxEndTime.Value.ToString()).AddDays(1)).ToString();
        }
        string companyCode = GetUserManageCompanyCode();

        int userRight = GetUserRight();

        if (string.IsNullOrEmpty(companyCode) && userRight == 0)
        {
            DisplayMessage.ExecuteJs("alert('无权查询!');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null; window.open('', '_self', '');window.close();", true);
            return;
        }

        int       count     = 0;
        DataTable dataTable = Sys_ProcessManage.GetInstanceListByParamsPaged(tbxTitle.Text.Trim(), txtCreateName.Text.Trim(), tbxBeginTime.Value.Trim().ToString(),
                                                                             endTime, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, tbxStatus.Text.Trim(), tbxNumBer.Text.Trim(), companyCode, userRight, out count);

        if (dataTable.Rows.Count > 0)
        {
            AspNetPager1.RecordCount = count;
            this.rptList.DataSource  = dataTable;
            this.rptList.DataBind();
            lblshow.Visible      = false;
            rptList.Visible      = true;
            AspNetPager1.Visible = true;
        }
        else
        {
            lblshow.Visible      = true;
            rptList.Visible      = false;
            AspNetPager1.Visible = false;
        }
    }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string FormId = Request["FormId"];
            if (string.IsNullOrWhiteSpace(FormId) && string.IsNullOrWhiteSpace(_BPMContext.ProcID))
            {
                DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
                return;
            }
            else
            {
                long   newId       = -1;
                string newIdString = Request["stepId"];
                if (!string.IsNullOrWhiteSpace(newIdString))
                {
                    long.TryParse(newIdString, out newId);
                }
                StepID = newId;
                if (StepID > 0)
                {
                    List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);
                    if (itemInfos != null)
                    {
                        var currentInfo = itemInfos.FirstOrDefault(x => x.StepID == StepID);
                        if (currentInfo == null)
                        {
                            DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", 0));
                            return;
                        }
                        tbStepName.Text         = currentInfo.StepName;
                        ShowUserNames1.UserList = currentInfo.PartUsers;
                    }
                }

                Refresh("", "");
            }
        }
    }
Example #16
0
    private void SaveWorkItemData()//Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems itemInfo)
    {
        //if (string.IsNullOrEmpty(ShowUserNames1.UserList))
        //{
        //    DisplayMessage.ExecuteJs("alert('没有设置审批人员!')");
        //    return;
        //}

        string FormId = Request["FormId"];
        List <Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems> itemInfos = CustomWorkflowDataProcess.GetWorkItemsData(FormId);

        if (itemInfos != null && itemInfos.Exists(x => x.StepName.ToLower() == tbStepName.Text))
        {
            DisplayMessage.ExecuteJs("alert('该步骤名称与已有步骤重名,请更换步骤名称!')");
            return;
        }

        int result = 0;

        try
        {
            CustomWorkflowDataProcess.SaveWorkItemData(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems()
            {
                StepID    = StepID,
                StepName  = tbStepName.Text,
                PartUsers = ShowUserNames1.UserList
            },
                                                       FormId);
            result = 1;
        }
        catch (Exception)
        {
            //
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }
Example #17
0
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        NameValueCollection kvs = new NameValueCollection();

        kvs.Add("GroupUsers", ITSupportCommon.GetK2DataFieldByGroupId(int.Parse(ddlGroups.SelectedItem.Value)));
        WorkflowHelper.UpdateDataFields(_BPMContext.Sn, kvs);
        string Opinion = Request["optionTxt"];
        var    appInfo = AppflowFactory.GetAppflow(_BPMContext.ProcID);

        appInfo.IsFromPC = true;
        string groupId = BizContext.V_ITSupport_Catalog.FirstOrDefault(x => x.Id.ToString() == ddlGroups.SelectedValue).GroupId.Value.ToString();

        appInfo.AssistObject = groupId;
        bool isSuccess = appInfo.StartApproval(_BPMContext.Sn, _BPMContext.ProcID, Opinion, "转出");

        if (isSuccess)
        {
            var formInfo = BizContext.OA_ITSupport_Form.FirstOrDefault(x => x.FormID == _BPMContext.ProcInst.FormId);
            formInfo.ProcessGroupId = groupId;

            BizContext.SubmitChanges();
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", isSuccess ? "1" : "0"));
    }
 public void Alert(string msg)
 {
     DisplayMessage.ExecuteJs(string.Format("alert('{0}');", msg));
 }
Example #19
0
 protected void lbSelected_Command(object sender, CommandEventArgs e)
 {
     DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", Newtonsoft.Json.JsonConvert.SerializeObject(e.CommandArgument.ToString())));
 }
Example #20
0
    protected void lbSelected_Command(object sender, CommandEventArgs e)
    {
        int result = 0;

        try
        {
            string userDomainName = e.CommandArgument.ToString();
            //DisplayMessage.ExecuteJs("alert('" + userDomainName + "')");
            //return;
            if (userDomainName.ToLower().Contains("founder\\"))
            {
                userDomainName = "founder\\" + userDomainName;
            }

            WorkflowHelper.ForwardToNextApprover(_BPMContext.Sn, _BPMContext.CurrentUser.LoginId, userDomainName);

            string Opinion = Request["optionTxt"];

            //2015-1-26 对加签的已办做增加Item处理,去掉为空意见优化
            string ApproveResult    = "加签";
            string OpinionType      = "";
            string IsSign           = "1";
            string DelegateUserName = "";
            string DelegateUserCode = "";

            WorkFlowInstance workFlowInstance = new WF_WorkFlowInstance().GetWorkFlowInstanceById(_BPMContext.ProcID);
            var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
            {
                ApprovalID        = Guid.NewGuid().ToString(),
                WFTaskID          = K2_TaskItem.ID,
                FormID            = workFlowInstance.FormId,
                InstanceID        = workFlowInstance.InstanceId,
                Opinion           = Opinion,
                ApproveAtTime     = DateTime.Now,
                ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
                ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
                ApproveResult     = ApproveResult,
                OpinionType       = OpinionType,
                CurrentActiveName = CustomWorkflowHelper.SuperNodeName == K2_TaskItem.ActivityInstanceDestination.Name ? CustomWorkflowDataProcess.GetCurrentStepNameById(_BPMContext.ProcID, K2_TaskItem.ActivityInstanceDestination.Name) : K2_TaskItem.ActivityInstanceDestination.Name,
                ISSign            = IsSign,
                CurrentActiveID   = K2_TaskItem.ActivityInstanceDestination.ActID.ToString(),
                DelegateUserName  = DelegateUserName,
                DelegateUserCode  = DelegateUserCode,
                CreateAtTime      = K2_TaskItem.ActivityInstanceDestination.StartDate,
                CreateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
                CreateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
                UpdateAtTime      = DateTime.Now,
                UpdateByUserCode  = _BPMContext.CurrentPWordUser.EmployeeCode,
                UpdateByUserName  = _BPMContext.CurrentPWordUser.EmployeeName,
                FinishedTime      = DateTime.Now
            };

            if (new BFApprovalRecord().AddApprovalRecord(appRecord))
            {
                if (new WF_WorkFlowInstance().UpdateStatus(workFlowInstance.WfInstanceId,
                                                           "1", K2_TaskItem.ActivityInstanceDestination.ID.ToString(),
                                                           K2_TaskItem.ActivityInstanceDestination.Name, K2_TaskItem.ID, null,
                                                           _BPMContext.CurrentPWordUser))
                {
                    result = 1;
                }
            }

            //if (string.IsNullOrEmpty(Opinion))
            //{
            //    result = 1;
            //}
            //else
            //{
            //    string ApproveResult = "加签";
            //    string OpinionType = "";
            //    string IsSign = "1";
            //    string DelegateUserName = "";
            //    string DelegateUserCode = "";

            //    WorkFlowInstance workFlowInstance = new WF_WorkFlowInstance().GetWorkFlowInstanceById(_BPMContext.ProcID);
            //    var appRecord = new Pkurg.PWorldBPM.Business.Sys.WF_Approval_Record()
            //    {
            //        ApprovalId = Guid.NewGuid().ToString(),
            //        WfTaskId = K2_TaskItem.ID,
            //        FormId = workFlowInstance.FormId,
            //        InstanceId = workFlowInstance.InstanceId,
            //        Opinion = Opinion,
            //        ApproveAtTime = DateTime.Now,
            //        ApproveByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        ApproveByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        ApproveResult = ApproveResult,
            //        OpinionType = OpinionType,
            //        CurrentActiveName = K2_TaskItem.ActivityInstanceDestination.Name,
            //        IsSign = IsSign,
            //        CurrentActiveId = K2_TaskItem.ActivityInstanceDestination.ActID.ToString(),
            //        DelegateUserName = DelegateUserName,
            //        DelegateUserCode = DelegateUserCode,
            //        CreateAtTime = K2_TaskItem.ActivityInstanceDestination.StartDate,
            //        CreateByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        CreateByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        UpdateAtTime = DateTime.Now,
            //        UpdateByUserCode = _BPMContext.CurrentPWordUser.EmployeeCode,
            //        UpdateByUserName = _BPMContext.CurrentPWordUser.EmployeeName,
            //        FinishedTime = DateTime.Now
            //    };

            //    if (new BFApprovalRecord().AddApprovalRecord(appRecord))
            //    {
            //        if (new WF_WorkFlowInstance().UpdateStatus(workFlowInstance.WfInstanceId,
            //            "1", K2_TaskItem.ActivityInstanceDestination.ID.ToString(),
            //            K2_TaskItem.ActivityInstanceDestination.Name, K2_TaskItem.ID, null,
            //            _BPMContext.CurrentPWordUser))
            //        {
            //            result = 1;
            //        }
            //    }
            //}
        }
        catch (Exception)
        {
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }
Example #21
0
    private void SaveWorkItemDataToTemplation()//Pkurg.PWorldBPM.Business.Sys.WF_Custom_InstanceItems itemInfo)
    {
        int result = 0;

        string FormId = Request["FormId"];

        try
        {
            var itemList = CustomWorkflowDataProcess.GetWorkItemsData(FormId);
            if (itemList == null)
            {
                DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
                return;
            }
            string syncString = string.Empty;
            lock (syncString)
            {
                int maxId = 1;
                if (SysContext.WF_Custom_Templation.Count() > 0)
                {
                    maxId = SysContext.WF_Custom_Templation.Max(x => x.Id) + 1;
                    if (maxId <= 0)
                    {
                        maxId = 1;
                    }
                }

                SysContext.WF_Custom_Templation.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_Templation()
                {
                    Id                 = maxId,
                    CreateTime         = DateTime.Now,
                    Name               = tbStepName.Text,
                    CreateUserID       = _BPMContext.CurrentPWordUser.EmployeeCode,
                    CreateUserDeptCode = _BPMContext.CurrentPWordUser.DepartCode,
                    CreateUserName     = _BPMContext.CurrentPWordUser.EmployeeName,
                    LastUpdateTime     = DateTime.Now,
                    IsOpen             = cbIsOpen.Checked ? 1 : 0,
                    RelationDeptCode   = GetCheckDept(),
                    Des                = tbDes.Text
                });


                long stepId = 1;
                if (SysContext.WF_Custom_TemplationItems.Count() > 0)
                {
                    stepId = SysContext.WF_Custom_TemplationItems.Max(x => x.StepID) + 1;
                }
                foreach (var item in itemList)
                {
                    SysContext.WF_Custom_TemplationItems.InsertOnSubmit(new Pkurg.PWorldBPM.Business.Sys.WF_Custom_TemplationItems()
                    {
                        TemplD     = maxId,
                        CreateTime = DateTime.Now,
                        PartUsers  = item.PartUsers,
                        OrderId    = item.OrderId,
                        StepID     = stepId++,
                        StepName   = item.StepName,
                        Condition  = item.Condition
                    });
                }
                SysContext.SubmitChanges();
            }
            result = 1;
        }
        catch (Exception)
        {
            //
        }
        DisplayMessage.ExecuteJs(string.Format("window.returnValue = {0};window.close();", result));
    }