public static void DelegateEvent(IWfBox box, IWfDialog wfDlg, WfClientAPIHandler handle, string[] batchField) { try { DataRowView[] selectedRows = GetSelectedRows(box.DataSource as DataView, batchField); IDictionary<string, WorkItem> workItems = GetWorkItems(box, selectedRows); IEnumerator<KeyValuePair<string, WorkItem>> enumerator = workItems.GetEnumerator(); enumerator.MoveNext(); KeyValuePair<string, WorkItem> current = enumerator.Current; wfDlg.WorkItem = current.Value; if (wfDlg.ShowDialog() == DialogResult.OK) { WfLogicalAbnormalContextData contextData = new WfLogicalAbnormalContextData(); wfDlg.SetContextData(contextData); WfUtil.SetAbnormalContextData(contextData); DelegateEvent(selectedRows, workItems, handle); WfUtil.FreeAbnormalContextData(); } } finally { wfDlg.Close(); } }
public static void Delegate(IWfBox box, IWfDialog wfDlg) { IDictionary<string, WorkItem> workItems = null; WorkItem firstSelectedWorkItem = null; try { DataRowView[] selectedRows = GetSelectedRows(box.DataSource as DataView); workItems = GetWorkItems(box, selectedRows); firstSelectedWorkItem = GetFirstSelectedWorkItem(box); } catch (NotSelectException) { } wfDlg.WorkItem = firstSelectedWorkItem; if (wfDlg.ShowDialog() == DialogResult.OK) { WfLogicalAbnormalContextData contextData = new WfLogicalAbnormalContextData(); wfDlg.SetContextData(contextData); WfUtil.SetAbnormalContextData(contextData); WorkflowService.WfcInstance.Delegate(workItems); box.RefreshData(); WfUtil.FreeAbnormalContextData(); if (firstSelectedWorkItem == null) { WorkflowService.IsMyAllDelegated = true; } } }
public void Accept() { SmIdentity smIdentity = SecurityUtil.GetSmIdentity(); if (!(StringHelper.IsNull(this.wfAssigninst.StaffId) || !(this.wfAssigninst.StaffId != smIdentity.UserId))) { WfLogicalAbnormalContextData abnormalData = new WfLogicalAbnormalContextData(); abnormalData.ReceiveStaffId = smIdentity.UserId; abnormalData.ReceiveStaffName = smIdentity.UserName; WfUtil.SetAbnormalContextData(abnormalData); this.SetDelegate(); WfUtil.FreeAbnormalContextData(); } if (StringHelper.IsNull(this.wfAssigninst.StaffId)) { this.wfAssigninst.StaffId = smIdentity.UserId; this.wfAssigninst.StaffName = smIdentity.UserName; } this.wfAssigninst.AcceptDate = new DateTime?(DateTimeHelper.GetNow()); this.ChangeStatus(AssignStatusType.Accepted); this.wfResource.Assign(); this.Store(); }