/// <summary> /// Saves the new team entity and adds the owner to the team. Optionally will /// add the owner's manager to the team is the add owner's manager checkbox is checked. /// </summary> /// <param name="form"></param> /// <param name="args"></param> public static void SaveButton_OnClickStep(IInsertTeam form, EventArgs args) { IWebDialogService dialogService = form.Services.Get <IWebDialogService>(); // create the new team IOwner ownerTeam = EntityFactory.Create <IOwner>(); ownerTeam.OwnerDescription = form.OwnerDescription.Text; ownerTeam.Type = OwnerType.Team; if (!ownerTeam.IsValidName(form.OwnerDescription.Text)) { string msg = form.GetResource("InvalidNameMessage").ToString(); if (dialogService != null && !string.IsNullOrEmpty(msg)) { dialogService.ShowMessage(msg, form.GetResource("InvalidNameMessageTitle").ToString()); } return; } if (ownerTeam.OwnerNameExists(form.OwnerDescription.Text)) { string msg = form.GetResource("DuplicateOwnerMessage").ToString(); if (dialogService != null && !string.IsNullOrEmpty(msg)) { dialogService.ShowMessage(msg, form.GetResource("DuplicateOwnerTitle").ToString()); } return; } ownerTeam.Save(); // set a default profile IOwnerSecurityProfile securityProfile = EntityFactory.GetById <IOwnerSecurityProfile>("PROF00000001"); if (form.securityProfileLookup.LookupResultValue != null) { securityProfile = form.securityProfileLookup.LookupResultValue as IOwnerSecurityProfile; } // get a team object. This is a view of the owner object ITeam team = EntityFactory.GetById <ITeam>(ownerTeam.Id); // add an ownerJoin record for the new team. Both the parent and the // child ids will point to the team team.AddMemberWithSecurityProfile(ownerTeam, securityProfile); // get the selected owner of the team. This will be a user IUser teamOwnerUser = form.DefaultOwner.LookupResultValue as IUser; if (teamOwnerUser != null) { // add the team owner as a member of the team IOwnerSecurityProfile ownerSecurityProfile = EntityFactory.GetById <IOwnerSecurityProfile>("PROF00000003"); team.AddMemberWithSecurityProfile(teamOwnerUser.DefaultOwner, ownerSecurityProfile); } MySlx.MainView.Show <ITeam>(ownerTeam.Id.ToString()); }
public static void OnLoad1Step( IInsertTeam form, EventArgs args) { ITeam team = Sage.Platform.EntityFactory.Create<ITeam>(); form.addManagerCheckBox.Checked = team.GetAddManagerWithMemberOption(); IOwnerSecurityProfile securityProfile = EntityFactory.GetById<IOwnerSecurityProfile>("PROF00000001"); // read/write default form.securityProfileLookup.LookupResultValue = securityProfile; }
public static void OnLoad1Step(IInsertTeam form, EventArgs args) { ITeam team = EntityFactory.Create <ITeam>(); form.addManagerCheckBox.Checked = team.GetAddManagerWithMemberOption(); IOwnerSecurityProfile securityProfile = EntityFactory.GetById <IOwnerSecurityProfile>("PROF00000001"); // read/write default form.securityProfileLookup.LookupResultValue = securityProfile; }
public CreateTeamHandler( ILogger <CreateTeamHandler> logger, IValidateTeamName validateTeamName, IInsertTeam insertTeam, IMapper mapper) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _validateTeamName = validateTeamName ?? throw new ArgumentNullException(nameof(validateTeamName)); _insertTeam = insertTeam ?? throw new ArgumentNullException(nameof(insertTeam)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
/// <summary> /// Saves the new team entity and adds the owner to the team. Optionally will /// add the owner's manager to the team is the add owner's manager checkbox is checked. /// </summary> /// <param name="form"></param> /// <param name="args"></param> public static void SaveButton_OnClickStep(IInsertTeam form, EventArgs args) { IWebDialogService dialogService = form.Services.Get<IWebDialogService>(); // create the new team IOwner ownerTeam = EntityFactory.Create<IOwner>(); ownerTeam.OwnerDescription = form.OwnerDescription.Text; ownerTeam.Type = OwnerType.Team; if (!ownerTeam.IsValidName(form.OwnerDescription.Text)) { string msg = form.GetResource("InvalidNameMessage").ToString(); if (dialogService != null && !string.IsNullOrEmpty(msg)) dialogService.ShowMessage(msg, form.GetResource("InvalidNameMessageTitle").ToString()); return; } if (ownerTeam.OwnerNameExists(form.OwnerDescription.Text)) { string msg = form.GetResource("DuplicateOwnerMessage").ToString(); if (dialogService != null && !string.IsNullOrEmpty(msg)) dialogService.ShowMessage(msg, form.GetResource("DuplicateOwnerTitle").ToString()); return; } ownerTeam.Save(); // set a default profile IOwnerSecurityProfile securityProfile = EntityFactory.GetById<IOwnerSecurityProfile>("PROF00000001"); if (form.securityProfileLookup.LookupResultValue != null) securityProfile = form.securityProfileLookup.LookupResultValue as IOwnerSecurityProfile; // get a team object. This is a view of the owner object ITeam team = EntityFactory.GetById<ITeam>(ownerTeam.Id); // add an ownerJoin record for the new team. Both the parent and the // child ids will point to the team team.AddMemberWithSecurityProfile(ownerTeam, securityProfile); // get the selected owner of the team. This will be a user IUser teamOwnerUser = form.DefaultOwner.LookupResultValue as IUser; if (teamOwnerUser != null) { // add the team owner as a member of the team IOwnerSecurityProfile ownerSecurityProfile = EntityFactory.GetById<IOwnerSecurityProfile>("PROF00000003"); team.AddMemberWithSecurityProfile(teamOwnerUser.DefaultOwner, ownerSecurityProfile); } HttpContext.Current.Response.Redirect(string.Format("~/Team.aspx?entityId={0}", ownerTeam.Id.ToString()), false); }
public static void addManagerCheckBox_OnChangeStep( IInsertTeam form, EventArgs args) { ITeam team = Sage.Platform.EntityFactory.Create<ITeam>(); team.SetAddManagerWithMemberOption(form.addManagerCheckBox.Checked ? bool.TrueString : bool.FalseString); }
public static void addManagerCheckBox_OnChangeStep(IInsertTeam form, EventArgs args) { ITeam team = EntityFactory.Create <ITeam>(); team.SetAddManagerWithMemberOption(form.addManagerCheckBox.Checked ? bool.TrueString : bool.FalseString); }