private static WfActivityDescriptor PrepareServerActivity(string key) { WfActivityDescriptor actDesp = new WfActivityDescriptor(key, WfActivityType.InitialActivity); actDesp.Key = key; actDesp.Name = key; actDesp.Condition.Expression = "Amount > 1000"; actDesp.Variables.SetValue("ActKey", key); actDesp.Variables.SetValue("ActName", key); actDesp.Resources.Add(new WfUserResourceDescriptor((IUser)OguUser.CreateWrapperObject(ActivityConverterTest.UserID, SchemaType.Users))); actDesp.Resources.Add(new WfDepartmentResourceDescriptor((IOrganization)OguOrganization.CreateWrapperObject(ActivityConverterTest.OrganizationID, SchemaType.Organizations))); actDesp.Resources.Add(new WfGroupResourceDescriptor((IGroup)OguGroup.CreateWrapperObject(ActivityConverterTest.GroupID, SchemaType.Groups))); actDesp.Resources.Add(new WfRoleResourceDescriptor(new SOARole(ActivityConverterTest.RoleFullCodeName))); actDesp.Resources.Add(new WfActivityOperatorResourceDescriptor() { ActivityKey = ActivityConverterTest.ResActivityKey }); actDesp.Resources.Add(new WfActivityAssigneesResourceDescriptor() { ActivityKey = ActivityConverterTest.ResActivityKey }); actDesp.Resources.Add(new WfDynamicResourceDescriptor("ConditionResource", "Amount > 1000")); actDesp.BranchProcessTemplates.Add(BranchProcessTemplateConverterTest.PrepareServerBranchProcessTemplate()); return(actDesp); }
protected override void OnPreRender(EventArgs e) { IUser testUser = OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "fanhy")[0]; testUser = (IUser)OguUser.CreateWrapperObject(testUser); this.ClientScript.RegisterHiddenField("userData", JSONSerializerExecute.Serialize(testUser)); base.OnPreRender(e); }
protected void moveToControl_ProcessChanged(IWfProcess process) { if (this.ViewData.Data.Amount >= 5000) { process.ApplicationRuntimeParameters["TempApprover"] = (IUser)OguUser.CreateWrapperObject(OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "quym").First()); } else { process.ApplicationRuntimeParameters["TempApprover"] = (IUser)OguUser.CreateWrapperObject(OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "fanhy").First()); } }
private static void FillPersonTypeUsers(WfMatrixRowUsersCollection rowsUsers) { Dictionary <string, string> userIDs = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (WfMatrixRowUsers rowUsers in rowsUsers) { if (rowUsers.Row.OperatorType == WfMatrixOperatorType.Person) { foreach (string id in rowUsers.ObjectIDs) { userIDs[id] = id; } } } List <string> logonNames = new List <string>(); foreach (KeyValuePair <string, string> kp in userIDs) { logonNames.Add(kp.Key); } OguObjectCollection <IUser> users = OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, logonNames.ToArray()); if (WfRuntime.ProcessContext.CurrentProcess != null) { users = users.FilterUniqueSidelineUsers(WfRuntime.ProcessContext.CurrentProcess.OwnerDepartment); } Dictionary <string, IUser> userDicts = GenerateUserDictionary(users); foreach (WfMatrixRowUsers rowUsers in rowsUsers) { if (rowUsers.Row.OperatorType == WfMatrixOperatorType.Person) { foreach (string id in rowUsers.ObjectIDs) { IUser user = null; if (userDicts.TryGetValue(id, out user)) { if (rowUsers.Users.Exists(u => string.Compare(u.ID, user.ID, true) == 0) == false) { rowUsers.Users.Add((IUser)OguUser.CreateWrapperObject(user)); } } } } } }
public void EnsureInUserList() { if (string.IsNullOrEmpty(UserID) == false) { if (UserList.Exists(u => string.Compare(u.ID, this.UserID, true) == 0) == false) { OguUser user = (OguUser)OguUser.CreateWrapperObject(UserID, SchemaType.Users); if (string.IsNullOrEmpty(UserDisplayName) == false) { user.Name = UserDisplayName; user.DisplayName = UserDisplayName; } UserList.Add(user); } } }
private CommandStateBase Controller_PrepareCommandState(IWfProcess process) { TemplateCommandState state = null; //从流程上下文中获取数据。在这里通过流程上下文保存表单数据,省去了单独建表存储的工作 string appData = (string)process.RootProcess.Context["appData"]; if (appData.IsNullOrEmpty()) { TemplateData data = new TemplateData(); data.ID = process.ResourceID; data.CostCenter = "1001"; data.AdministrativeUnit = "Group"; state = new TemplateCommandState() { Data = data }; process.ApplicationRuntimeParameters["approval1"] = OguUser.CreateWrapperObject(OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "fanhy").FirstOrDefault()); process.ApplicationRuntimeParameters["Amount"] = data.Amount; process.ApplicationRuntimeParameters["CostCenter"] = data.CostCenter; process.ApplicationRuntimeParameters["AdministrativeUnit"] = data.AdministrativeUnit; process.ApplicationRuntimeParameters["TempApprover"] = (IUser)OguUser.CreateWrapperObject(OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "fanhy").First()); process.GenerateCandidatesFromResources(); } else { state = (TemplateCommandState)SerializationHelper.DeserializeStringToObject(appData, SerializationFormatterType.Binary); state.Data.Loaded = true; } return(state); }
private void InnerStartWorkflow(string processDescKey, string appName, string programName, string relativeID, string relativeURL, bool isCloned, NameValueCollection relativeParams) { StartWorkflowControllerOperation operation = new StartWorkflowControllerOperation(); operation.StartupParams.ProcessDescriptor = WfProcessDescriptorManager.GetDescriptor(processDescKey); if (operation.StartupParams.ProcessDescriptor.DefaultTaskTitle.IsNullOrEmpty()) { operation.StartupParams.DefaultTaskTitle = operation.StartupParams.ProcessDescriptor.Name; } else { operation.StartupParams.DefaultTaskTitle = operation.StartupParams.ProcessDescriptor.DefaultTaskTitle; } operation.StartupParams.ResourceID = UuidHelper.NewUuidString(); operation.StartupParams.ApplicationRuntimeParameters["ProcessRequestor"] = OguUser.CreateWrapperObject(DeluxeIdentity.CurrentUser); operation.ApplicationName = appName; operation.ProgramName = programName; operation.StartupParams.RelativeID = relativeID; operation.StartupParams.RelativeURL = relativeURL; operation.StartupParams.Department = DeluxeIdentity.CurrentUser.TopOU; operation.StartupParams.Assignees.Add(DeluxeIdentity.CurrentUser); operation.IsCloned = isCloned; operation.StartupParams.RelativeParams.CopyFrom(relativeParams); operation.NavigationCommand = CollectNavigationCommand(this.GetType()); operation.SceneInfo = CollectSceneInfo(this.GetType()); OnInitOperation(operation); PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("DoStartWorkflowControllerOperation", () => operation.DoOperation()); }
public WfUserResourceDescriptor(IUser user) { this._User = (IUser)OguUser.CreateWrapperObject(user); }
public WfAssignee(IUser user) { this._User = (IUser)OguUser.CreateWrapperObject(user); }