public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { var wisa = linkedGroup.Wisa.Group; var parentName = AccountApi.Smartschool.GroupManager.GetLogicalParent(wisa.Name); var parent = (AccountApi.Smartschool.GroupManager.Root as AccountApi.Smartschool.Group).FindByCode(parentName); if (parent != null) { var group = new AccountApi.Smartschool.Group(parent); group.Name = wisa.Name; group.Description = wisa.Description; group.Code = wisa.Name; group.Untis = wisa.Name; group.InstituteNumber = wisa.SchoolCode; group.AdminNumber = int.Parse(wisa.AdminCode); group.Official = true; group.Type = AccountApi.GroupType.Class; bool result = await AccountApi.Smartschool.GroupManager.Save(group).ConfigureAwait(false); if (result) { parent.Children.Add(group); } } }
public static void AddActions(State.Linked.LinkedGroup group) { group.OK = false; group.SetBasicFlags(); if (group.Wisa.Group == null || group.Directory.Group == null || group.Smartschool.Group == null) { // these actions are needed when the account does not exist on one or more services DoNotImportFromWisa.Evaluate(group); AddToSmartschool.Evaluate(group); CreateInSmartschool.Evaluate(group); AddToDirectory.Evaluate(group); RemoveFromDirectory.Evaluate(group); RemoveEmptyFromDirectory.Evaluate(group); DoNotImportFromSmartschool.Evaluate(group); } else { // if the account exists everywhere, we try these actions ModifySmartschoolData.Evaluate(group); AddADGroup.Evaluate(group); if (group.Actions.Count > 0) { group.OK = false; } else { group.OK = true; } } }
public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { InProgress.Value = true; foreach (var field in List) { switch (field) { case Fields.Instellingsnummer: linkedGroup.Smartschool.Group.InstituteNumber = linkedGroup.Wisa.Group.SchoolCode; break; case Fields.UntisID: linkedGroup.Smartschool.Group.Untis = linkedGroup.Smartschool.Group.Name; break; case Fields.Beschrijving: linkedGroup.Smartschool.Group.Description = linkedGroup.Wisa.Group.Description; break; case Fields.AdministratiefNummer: linkedGroup.Smartschool.Group.AdminNumber = Convert.ToInt32(linkedGroup.Wisa.Group.AdminCode); break; } } await AccountApi.Smartschool.GroupManager.Save(linkedGroup.Smartschool.Group).ConfigureAwait(false); InProgress.Value = false; }
public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { InProgress.Value = true; await AccountApi.Directory.ClassGroupManager.Delete(linkedGroup.Directory.Group).ConfigureAwait(false); // Data.Instance.SaveADGroupsToFile(); InProgress.Value = false; }
public static bool Evaluate(State.Linked.LinkedGroup group) { if (!group.Directory.Linked && !group.Wisa.Linked && group.Smartschool.Linked) { group.Actions.Add(new DoNotImportFromSmartschool()); return(true); } return(false); }
public static bool Evaluate(State.Linked.LinkedGroup group) { if (group.Wisa.Linked && !group.Smartschool.Linked && group.Wisa.Group.ContainsStudents()) { group.Actions.Add(new AddToSmartschool()); return(true); } return(false); }
public static bool Evaluate(State.Linked.LinkedGroup group) { if (group.Wisa.Linked && !group.Directory.Linked) { group.Actions.Add(new AddToDirectory()); return(true); } return(false); }
public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { InProgress.Value = true; AccountApi.Rules.DontImportClass rule = State.App.Instance.Wisa.AddimportRule(Rule.WI_DontImportClass) as AccountApi.Rules.DontImportClass; rule.SetConfig(0, linkedGroup.Wisa.Group.Name); await State.App.Instance.Wisa.Groups.Load().ConfigureAwait(false); InProgress.Value = false; }
public static bool Evaluate(State.Linked.LinkedGroup group) { if (group.Directory.Linked && !group.Wisa.Linked && !group.Smartschool.Linked && !AccountApi.Directory.AccountManager.ContainsStudents(group.Directory.Group)) { group.Actions.Add(new RemoveEmptyFromDirectory()); return(true); } return(false); }
public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { if (linkedGroup != null) { var group = linkedGroup.Directory.Group; Connector.CreateOUIfneeded(State.App.Instance.AD.ClassesRoot.Value); ClassGroupManager.AddADGroup(State.App.Instance.Settings.SchoolPrefix.Value + "-" + linkedGroup.Directory.Group.Name); await State.App.Instance.AD.ReloadGroups().ConfigureAwait(false); } }
public static void Evaluate(State.Linked.LinkedGroup group) { if (group.Directory.Linked) { if (State.App.Instance.AD.Groups.ADList.Find((a) => a.CN.Equals(State.App.Instance.Settings.SchoolPrefix.Value + "-" + group.Directory.Group.Name)) == null) { group.Actions.Add(new AddADGroup()); group.Directory.FlagWarning(); } } }
public override async Task Apply(State.Linked.LinkedGroup linkedGroup) { if (linkedGroup != null) { var wisa = linkedGroup.Wisa.Group; var path = Connector.GetStudentpath(wisa.FullName); Connector.CreateOUIfneeded(path); await State.App.Instance.AD.ReloadGroups().ConfigureAwait(false); } // return Task.FromResult(0); }
public static void Evaluate(State.Linked.LinkedGroup group) { var action = new ModifySmartschoolData(); if (group.Wisa.Group.SchoolCode != group.Smartschool.Group.InstituteNumber) { action.List.Add(ModifySmartschoolData.Fields.Instellingsnummer); } if (group.Smartschool.Group.Name != group.Smartschool.Group.Untis) { action.List.Add(ModifySmartschoolData.Fields.UntisID); } if (group.Smartschool.Group.Description != group.Wisa.Group.Description) { action.List.Add(ModifySmartschoolData.Fields.Beschrijving); } if (action.List.Count > 0) { group.Actions.Add(action); group.Smartschool.FlagWarning(); } }
public override Task Apply(State.Linked.LinkedGroup linkedGroup) { throw new NotImplementedException(); }
public abstract Task Apply(State.Linked.LinkedGroup linkedGroup);
public virtual FlowDocument GetDetails(State.Linked.LinkedGroup group) { return(null); }