本文整理汇总了C#中NameCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# NameCollection.Add方法的具体用法?C# NameCollection.Add怎么用?C# NameCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameCollection
的用法示例。
在下文中一共展示了NameCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextApproveTaskUsers
/// <summary>
/// 获取下一步审批人
/// </summary>
/// <returns></returns>
private NameCollection GetNextApproveTaskUsers()
{
var nextApproveTaskUsers = new NameCollection();
var manager = UserProfileUtil.GetDepartmentManager(CurrentEmployee.Department);
if (manager.IsNullOrWhitespace())
{
//Set default depart manager
manager = SetDefaultDepartManager();
}
else if (manager.Equals(CurrentEmployee.UserAccount, StringComparison.CurrentCultureIgnoreCase))
{
var managerEmp = WorkFlowUtil.GetEmployeeApprover(CurrentEmployee);
if (managerEmp == null)
{
return null;
}
manager = managerEmp.UserAccount;
}
nextApproveTaskUsers.Add(manager);
//获取代理人员
var deleman = WorkFlowUtil.GetDeleman(manager, Constants.CAModules.NonTradeSupplierSetupMaintenance);
if (deleman != null)
{
nextApproveTaskUsers.Add(deleman);
}
return nextApproveTaskUsers;
}
示例2: Actions_ActionExecuting
void Actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
if (e.Action.Equals("Approve"))//审批通过
{
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
decimal TotalCost = GetTotalCost();
if (TotalCost == 0)
{
DisplayMessage("Rate or Cost error!");
e.Cancel = true;
return;
}
string levelType = "Contract Approval Limits";
string sCurrentManager = CurrentEmployee.UserAccount;
var quota = WorkFlowUtil.GetQuota(CurrentEmployee.UserAccount, levelType);///得到当前审批人的审批金额
WorkflowContext context = WorkflowContext.Current;
if (TotalCost > quota)///当前审批者不够审批此金额。
{
context.UpdateWorkflowVariable("IsApproveAgin", true);//
NameCollection manager = new NameCollection();
Employee managerEmp = WorkFlowUtil.GetNextApprover(sCurrentManager);
if (managerEmp == null && !WorkflowPerson.IsCEO(sCurrentManager))
{
DisplayMessage("The manager is not set in the system.");
e.Cancel = true;
return;
}
manager.Add(managerEmp.UserAccount);
string sDelePerson = WorkFlowUtil.GetDeleman(managerEmp.UserAccount, WorkFlowUtil.GetModuleIdByListName("PurchaseRequestGeneral")); //查找代理人
if (sDelePerson != null)
{
manager.Add(sDelePerson);
}
context.UpdateWorkflowVariable("ApproveUsers", manager);
}
else//进入到财务审批
{
context.UpdateWorkflowVariable("IsApproveAgin", false);//
}
fields["Approvers"] = ReturnAllApprovers(sCurrentManager);
fields["ApproversSPUser"] = ReturnAllApproversSP("ApproversSPUser", sCurrentManager);
}
else
{
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
string sWorkflowNo = fields["Title"].ToString();
context.UpdateWorkflowVariable("EditTitle", "Please resubmit Purchase Ruequest-General:" + sWorkflowNo);//
}
WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
}
示例3: Actions_ActionExecuting
private void Actions_ActionExecuting(object sender, CancelEventArgs e)
{
if (!this.DataForm1.Validate())
{
DisplayMessage(this.DataForm1.msg.IsNotNullOrWhitespace() ? this.DataForm1.msg : "Please fill in all the necessary fields.");
e.Cancel = true;
return;
}
#region Set users for workflow
//Modify task users
var departmentManagerTaskUsers = new NameCollection();
var manager = UserProfileUtil.GetDepartmentManager(CurrentEmployee.Department);
if (manager.IsNullOrWhitespace())
{
DisplayMessage("The department manager is not set in the system.");
e.Cancel = true;
return;
}
else if (manager.Equals(CurrentEmployee.UserAccount, StringComparison.CurrentCultureIgnoreCase))
{
var managerEmp = WorkFlowUtil.GetEmployeeApprover(CurrentEmployee);
if (managerEmp == null)
{
DisplayMessage("The manager is not set in the system.");
e.Cancel = true;
return;
}
manager = managerEmp.UserAccount;
}
departmentManagerTaskUsers.Add(manager);
var deleman = WorkFlowUtil.GetDeleman(manager, CA.WorkFlow.UI.Constants.CAModules.InternalOrderCreation);
if (deleman != null)
{
departmentManagerTaskUsers.Add(deleman);
}
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentManagerTaskUsers", departmentManagerTaskUsers);
#endregion
WorkflowContext.Current.DataFields["Status"] = CAWorkflowStatus.InProgress;
}
示例4: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.DataFields["Status"] = "Cancelled";
return;
}
string msg = DataForm1.Validate();
if (!string.IsNullOrEmpty(msg))
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
NameCollection buyingUsers = new NameCollection();
buyingUsers.Add(DataForm1.BuyingUser);
WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveUsers", buyingUsers);
WorkflowContext.Current.DataFields["BuyingUser"] = DataForm1.BuyingUser;
WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
WorkflowContext.Current.DataFields["Status"] = "In Progress";
}
示例5: SetWorkflowBaseVariable
/// <summary>
/// 设置工作流变量
/// </summary>
/// <param name="bIsSubmit"></param>
/// <param name="sWorkFlowNO"></param>
bool SetWorkflowBaseVariable(bool bIsSubmit,string sWorkFlowNO)
{
NameCollection ncFinance = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
if (null == ncFinance || ncFinance.Count == 0)
{
DisplayMessage("There are no users in wf_FinanceConfirm");
return false;
}
Employee employee = WorkFlowUtil.GetNextApprover(this.Userinfo1.Applicant);/// WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
if (null == employee)
{
DisplayMessage(this.Userinfo1.Applicant.UserAccount+" has no manager in System!");
return false;
}
NameCollection manager = new NameCollection();
manager.Add(employee.UserAccount);
string sDelePerson = WorkFlowUtil.GetDeleman(employee.UserAccount, WorkFlowUtil.GetModuleIdByListName("PurchaseRequestGeneral")); //查找代理人
if (sDelePerson != null)
{
manager.Add(sDelePerson);
}
WorkflowContext context = WorkflowContext.Current;
context.UpdateWorkflowVariable("IsSubmit", bIsSubmit);
context.UpdateWorkflowVariable("IsSaveAgin", false);
context.UpdateWorkflowVariable("EditUrl", "/_Layouts/CA/WorkFlows/PurchaseRequestGeneral/EditForm.aspx");//EditUrl
context.UpdateWorkflowVariable("EditTitle", "Please complete Purchase Ruequest-General:" + sWorkFlowNO);//
context.UpdateWorkflowVariable("ApproveURL", "/_Layouts/CA/WorkFlows/PurchaseRequestGeneral/ApproveForm.aspx");//ApproveURL
context.UpdateWorkflowVariable("ApproveTitle", sWorkFlowNO + " needs approve");//ApproveTitle
context.UpdateWorkflowVariable("ApproveUsers", manager);
context.UpdateWorkflowVariable("ComfirmURL", "/_Layouts/CA/WorkFlows/PurchaseRequestGeneral/ConfirmForm.aspx");//ComfirmURL
context.UpdateWorkflowVariable("ConfirmTitle", sWorkFlowNO + " needs confirm"); //ConfirmTitle
context.UpdateWorkflowVariable("IsApproveAgin", false);
context.UpdateWorkflowVariable("ConfirmUsers", ncFinance);
return true;
}
示例6: StartWorkflowButton_Executing
private void StartWorkflowButton_Executing(object sender, CancelEventArgs e)
{
string taskTitle = string.Empty;
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
//Check which button has been clicked
var btn = sender as StartWorkflowButton;
var departmentManagerTaskUsers = new NameCollection();
if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
{
var msg = this.DataForm1.ValidateForSave();
if (msg.IsNotNullOrWhitespace())
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
this.DataForm1.Update(); //Save the inputed data to datatable
context.UpdateWorkflowVariable("IsSave", true);
fields["Status"] = CAWorkflowStatus.Pending;
decimal totalCost = this.DataForm1.GetTotal();
fields["TravelTotalCost"] = totalCost;
context.UpdateWorkflowVariable("CompleteTaskTitle", "please complete Travel Request");
}
else
{
var msg = this.DataForm1.ValidateForSubmit();
bool isCEO = false;
if (msg.IsNotNullOrWhitespace())
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
this.DataForm1.Update(); //Save the inputed data to datatable
context.UpdateWorkflowVariable("IsSave", false);
fields["Status"] = CAWorkflowStatus.InProgress;
#region Set users for workflow
//Modify task users
//If system can't find the manager, return null;
var managerEmp = WorkFlowUtil.GetEmployeeApprover(this.DataForm1.Applicant);
string manager = string.Empty;
if (managerEmp == null)
{
if (!IsCEO(this.DataForm1.Applicant.UserAccount))
{
DisplayMessage("The manager is not set in the system.");
e.Cancel = true;
return;
}
else
{
isCEO = true;
manager = this.DataForm1.Applicant.UserAccount;
}
}
else
{
manager = managerEmp.UserAccount;
}
departmentManagerTaskUsers.Add(manager);
//0830
fields["Managers"] = manager;
var deleman = WorkFlowUtil.GetDeleman(manager, CA.WorkFlow.UI.Constants.CAModules.TravelRequest);
if (deleman != null)
{
departmentManagerTaskUsers.Add(deleman);
//fields["Delegates"] = deleman;
}
context.UpdateWorkflowVariable("DepartmentHeadTaskUsers", departmentManagerTaskUsers);
#endregion
decimal totalCost = this.DataForm1.GetTotal();
if (isCEO)
{
context.UpdateWorkflowVariable("IsBusiness", false);
context.UpdateWorkflowVariable("Total", 0);
}
else
{
context.UpdateWorkflowVariable("IsBusiness", this.DataForm1.ChosenFlight);
//context.UpdateWorkflowVariable("Total", totalCost);
context.UpdateWorkflowVariable("Total", 0);
}
fields["TravelTotalCost"] = totalCost;
taskTitle = DataForm1.EnglishName + "'s Travel Request ";
#region Set title for workflow
//Modify task title
context.UpdateWorkflowVariable("DepartmentHeadTaskTitle", taskTitle + "needs approval");
context.UpdateWorkflowVariable("MTMTaskTitle", taskTitle + "needs approval");
//.........这里部分代码省略.........
示例7: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.DataFields["Status"] = "Cancelled";
return;
}
string msg = DataForm1.Validate;
if (!string.IsNullOrEmpty(msg))
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
//组开始
List<string> lst = WorkFlowUtil.UserListInGroup("wf_IT");
if (lst.Count == 0)
{
//Don
DisplayMessage("Unable to submit the application. There is no user in wf_IT group. Please contact IT for further help.");
e.Cancel = true;
return;
}
NameCollection ItMemberUser = new NameCollection();
ItMemberUser.AddRange(lst.ToArray());
Employee approver = WorkFlowUtil.GetEmployeeApprover(DataForm1.Applicant);
if (approver == null)
{
//Don
DisplayMessage("Unable to find an approver for the applicant. Please contact IT for further help.");
e.Cancel = true;
return;
}
NameCollection DepartHeadUser = new NameCollection();
DepartHeadUser.Add(approver.UserAccount);
NameCollection ITHeadUser = new NameCollection();
string strHRHeadAccount = UserProfileUtil.GetDepartmentManager("it");
ITHeadUser.Add(strHRHeadAccount);
NameCollection CFOUser = new NameCollection();
lst = WorkFlowUtil.UserListInGroup("wf_CFO");
CFOUser.AddRange(lst.ToArray());
//组结束
try
{
WorkflowContext.Current.UpdateWorkflowVariable("ITMemberAccounts", ItMemberUser);
WorkflowContext.Current.UpdateWorkflowVariable("DepartHeaderAccounts", DepartHeadUser);
WorkflowContext.Current.UpdateWorkflowVariable("ITHeaderAccounts", ITHeadUser);
WorkflowContext.Current.UpdateWorkflowVariable("FOCOAccounts", CFOUser);
WorkflowContext.Current.UpdateWorkflowVariable("IsFOCO", false);
WorkflowContext.Current.UpdateWorkflowVariable("ITMemberTitle", DataForm1.Applicant.DisplayName + "'s IT request needs confirm");
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeaderTitle", DataForm1.Applicant.DisplayName + "'s IT request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("ITHeaderTitle", DataForm1.Applicant.DisplayName + "'s IT request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("FOCOTitle", DataForm1.Applicant.DisplayName + "s 'IT request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("UpdateTaskTitle", "Please complete IT request for " + DataForm1.Applicant.DisplayName);
WorkflowContext.Current.DataFields["Name"] = DataForm1.Name;
WorkflowContext.Current.DataFields["Department"] = DataForm1.Department;
WorkflowContext.Current.DataFields["FOCOApprove"] = DataForm1.IsFOCO;
WorkflowContext.Current.DataFields["ApplyDate"] = DataForm1.ApplyDate;
WorkflowContext.Current.DataFields["AppliedUser"] = this.DataForm1.Applicant.UserAccount;
WorkflowContext.Current.DataFields["ReasonforRequest"] = this.DataForm1.ReasonforRequest;
WorkflowContext.Current.DataFields["Flag"] = "Submit";
WorkflowContext.Current.DataFields["Status"] = "In Progress";
}
catch (Exception ex)
{
throw ex;
}
}
示例8: UpdateWorkFlowDataFields
/// <summary>
/// 更新工作流相关list中字段数据
/// </summary>
/// <param name="dpTaskUsers">部门领导</param>
/// <param name="isSave">是否为保存数据状态</param>
private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers, bool isSave)
{
WorkflowContext.Current.DataFields["Status"] = isSave ? CAWorkflowStatus.Pending :
CAWorkflowStatus.InProgress;
WorkflowContext.Current.DataFields["WorkFlowNumber"] = CreateWorkflowNumber();
WorkflowContext.Current.DataFields["Applicant"] = CurrentEmployee.DisplayName +
"(" + CurrentEmployee.UserAccount + ")";
WorkflowContext.Current.DataFields["DepartmentVal"] = CurrentEmployee.Department;
WorkflowContext.Current.DataFields["Manager"] = dpTaskUsers.Count > 0 ? dpTaskUsers[0] : "";
//Update varivable.(Payment term less than 30 days required CFO's special approval)
WorkflowContext.Current.DataFields["PaymentTerm"] = DataForm1.PaymentTerm;
var DepartmentHeadTaskUsers = new NameCollection();
var MDMTaskUsers = new NameCollection();
var CFOTaskUsers = new NameCollection();
string department = CurrentEmployee.Department;
DepartmentHeadTaskUsers.Add(UserProfileUtil.GetDepartmentManager(department));
List<string> lst = WorkFlowUtil.UserListInGroup("wf_CFO");
CFOTaskUsers.AddRange(lst.ToArray());
lst = WorkFlowUtil.UserListInGroup("wf_Finance_MDM");
MDMTaskUsers.AddRange(lst.ToArray());
//WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskUsers", DepartmentHeadTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("MDMTaskUsers", MDMTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("CFOTaskUsers", CFOTaskUsers);
System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceDepartmentHeadTask, DepartmentHeadTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceMDMTask, MDMTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierSetupMaintenanceCFOTask, CFOTaskUsers.JoinString(","));
WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
}
示例9: GetTaskUsers
internal static NameCollection GetTaskUsers(NameCollection manager, string managerAccount)
{
manager.Add(managerAccount);
string moduleID = WorkFlowUtil.GetModuleIdByListName("TravelExpenseClaimWorkflow");
var deleman = WorkFlowUtil.GetDeleman(managerAccount, moduleID);
if (deleman != null)
{
manager.Add(deleman);
}
return manager;
}
示例10: StartWorkflowButton1_Executing
void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
{
StartWorkflowButton btn = sender as StartWorkflowButton;
if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
WorkflowContext.Current.DataFields["Flag"] = "Save";
WorkflowContext.Current.DataFields["Status"] = "NonSubmit";
}
else
{
WorkflowContext.Current.UpdateWorkflowVariable("IsSave", false);
WorkflowContext.Current.DataFields["Flag"] = "Submit";
WorkflowContext.Current.DataFields["Status"] = "In Progress";
}
//string strDepartment = DataForm1.Applicant.Department;
//string strConstructionHeader = @"ca\ztao";
//string strConstruction = @"ca\ztao";
//string strDepartmentHeader = @"ca\ztao";
//string strStoreOperationTeam = @"ca\ztao";
//string strCFO = @"ca\ztao";
//组开始
string strConstructionHeadAccount = UserProfileUtil.GetDepartmentManager("Construction");
//List<string> lst = WorkFlowUtil.UserListInGroup("ConstructionHeadGroup");
NameCollection ConstructionHead = new NameCollection();
//ConstructionHead.AddRange(lst.ToArray());
ConstructionHead.Add(strConstructionHeadAccount);
//ConstructionHead.Add(@"ca\caix");
NameCollection ConstructionUser = new NameCollection();
List<string> lst = WorkFlowUtil.UserListInGroup("wf_Construction");
ConstructionUser.AddRange(lst.ToArray());
//ConstructionUser.Add(strConstruction);
string department = string.Empty;
if (DataForm1.Applicant.Department.Contains(';'))
department = DataForm1.Applicant.Department.Substring(0, DataForm1.Applicant.Department.IndexOf(';')+1);
else
department = DataForm1.Applicant.Department;
string departmentManager = UserProfileUtil.GetDepartmentManager(department);
if (string.IsNullOrEmpty(departmentManager))
{
//Don
DisplayMessage("Unable to submit the application. There is no department manager defined. Please contact IT for further help.");
e.Cancel = true;
return;
}
NameCollection DepartmentHead = new NameCollection();
//lst = WorkFlowUtil.UserListInGroup("DepartmentHeadGroup");
//DepartmentHead.AddRange(lst.ToArray());
//DepartmentHead.Add(strDepartmentHeader);
DepartmentHead.Add(departmentManager);
NameCollection StoreOperationTeamUser = new NameCollection();
try
{
//lst = WorkFlowUtil.UserListInGroup("wf_StoreOperationTeam");
//StoreOperationTeamUser.AddRange(lst.ToArray());
//SPListItemCollection coll = GetSPColl("Stores", "Cost Center", DataForm1.CostCenter, 1);
//StoreOperationTeamUser.Add(new SPFieldLookupValue(coll[0]["Owner"] + "").LookupValue);
string strStoreOperations = UserProfileUtil.GetDepartmentManager("Store Operations");
StoreOperationTeamUser.Add(strStoreOperations);
}
catch { }
//StoreOperationTeamUser.Add(strStoreOperationTeam);
NameCollection CFOUser = new NameCollection();
lst = WorkFlowUtil.UserListInGroup("wf_CFO");
CFOUser.AddRange(lst.ToArray());
//CFOUser.Add(strCFO);
//组结束
WorkflowContext.Current.UpdateWorkflowVariable("ConstructionHeadAccount", ConstructionHead);
WorkflowContext.Current.UpdateWorkflowVariable("ConstructionAccount", ConstructionUser);
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadAccount", DepartmentHead);
WorkflowContext.Current.UpdateWorkflowVariable("StoreOperationTeamAccount", StoreOperationTeamUser);
WorkflowContext.Current.UpdateWorkflowVariable("CFOAccount", CFOUser);
WorkflowContext.Current.UpdateWorkflowVariable("isSameUser", Common.IsSameUser(DepartmentHead, StoreOperationTeamUser, CFOUser));
WorkflowContext.Current.UpdateWorkflowVariable("IsFixedAsset", DataForm1.RequestType == "Capex" ? "FixedAsset" : DataForm1.RequestType);
//修改TaskTitle
WorkflowContext.Current.UpdateWorkflowVariable("ConstructionHeadTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("ConstructionTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs supplies other information");
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("StoreOperationTeamTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("CFOTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("UpdateTaskTitle", "Please complete construction purchasing request for " + DataForm1.Applicant.DisplayName);
WorkflowContext.Current.UpdateWorkflowVariable("PlacesTheOrderTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs places the order");
WorkflowContext.Current.UpdateWorkflowVariable("OrderHandoverTitle", DataForm1.Applicant.DisplayName + "'s construction purchasing request needs order handover");
//修改结束
this.WorkFlowNumber = CreateWorkFlowNumber();
WorkflowContext.Current.DataFields["WorkFlowNumber"] = this.WorkFlowNumber;
WorkflowContext.Current.DataFields["ApplyDept"] = DataForm1.Applicant.Department;
WorkflowContext.Current.DataFields["ApplyDate"] = DataForm1.ApplyDate;
WorkflowContext.Current.DataFields["ApplyUser"] = this.DataForm1.Applicant.UserAccount;
WorkflowContext.Current.DataFields["RequestType"] = this.DataForm1.RequestType;
WorkflowContext.Current.DataFields["BudgetApproved"] = this.DataForm1.BudgetApproved;
//.........这里部分代码省略.........
示例11: GetACCBBSApprovers
/// <summary>
/// 得到最后一步审批组MMC,BBS里的审批用户
/// </summary>
/// <returns></returns>
NameCollection GetACCBBSApprovers()
{
NameCollection ncMMCBBSApprovers = new NameCollection();
SPGroup groupMMC = WorkFlowUtil.GetUserGroup("wf_ACC");
if (groupMMC == null || groupMMC.Users.Count == 0)
{
DisplayMessage("There are no users in wf_ACC");
return null;
}
foreach (SPUser user in groupMMC.Users)
{
string sName = user.LoginName;
if (user.IsSiteAdmin || sName.Equals("SHAREPOINT\\System", StringComparison.CurrentCultureIgnoreCase))
{
continue;
}
ncMMCBBSApprovers.Add(sName);
string deleman = WorkFlowUtil.GetDeleman(sName, WorkFlowUtil.GetModuleIdByListName("POTypeChangeWorkflow"));
if (deleman != null)
{
ncMMCBBSApprovers.Add(deleman);
}
}
if (ncMMCBBSApprovers.Count == 0)
{
DisplayMessage("There are no users in wf_ACC");
return null;
}
SPGroup groupBBS = WorkFlowUtil.GetUserGroup("wf_BSS");
if (groupBBS == null || groupBBS.Users.Count == 0)
{
DisplayMessage("There are no users in wf_BSS");
return null;
}
bool bExistBBS = false;
foreach (SPUser user in groupBBS.Users)
{
string sName = user.LoginName;
if (user.IsSiteAdmin || sName.Equals("SHAREPOINT\\System", StringComparison.CurrentCultureIgnoreCase))
{
continue;
}
ncMMCBBSApprovers.Add(sName);
string deleman = WorkFlowUtil.GetDeleman(sName, WorkFlowUtil.GetModuleIdByListName("POTypeChangeWorkflow"));
if (deleman != null)
{
ncMMCBBSApprovers.Add(deleman);
}
bExistBBS = true;
}
if (!bExistBBS)
{
DisplayMessage("There are no users in wf_BSS");
return null;
}
return ncMMCBBSApprovers;
}
示例12: StartPOWorkflow
private static void StartPOWorkflow(SPList list, List<SPListItem> items)
{
if (items.Count == 0)
{
return;
}
SPSite site = SPContext.Current.Site;
var wfName = ConfigurationManager.AppSettings["POWFName"];
if (wfName.IsNullOrWhitespace())
{
CommonUtil.logError("PO Workflow name is set in web.config. Please check it first whether key \"POWFName\" is set.");
return;
}
var currUser = SPContext.Current.Web.CurrentUser.LoginName;
NameCollection checkManager = new NameCollection();
checkManager.Add(SPContext.Current.Web.CurrentUser.LoginName);
var deleman = PurchaseRequestCommon.GetDelemanForPO(currUser); //查找代理人
if (deleman != null)
{
checkManager.Add(deleman);
}
//启动工作流
foreach (var item in items)
{
WorkflowVariableValues vs = new WorkflowVariableValues();
vs["CompleteTaskFormURL"] = "/_Layouts/CA/WorkFlows/PurchaseOrder/EditForm.aspx";
vs["CompleteTaskTitle"] = item["WorkflowNumber"].AsString() + ": Please complete the PO";
vs["CompleteTaskUsers"] = checkManager;
vs["IsSkip"] = item["IsSkipChop"];//纸袋不用盖章
var eventData = SerializeUtil.Serialize(vs);
var wfAss = list.WorkflowAssociations.GetAssociationByName(wfName, System.Globalization.CultureInfo.CurrentCulture);
SPWorkflow wf = site.WorkflowManager.StartWorkflow(item, wfAss, eventData);
WorkFlowUtil.UpdateWorkflowPath(item, eventData);
}
}
示例13: UpdateWorkflow
private void UpdateWorkflow(QuickFlow.UI.Controls.ActionEventArgs e)
{
Employee approver = WorkFlowUtil.GetEmployeeApprover(DataForm1.Applicant);
if (approver == null)
{
DisplayMessage("Unable to find an approver for the applicant. Please contact IT for further help.");
e.Cancel = true;
return;
}
List<string> list = WorkFlowUtil.UserListInGroup("wf_Reception");
if (list.Count > 1)
{
DisplayMessage("Unable to submit the application. More than one receptionist is defined. Please contact IT for further help.");
e.Cancel = true;
return;
}
string deptHead = approver.UserAccount;
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHead", deptHead);
NameCollection names = new NameCollection();
if (DataForm1.radiobuttonYes && DataForm1.RadioYes)
{
names.AddRange(list.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
else if (DataForm1.radiobuttonYes && DataForm1.RadioNo)
{
if (IsReceptionist(DataForm1.btApplicant1))
{
names.AddRange(list.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
else
{
names.AddRange(list.ToArray());
names.Add(DataForm1.btApplicant1);
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "no";
}
}
else if (DataForm1.radiobuttonYes && DataForm1.RadioDisplay)
{
names.AddRange(list.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
else if (DataForm1.radiobuttonNO && DataForm1.RadioYes)
{
if (IsReceptionist(DataForm1.btUser1))
{
names.AddRange(list.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
else
{
names.AddRange(list.ToArray());
names.Add(DataForm1.btUser1);
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "no";
}
}
else if (DataForm1.radiobuttonNO && DataForm1.RadioNo)
{
if (DataForm1.btUser1.Equals(DataForm1.btApplicant1, StringComparison.CurrentCultureIgnoreCase))
{
names.Add(DataForm1.btUser1);
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
else
{
names.Add(DataForm1.btUser1);
names.Add(DataForm1.btApplicant1);
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "no";
}
}
else if (DataForm1.radiobuttonNO && DataForm1.RadioDisplay)
{
names.Add(DataForm1.btUser1);
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.DataFields["IsTheSame"] = "yes";
}
//List<string> strGroupUsers = WorkFlowUtil.UserListInGroup("wf_Reception");
//NameCollection names = new NameCollection();
//names.AddRange(strGroupUsers.ToArray());
//WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistUsers", names);
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskTitle", DataForm1.Applicant.DisplayName + "'s travel request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("ReceptionistTaskTitle", "Please complete travel request for " + DataForm1.Applicant.DisplayName);
WorkflowContext.Current.DataFields["UserName"] = DataForm1.Applicant.UserAccount;
WorkflowContext.Current.DataFields["EnglishName"] = DataForm1.Applicant.DisplayName;
WorkflowContext.Current.DataFields["Department"] = DataForm1.Applicant.Department;
WorkflowContext.Current.DataFields["JobTitle"] = DataForm1.Applicant.Title;
//.........这里部分代码省略.........
示例14: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.DataFields["Status"] = "Cancelled";
return;
}
string msg = DataForm1.Validate();
if (!string.IsNullOrEmpty(msg))
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
NameCollection buyingUsers = new NameCollection();
buyingUsers.Add(DataForm1.BuyingUser);
// WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveUsers", buyingUsers);
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.SupplierReticketingBuyingApproveUsers, GetDelemanNameCollection(buyingUsers, Constants.CAModules.SupplierReTicketingCharge));
WorkflowContext.Current.DataFields["BuyingUser"] = DataForm1.BuyingUser;
WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit(); ;
if (!string.IsNullOrEmpty(ctfComments.Value.ToString()))
{
WorkflowContext.Current.DataFields["Comments"] = string.Empty;
}
WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
}
示例15: Actions_ActionExecuting
private void Actions_ActionExecuting(object sender, ActionEventArgs e)
{
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
switch (WorkflowContext.Current.Step)
{
case "NextApproveTask":
if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase)
&& this.DataForm1.CashAdvanceType != "Urgent")
{
context.UpdateWorkflowVariable("IsUrgent", false);
WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", false);
fields["Status"] = CAWorkflowStatus.Rejected;
context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit Cash Advance Request");
SendEmail("Reject");
}
else
{
string levelType = "Contract Approval Limits";
double total = Convert.ToDouble(fields["Amount"].ToString());
var quota = WorkFlowUtil.GetQuota(fields["CurrManager"].ToString(), levelType);
if (total > quota)
{
if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase))
{
context.UpdateWorkflowVariable("IsUrgent", true);
fields["CashAdvanceType"] = "Normal";
string strNextTaskTitle1 = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle1);
}
var manager = new NameCollection();
var managerEmp = WorkFlowUtil.GetNextApprover(fields["CurrManager"].ToString());
if (managerEmp == null && !WorkflowPerson.IsCEO(fields["CurrManager"].ToString()))
{
DisplayMessage("The manager is not set in the system.");
e.Cancel = true;
return;
}
manager.Add(managerEmp.UserAccount);
fields["CurrManager"] = managerEmp.UserAccount;
NameCollection wfCFO = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
NameCollection wfFinaceConfirm = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTask, manager.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceApprove, wfCFO.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirmEnd, wfFinaceConfirm.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceFinaceConfirm, wfFinaceConfirm.JoinString(","));
WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", true);
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(manager, Constants.CAModules.CashAdvanceRequest));
}
else
{
if (e.Action.Equals("Reject", StringComparison.CurrentCultureIgnoreCase))
{
context.UpdateWorkflowVariable("IsUrgent", true);
WorkflowContext.Current.UpdateWorkflowVariable("IsFinance", true);
fields["CashAdvanceType"] = "Normal";
string strNextTaskTitle2 = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle2);
}
WorkflowContext.Current.UpdateWorkflowVariable("IsContinue", false);
NameCollection wfCFO1 = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
string strNextTaskTitle = string.Format("{0} {1} {2}'s Cash Advance Request", WorkflowContext.Current.DataFields["WorkflowNumber"].AsString(), WorkflowContext.Current.DataFields["Amount"].AsString(), WorkflowContext.Current.DataFields["Applicant"].AsString());
if (!wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Urgent")
{
NameCollection wfCFO2 = WorkFlowUtil.GetUsersInGroup("wf_Finace_FC");
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfCFO2, Constants.CAModules.CashAdvanceRequest));
}
if (wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Urgent")
{
NameCollection wfFinaceConfirm1 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm1, Constants.CAModules.CashAdvanceRequest));
context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
}
if (!wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Normal")
{
NameCollection wfFinaceConfirm2 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm2, Constants.CAModules.CashAdvanceRequest));
context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
}
if (wfCFO1.Contains(WorkflowContext.Current.DataFields["Applicant"].ToString()) && this.DataForm1.CashAdvanceType == "Normal")
{
NameCollection wfFinaceConfirm2 = WorkFlowUtil.GetUsersInGroup("wf_FinanceConfirm");
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceNextApproveTaskUsers, GetDelemanNameCollection(wfFinaceConfirm2, Constants.CAModules.CashAdvanceRequest));
context.UpdateWorkflowVariable("NextApproveTaskTitle", strNextTaskTitle);
}
}
fields["Status"] = CAWorkflowStatus.InProgress;
}
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.CashAdvanceApproversLoginName);
break;
case "FinaceConfirmEnd":
if (e.Action.Equals("Confirm", StringComparison.CurrentCultureIgnoreCase))
{
//if (PostCashAdvanceToSAP(fields))
//{
context.UpdateWorkflowVariable("PostSAPResult", true);
//.........这里部分代码省略.........