예제 #1
0
 private void SetWfResInst(WfLogicalPassContextData passData)
 {
     if (StringHelper.IsNull(this.wfResinst.StaffId))
     {
         this.wfResinst.StaffId = string.Empty;
         this.wfResinst.StaffName = string.Empty;
         if (passData.ToStaffIds != null)
         {
             for (int i = 0; i < passData.ToStaffIds.Length; i++)
             {
                 if (i == 0)
                 {
                     this.wfResinst.StaffId = this.wfResinst.StaffId + passData.ToStaffIds[i];
                     this.wfResinst.StaffName = this.wfResinst.StaffName + passData.ToStaffNames[i];
                 }
                 else
                 {
                     this.wfResinst.StaffId = this.wfResinst.StaffId + "," + passData.ToStaffIds[i];
                     this.wfResinst.StaffName = this.wfResinst.StaffName + "," + passData.ToStaffNames[i];
                 }
             }
         }
     }
     if (StringHelper.IsNull(this.wfResinst.FromActinstId))
     {
         this.wfResinst.FromActinstId = passData.FromActivityKey;
         this.wfResinst.FromActinstName = passData.FromActivityName;
     }
     else if (this.wfResinst.FromActinstId != passData.FromActivityKey)
     {
         this.wfResinst.FromActinstId = this.wfResinst.FromActinstId + ',' + passData.FromActivityKey;
         this.wfResinst.FromActinstName = this.wfResinst.FromActinstName + ',' + passData.FromActivityName;
     }
     if (StringHelper.IsNull(this.wfResinst.FromStaffId))
     {
         this.wfResinst.FromStaffId = passData.FromStaffId;
         this.wfResinst.FromStaffName = passData.FromStaffName;
     }
     else
     {
         this.wfResinst.FromStaffId = this.wfResinst.FromStaffId + ',' + passData.FromStaffId;
         this.wfResinst.FromStaffName = this.wfResinst.FromStaffName + ',' + passData.FromStaffName;
     }
     if (StringHelper.IsNull(this.wfResinst.FromAssignId))
     {
         this.wfResinst.FromAssignId = passData.FromAssignId;
     }
     else
     {
         this.wfResinst.FromAssignId = passData.FromAssignId;
     }
     this.wfResinst.ExcludeStaffId = passData.ExcludeStaffId;
 }
예제 #2
0
        private static void PassToNext(IDictionary<string, WorkItem> workItems, DataRowView[] rows, IWfDialog wfDlg)
        {
            try
            {
                LoggingService.InfoFormatted("开始进行转出操作...", new object[0]);
                Dictionary<string, WfLogicalPassContextData> dictionary = new Dictionary<string, WfLogicalPassContextData>();
                SmIdentity smIdentity = SecurityUtil.GetSmIdentity();
                foreach (WorkItem item in workItems.Values)
                {
                    switch (CheckCondition(item))
                    {
                        case WfAbnormalType.SUSPENDED:
                            WorkflowService.WfcInstance.Suspend(item);
                            goto Label_017A;

                        case WfAbnormalType.TERMINATED:
                            WorkflowService.WfcInstance.Terminate(item);
                            goto Label_017A;

                        case WfAbnormalType.NO_ABNORMAL:
                            WfLogicalPassContextData data;
                            if (!dictionary.ContainsKey(item.ActdefId))
                            {
                                data = new WfLogicalPassContextData();
                                wfDlg.WorkItem = item;
                                switch (wfDlg.ShowDialog())
                                {
                                    case DialogResult.OK:
                                        wfDlg.SetContextData(data);
                                        break;

                                    case DialogResult.Cancel:
                                        return;
                                }
                                data.FromStaffId = smIdentity.UserId;
                                data.FromStaffName = smIdentity.UserName;
                            }
                            else
                            {
                                data = dictionary[item.ActdefId];
                            }
                            data.FromActivityKey = item.ActinstId;
                            data.FromActivityName = item.ActinstName;
                            data.FromAssignId = item.Id;
                            WfUtil.SetPassContextData(data);
                            WorkflowService.WfcInstance.CompleteWorkItem(item);
                            goto Label_017A;

                        case WfAbnormalType.ABROTED:
                            WorkflowService.WfcInstance.Abort(item);
                            goto Label_017A;
                    }
                    throw new WfClientException("Not implement the abnormal type operation of condition pass to next");
                Label_017A:;
                }
                DeleteRows(rows);
                LoggingService.InfoFormatted("转出操作完成...", new object[0]);
            }
            catch (CancelExecuteException)
            {
            }
            finally
            {
                wfDlg.Close();
                WfUtil.FreePassContextData();
            }
        }