本文整理汇总了C#中NameCollection.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# NameCollection.AddRange方法的具体用法?C# NameCollection.AddRange怎么用?C# NameCollection.AddRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameCollection
的用法示例。
在下文中一共展示了NameCollection.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTaskUsers
//得到组里的用户
public static NameCollection GetTaskUsers(string group)
{
NameCollection taskUsers = new NameCollection();
List<string> groupUsers = null;
groupUsers = WorkFlowUtil.UserListInGroup(group);
taskUsers.AddRange(groupUsers.ToArray());
return taskUsers;
}
示例2: StartWorkflowButton_Executing
private void StartWorkflowButton_Executing(object sender, CancelEventArgs e)
{
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = context.DataFields;
context.UpdateWorkflowVariable("UploadBillTaskTitle", "Please upload credit card e-statement");
context.UpdateWorkflowVariable("UploadBillTaskFormURL","/_Layouts/CA/WorkFlows/CreditCardClaim/UploadExcelBill.aspx");
var taskUsers = new NameCollection();
List<string> groupUsers = null;
groupUsers = WorkFlowUtil.UserListInGroup(WorkflowGroupName.WF_FinanceConfirm);
taskUsers.AddRange(groupUsers.ToArray());
ReturnAllApproversSP("TaskUsers", groupUsers.ToArray());
context.UpdateWorkflowVariable("UploadBillTaskUsers", taskUsers);
}
示例3: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
//SPFieldUserValueCollection col = WorkFlowUtil.GetApproversValue();
//WorkflowContext.Current.DataFields["Approvers"] = col;
//添加审批人
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, WorkFlowStep.SupplierReticketingApprovers, WorkFlowStep.SupplierReticketingApproverLoginName);
switch (WorkflowContext.Current.Task.Step)
{
case WorkFlowStep.SupplierReticketingBuyingApprove:
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.SupplierReticketingDepartmentHead, GetDelemanNameCollection(new NameCollection(WorkFlowUtil.GetUserInGroup("wf_BSSHead")), Constants.CAModules.SupplierReTicketingCharge));
break;
case WorkFlowStep.SupplierReticketingDepartmentHeadApproval:
List<string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_SR");
NameCollection GroupUsers = new NameCollection();
GroupUsers.AddRange(strGroupUser.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.SupplierReticketingFinanceTaskUsers, GetDelemanNameCollection(GroupUsers, Constants.CAModules.SupplierReTicketingCharge));
break;
}
WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
}
示例4: 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;
context.UpdateWorkflowVariable("IsSubmit", true);
#region Set users for workflow
var manager = new NameCollection();
List<string> groupUsers = WorkFlowUtil.UserListInGroup("wf_IT");
manager.AddRange(groupUsers.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("ApproveTaskUsers", manager);
#endregion
//Set NextApproveTask title for workflow
taskTitle = "DEMO Workflow";
context.UpdateWorkflowVariable("ApproveTaskTitle", taskTitle + "needs approval");
SPQuery query = new SPQuery();
query.Query = @"<OrderBy>
<FieldRef Name='ID' Ascending='False' />
</OrderBy>";
fields["Title"] = WorkFlowUtil.CreateWorkFlowNumber("DEMO_");
#region Set page URL for workflow
//Set page url
var URL = "/_Layouts/CA/WorkFlows/demo/ApproveForm.aspx";
context.UpdateWorkflowVariable("ApproveTaskFormURL", URL);
#endregion
//"DEMO_" +(int.Parse( SPContext.Current.List.GetItems(query)[0]["ID"].AsString())+1);
}
示例5: StartWorkflowButton1_Executing
void StartWorkflowButton1_Executing(object sender, System.ComponentModel.CancelEventArgs e)
{
StartWorkflowButton btnStart = sender as StartWorkflowButton;
if (string.Equals(btnStart.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.UpdateWorkflowVariable("IsSave", true);
DataForm1.Update();
WorkflowContext.Current.DataFields["Status"] = "NonSubmit";
}
else
{
string msg = DataForm1.Validate();
if (!string.IsNullOrEmpty(msg))
{
DisplayMessage(msg);
e.Cancel = true;
return;
}
WorkflowContext.Current.DataFields["Status"] = "In Progress";
}
NameCollection buyingUsers = new NameCollection();
buyingUsers.Add(DataForm1.BuyingUser);
WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveUsers", buyingUsers);
WorkflowContext.Current.UpdateWorkflowVariable("BuyingApproveTaskTitle", DataForm1.Applicant.DisplayName + "'s re-ticketing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHead", WorkFlowUtil.GetUserInGroup("wf_BSSHead"));
List <string> strGroupUser = WorkFlowUtil.UserListInGroup("wf_Finance_SR");
if (strGroupUser.Count == 0)
{
//Don
DisplayMessage("Unable to submit the application. There is no user in wf_Finance_SR group. Please contact IT for further help.");
e.Cancel = true;
return;
}
NameCollection GroupUsers = new NameCollection();
GroupUsers.AddRange(strGroupUser.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable("FinanceTaskUsers", GroupUsers);
WorkflowContext.Current.UpdateWorkflowVariable("DepartmentHeadTaskTitle", DataForm1.Applicant.DisplayName + "'s re-ticketing request needs approval");
WorkflowContext.Current.UpdateWorkflowVariable("FinanceUserTaskTitle", "Please complete re-ticketing request for " + DataForm1.Applicant.DisplayName);
this.WorkFlowNumber = CreateWorkFlowNumber();
WorkflowContext.Current.DataFields["WorkflowNumber"] = this.WorkFlowNumber;
WorkflowContext.Current.DataFields["BuyingUser"] = DataForm1.BuyingUser;
DataForm1.WorkflowNumber = this.WorkFlowNumber;
WorkflowContext.Current.DataFields["FileName"] = DataForm1.Submit();
}
示例6: UpdateWorkFlowDataFields
/// <summary>
/// 更新工作流相关list中字段数据
/// </summary>
/// <param name="dpTaskUsers">部门领导</param>
private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers)
{
WorkflowContext.Current.DataFields["Status"] = CAWorkflowStatus.InProgress;
WorkflowContext.Current.DataFields["Manager"] = dpTaskUsers.Count > 0 ? dpTaskUsers[0] : "";
var DepartmentManagerTaskUsers = new NameCollection();
var FinanceAnalystTaskUsers = new NameCollection();
var CFOTaskUsers = new NameCollection();
DepartmentManagerTaskUsers.Add(UserProfileUtil.GetDepartmentManager(CurrentEmployee.Department));
List<string> lst = WorkFlowUtil.UserListInGroup("wf_CFO");
CFOTaskUsers.AddRange(lst.ToArray());
lst = WorkFlowUtil.UserListInGroup("wf_FinanceAnalyst_IO");
FinanceAnalystTaskUsers.AddRange(lst.ToArray());
//WorkflowContext.Current.UpdateWorkflowVariable("FinanceAnalystTaskUsers", FinanceAnalystTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("CFOTaskUsers", CFOTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("DepartmentManagerTaskUsers", DepartmentManagerTaskUsers);
System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceDepartmentManagerTask, DepartmentManagerTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceCFOTask, CFOTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceFinanceAnalystTask, FinanceAnalystTaskUsers.JoinString(","));
WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
}
示例7: GetTaskUsers
//Return task users object according to special group
public static NameCollection GetTaskUsers(string group, string moduleId)
{
var taskUsers = new NameCollection();
List<string> delemans = null;
List<string> groupUsers = null;
groupUsers = WorkFlowUtil.UserListInGroup(group);
taskUsers.AddRange(groupUsers.ToArray());
delemans = WorkFlowUtil.GetDelemans(groupUsers, moduleId);
//if (delemans.Count > 0)
//{
// taskUsers.AddRange(delemans.ToArray());
//}
foreach (var delegateAccount in delemans)
{
// Need to check whether the delegate account is valid.
if (UserProfileUtil.GetEmployeeEx(delegateAccount) != null)
{
taskUsers.Add(delegateAccount);
}
}
return taskUsers;
}
示例8: Actions_ActionExecuting
private void Actions_ActionExecuting(object sender, ActionEventArgs e)
{
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
switch (WorkflowContext.Current.Step)
{
case "DMMTask":
if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
{
NameCollection wf_NTSC_QM = new NameCollection();
List<string> qm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_QM);
wf_NTSC_QM.AddRange(qm.ToArray());
fields["CurrManager"] = qm.ToArray();
context.UpdateWorkflowVariable("NextApproveTaskUsers", GetDelemanNameCollection(wf_NTSC_QM, WorkFlowUtil.GetModuleIdByListName("New Production Unit Creation")));
}
else
{
fields["Status"] = CAWorkflowStatus.Rejected;
context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit New Production Unit Creation");
}
break;
case "QMTask":
if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
{
NameCollection wf_NTSC_SCM = new NameCollection();
List<string> scm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCM);
wf_NTSC_SCM.AddRange(scm.ToArray());
fields["CurrManager"] = scm.ToArray();
context.UpdateWorkflowVariable("NextApproveTaskUsers", GetDelemanNameCollection(wf_NTSC_SCM, WorkFlowUtil.GetModuleIdByListName("New Production Unit Creation")));
}
else
{
fields["Status"] = CAWorkflowStatus.Rejected;
context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit New Production Unit Creation");
}
break;
case "SCMTask":
if (e.Action.Equals("Approve", StringComparison.CurrentCultureIgnoreCase))
{
NameCollection wf_NTSC_SCMM = new NameCollection();
List<string> scmm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCMM);
wf_NTSC_SCMM.AddRange(scmm.ToArray());
fields["CurrManager"] = scmm.ToArray();
context.UpdateWorkflowVariable("NextApproveTaskUsers", GetDelemanNameCollection(wf_NTSC_SCMM, WorkFlowUtil.GetModuleIdByListName("New Production Unit Creation")));
//string taskTitle = string.Format("{0} {1} {2}'s New Production Unit Creation needs confirm"
// , fields["WorkFlowNumber"].AsString()
// , fields["SupplierName"].AsString()
// , fields["Applicant"].AsString());
string taskTitle = string.Format("{0} {1}'s New Production Unit Creation needs confirm"
, fields["WorkFlowNumber"].AsString()
, fields["Applicant"].AsString());
context.UpdateWorkflowVariable("NextApproveTaskTitle", taskTitle);
}
else
{
fields["Status"] = CAWorkflowStatus.Rejected;
context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit New Production Unit Creation");
}
break;
case "SCMConfirmTask":
if (e.Action.Equals("Confirm", StringComparison.CurrentCultureIgnoreCase))
{
fields["Status"] = CAWorkflowStatus.Completed;
}
else
{
fields["Status"] = CAWorkflowStatus.Rejected;
context.UpdateWorkflowVariable("CompleteTaskTitle", "Please resubmit New Production Unit Creation");
}
break;
}
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, "ApproversSPUser", "Approvers");
WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
}
示例9: SaveFormToWf
void SaveFormToWf()
{
WorkflowContext curContext = WorkflowContext.Current;
string passTo = DataForm1.PickedBy;
//DateTime now = DateTime.Now;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
string taskTitle = SPContext.Current.Web.CurrentUser.Name + "'s Store Sampling";
fields["Store Number"] = ((DropDownList)DataForm1.FindControl("ddlStoreNumber")).SelectedValue; //((TextBox)DataForm1.FindControl("txtStoreNumber")).Text;
fields["Cost Center"] = string.Empty;
fields["Issued to"] = ((DropDownList)DataForm1.FindControl("ddlIssuedTo")).SelectedValue;
fields["Actual Quantity"] = ((TextBox)DataForm1.FindControl("txtActualQuantity")).Text;
if (!string.IsNullOrEmpty(passTo))
{
//fields["Picked by"] = EnsureUser(passTo);
//fields["Picked by"] = web.EnsureUser(passTo);
//try
//{
// fields["Picked by"] = web.SiteUsers[passTo];
//}
//catch {
//}
fields["Picked by"] = web.SiteUsers[passTo];
}
fields["Picked Time"] = ((CADateTimeControl)DataForm1.FindControl("CADateTime1")).SelectedDate.ToShortDateString();
DataForm1.WorkflowNumber = CreateWorkflowNumber();
fields["WorkflowNumber"] = DataForm1.WorkflowNumber;
fields["FileName"] = DataForm1.Submit();
curContext.UpdateWorkflowVariable("StoreAdminSubmitTitle", "Please complete store sampling");
curContext.UpdateWorkflowVariable("BuyerApproveTitle", taskTitle + " needs confirm");
curContext.UpdateWorkflowVariable("StoreManagerApproveTitle", taskTitle + " needs approval");
curContext.UpdateWorkflowVariable("AreaManagerApproveTitle", taskTitle + " needs approval");
curContext.UpdateWorkflowVariable("BSSHeadGroupApproveTitle", taskTitle + " needs approval");
curContext.UpdateWorkflowVariable("BSSTeamTitle", taskTitle + " needs approval");
curContext.UpdateWorkflowVariable("FinanceGroupConfirmTitle", taskTitle + " needs confirm");
ISharePointService sps = ServiceFactory.GetSharePointService(true, SPContext.Current.Site.RootWeb);
SPList stores = sps.GetList("Stores");
QueryField field = new QueryField("Store Number", false);
SPListItemCollection coll = sps.Query(stores, field.Equal(fields["Store Number"] + ""), 1);
if (coll.Count > 0)
{
curContext.UpdateWorkflowVariable("StoreManager", new SPFieldLookupValue(coll[0]["Manager"] + "").LookupValue);
curContext.UpdateWorkflowVariable("AreaManagerApproveUser", new SPFieldLookupValue(coll[0]["AreaManager"]+"").LookupValue);
}
else
{
return;
}
curContext.UpdateWorkflowVariable("Buyer", passTo);
curContext.UpdateWorkflowVariable("BSSHeadGroup", "wf_BSSHead");
NameCollection BBSTeamUser = new NameCollection();
List<string> lst = WorkFlowUtil.UserListInGroup("wf_NSC");
BBSTeamUser.AddRange(lst.ToArray());
curContext.UpdateWorkflowVariable("BSSTeamAccount", BBSTeamUser);
curContext.UpdateWorkflowVariable("FinanceGroup", "wf_Finance_SS");
}
示例10: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
WorkflowContext curContext = WorkflowContext.Current;
WorkflowDataFields fields = curContext.DataFields;
fields["Status"] = "In Progress";
ISharePointService sps = ServiceFactory.GetSharePointService(true, SPContext.Current.Site.RootWeb);
SPList stores = sps.GetList("Stores");
QueryField field = new QueryField("Store Number", false);
SPListItemCollection coll = sps.Query(stores, field.Equal(fields["Store Number"] + ""), 1);
switch (curContext.Task.Step)
{
case "BuyerApprove":
if (coll.Count > 0)
{
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingStoreManager, GetDelemanNameCollection(new NameCollection(new SPFieldLookupValue(coll[0]["Manager"] + "").LookupValue), Constants.CAModules.StoreSampling));
}
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "StoreManagerApprove":
if (coll.Count > 0)
{
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingAreaManagerApproveUser, GetDelemanNameCollection(new NameCollection(new SPFieldLookupValue(coll[0]["AreaManager"] + "").LookupValue), Constants.CAModules.StoreSampling));
}
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "AreaManagerApprove":
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
NameCollection bSSHead = WorkFlowUtil.GetUsersInGroup("wf_BSSHead");
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingBSSHeadGroup, GetDelemanNameCollection(bSSHead, Constants.CAModules.StoreSampling));
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "BSSHeadApprove":
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
NameCollection BBSTeamUser = new NameCollection();
List<string> lst = WorkFlowUtil.UserListInGroup("wf_NSC");
BBSTeamUser.AddRange(lst.ToArray());
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingBSSTeamAccount, GetDelemanNameCollection(BBSTeamUser, Constants.CAModules.StoreSampling));
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "BSSTeamApprove":
if(e.Action=="Approve")
{
if (string.IsNullOrEmpty(((DropDownList)DataForm1.FindControl("ddlCostCenter")).SelectedValue)&&string.IsNullOrEmpty(DataForm1.TextBoxCostCenter))
{
e.Cancel = true;
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Please supply a cost center.');", true);
DataForm1.PickedBy = new SPFieldLookupValue(SPContext.Current.ListItem["Picked by"] + "").LookupValue;
((CADateTimeControl)DataForm1.FindControl("CADateTime1")).Enabled = false;
return;
}
if (string.IsNullOrEmpty(((DropDownList)DataForm1.FindControl("ddlCostCenter")).SelectedValue))
{
fields["Cost Center"] = DataForm1.TextBoxCostCenter;
}
else
{
fields["Cost Center"] = ((DropDownList)DataForm1.FindControl("ddlCostCenter")).SelectedValue;
}
}
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
NameCollection finance_SS = WorkFlowUtil.GetUsersInGroup("wf_Finance_SS");
WorkflowContext.Current.UpdateWorkflowVariable(WorkFlowStep.StoreSamplingFinanceGroup, GetDelemanNameCollection(finance_SS, Constants.CAModules.StoreSampling));
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "FinanceConfirm":
// if (e.Action == "Approve")
if(e.Action=="Confirm")
{
fields["Status"] = "Completed";
fields["Completed Date"] = System.DateTime.Now.ToShortDateString();
}
//fields["Approvers"] = WorkFlowUtil.GetApproversValue();
AddWorkFlowStepApprovers(WorkflowContext.Current.Task.Step, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApprovers, CA.WorkFlow.UI.Constants.WorkFlowStep.StoreSamplingApproverLoginName);
break;
case "StoreAdminSubmit":
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;
}
string passTo = DataForm1.PickedBy;
fields["Store Number"] = ((DropDownList)DataForm1.FindControl("ddlStoreNumber")).SelectedValue; //((TextBox)DataForm1.FindControl("txtStoreNumber")).Text;
fields["Cost Center"] = string.Empty;
fields["Issued to"] = ((DropDownList)DataForm1.FindControl("ddlIssuedTo")).SelectedValue;
if (!string.IsNullOrEmpty(passTo))
//.........这里部分代码省略.........
示例11: UpdateWorkFlowDataFields
/// <summary>
/// 更新工作流相关list中字段数据
/// </summary>
/// <param name="dpTaskUsers">部门领导</param>
/// <param name="isSave">是否为保存数据状态</param>
private void UpdateWorkFlowDataFields(NameCollection dpTaskUsers, bool isSave)
{
double lastValue = DataForm1.GetLastValue(WorkflowContext.Current.DataFields["Order Number"].ToString());
WorkflowContext.Current.DataFields["Last Value"] = lastValue;
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["Department"] = CurrentEmployee.Department;
WorkflowContext.Current.DataFields["Manager"] = dpTaskUsers.Count > 0 ? dpTaskUsers[0] : "";
var DepartmentManagerTaskUsers = new NameCollection();
var FinanceAnalystTaskUsers = new NameCollection();
var CFOTaskUsers = new NameCollection();
DepartmentManagerTaskUsers.Add(UserProfileUtil.GetDepartmentManager(CurrentEmployee.Department));
List<string> lst = WorkFlowUtil.UserListInGroup("wf_CFO");
CFOTaskUsers.AddRange(lst.ToArray());
lst = WorkFlowUtil.UserListInGroup("wf_FinanceAnalyst_IO");
FinanceAnalystTaskUsers.AddRange(lst.ToArray());
//WorkflowContext.Current.UpdateWorkflowVariable("FinanceAnalystTaskUsers", FinanceAnalystTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("CFOTaskUsers", CFOTaskUsers);
//WorkflowContext.Current.UpdateWorkflowVariable("DepartmentManagerTaskUsers", DepartmentManagerTaskUsers);
System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceDepartmentManagerTask, DepartmentManagerTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceCFOTask, CFOTaskUsers.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", CA.WorkFlow.UI.Constants.WorkFlowStep.InternalOrderMaintenanceFinanceAnalystTask, FinanceAnalystTaskUsers.JoinString(","));
WorkflowContext.Current.DataFields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
}
示例12: 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;
}
}
示例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: TerminateAndStartWFForFinanceGroup
private void TerminateAndStartWFForFinanceGroup()
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
web.AllowUnsafeUpdates = true;
SPList list = web.Lists[WorkflowListName.CreditCardBill];
SPWorkflowAssociation wfAss = list.WorkflowAssociations.GetAssociationByName(WorkflowConfigName.CreditCardBillWorkflow, System.Globalization.CultureInfo.CurrentCulture);
SPQuery query = new SPQuery();
query.Query = CreditCardClaimCommon.GetQuery("WorkflowStep", "UploadBillTask");
SPListItemCollection items = list.GetItems(query);
if (items.Count > 0)
{
foreach (SPWorkflow wfItem in items[0].Workflows)
{
foreach (SPWorkflowTask wfTask in wfItem.Tasks)
{
wfTask["Status"] = "Canceled";
wfTask.SystemUpdate();
}
SPWorkflowManager.CancelWorkflow(wfItem);
}
WorkflowVariableValues vs = new WorkflowVariableValues();
vs["UploadBillTaskTitle"] = "Please upload credit card e-statement";
vs["UploadBillTaskFormURL"] = "/_Layouts/CA/WorkFlows/CreditCardClaim/UploadExcelBill.aspx";
var taskUsers = new NameCollection();
List<string> groupUsers = null;
groupUsers = WorkFlowUtil.UserListInGroup(WorkflowGroupName.WF_FinanceConfirm);
taskUsers.AddRange(groupUsers.ToArray());
vs["UploadBillTaskUsers"] = taskUsers;
string eventData = SerializeUtil.Serialize(vs);
site.WorkflowManager.StartWorkflow(items[0], wfAss, eventData);
}
web.AllowUnsafeUpdates = false;
}
}
});
}
示例15: StartWorkflowButton_Executing
private void StartWorkflowButton_Executing(object sender, CancelEventArgs e)
{
string url = Request.UrlReferrer.ToString();
if (!this.DataForm.SubmitStatus)
{
Response.Write("<script type=\"text/javascript\">alert('You are not in Buying Department .');window.location = '" + url + "';</script>");
Response.End();
e.Cancel = true;
return;
}
WorkflowContext context = WorkflowContext.Current;
WorkflowDataFields fields = WorkflowContext.Current.DataFields;
var btn = sender as StartWorkflowButton;
if (string.Equals(btn.Text, "Save", StringComparison.CurrentCultureIgnoreCase))
{
context.UpdateWorkflowVariable("IsSave", true);
context.DataFields["Status"] = CAWorkflowStatus.Pending;
}
else
{
#region Set users for workflow
Employee manager = WorkFlowUtil.GetApproverByLevelPAD(this.DataForm.Applicant);
if (null == manager)
{
Response.Write("<script type=\"text/javascript\">alert('The init error about applicant’s manager in the system.');window.location = '" + url + "';</script>");
Response.End();
e.Cancel = true;
return;
}
NameCollection DMMTask = new NameCollection();
DMMTask.Add(manager.UserAccount);
fields["CurrManager"] = manager.UserAccount;
NameCollection wf_NTSC_QM = new NameCollection();
//NameCollection wf_NTSC_QAD = new NameCollection();
NameCollection wf_NTSC_SCM = new NameCollection();
NameCollection wf_NTSC_SCMM = new NameCollection();
List<string> qm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_QM);
//List<string> qad = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_QAD);
List<string> scm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCM);
List<string> scmm = WorkFlowUtil.UserListInGroup(NewProductionUnitCreationConstants.wf_NTSC_SCMM);
System.Text.StringBuilder group = new System.Text.StringBuilder();
if (qm.Count == 0)
{
group.Append(" wf_NTSC_QM ");
}
//if (qad.Count == 0)
//{
// group.Append(" wf_NTSC_QAD ");
//}
if (scm.Count == 0)
{
group.Append(" wf_NTSC_SCM ");
}
if (scmm.Count == 0)
{
group.Append(" wf_NTSC_SCMM ");
}
if (scm.Count == 0 || scmm.Count == 0 || qm.Count == 0)
{
Response.Write("<script type=\"text/javascript\">alert('The init error about WorkflowPerson in the " + group.ToString() + "');window.location = '" + url + "';</script>");
Response.End();
e.Cancel = true;
return;
}
wf_NTSC_QM.AddRange(qm.ToArray());
//wf_NTSC_QAD.AddRange(qad.ToArray());
wf_NTSC_SCM.AddRange(scm.ToArray());
wf_NTSC_SCMM.AddRange(scmm.ToArray());
System.Text.StringBuilder strStepAndUsers = new System.Text.StringBuilder();
strStepAndUsers.AppendFormat("{0}:{1};", "DMMTask", DMMTask.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", "QMTask", wf_NTSC_QM.JoinString(","));
//strStepAndUsers.AppendFormat("{0}:{1};", "QADTask", wf_NTSC_QAD.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", "SCMTask", wf_NTSC_SCM.JoinString(","));
strStepAndUsers.AppendFormat("{0}:{1};", "SCMConfirmTask", wf_NTSC_SCMM.JoinString(","));
fields["WorkFlowStepsAndUsers"] = strStepAndUsers.ToString();
context.UpdateWorkflowVariable("NextApproveTaskUsers", GetDelemanNameCollection(DMMTask, WorkFlowUtil.GetModuleIdByListName("New Production Unit Creation")));
#endregion
context.UpdateWorkflowVariable("IsSave", false);
context.DataFields["Status"] = CAWorkflowStatus.InProgress;
}
#region Save the data
string workflowNumber = CreateWorkflowNumber();
fields["WorkFlowNumber"] = workflowNumber;
fields["Applicant"] = this.DataForm.Applicant.UserAccount;
fields["Department"] = this.DataForm.Applicant.Department;
fields["ApplicantSPUser"] = NewProductionUnitCreation.EnsureUser(this.DataForm.Applicant.UserAccount);
fields["SupplierName"] = this.DataForm.SupplierName;
fields["SubDivision"] = this.DataForm.Applicant.Department;
fields["SupplierNo"] = this.DataForm.SupplierNo;
fields["PUNO"] = this.DataForm.PUNO;
fields["ProductionUnitName"] = this.DataForm.ProductionUnitName;
fields["IsMondial"] = this.DataForm.IsMondial == "Yes" ? true : false;
fields["Reason"] = this.DataForm.Reason;
#endregion
#region Set title for workflow
//string taskTitle = string.Format("{0} {1} {2}'s New Production Unit Creation needs approval"
// , workflowNumber
//.........这里部分代码省略.........