///<summary> /// Prepare the Model. ///</summary> override public void Execute(INotification notification) { // Create User Proxy, UserProxy userProxy = new UserProxy(); //Populate it with dummy data userProxy.AddItem(new UserVo { Username = "******", Fname = "Larry", Lname = "Stooge", Email = "*****@*****.**", Password = "******", Department = DeptEnum.ACCT }); userProxy.AddItem(new UserVo { Username = "******", Fname = "Curly", Lname = "Stooge", Email = "*****@*****.**", Password = "******", Department = DeptEnum.SALES }); userProxy.AddItem(new UserVo { Username = "******", Fname = "Moe", Lname = "Stooge", Email = "*****@*****.**", Password = "******", Department = DeptEnum.PLANT }); // register it Facade.RegisterProxy(userProxy); // Create Role Proxy RoleProxy roleProxy = new RoleProxy(); //Populate it with dummy data RoleEnum[] lstoogeRoles = { RoleEnum.PAYROLL, RoleEnum.EMP_BENEFITS }; roleProxy.AddItem(new RoleVo("lstooge", new ObservableCollection <RoleEnum>(lstoogeRoles))); RoleEnum[] cstoogeRoles = { RoleEnum.ACCT_PAY, RoleEnum.ACCT_RCV, RoleEnum.GEN_LEDGER }; roleProxy.AddItem(new RoleVo("cstooge", new ObservableCollection <RoleEnum>(cstoogeRoles))); RoleEnum[] mstoogeRoles = { RoleEnum.INVENTORY, RoleEnum.PRODUCTION, RoleEnum.SALES, RoleEnum.SHIPPING }; roleProxy.AddItem(new RoleVo("mstooge", new ObservableCollection <RoleEnum>(mstoogeRoles))); // register it Facade.RegisterProxy(roleProxy); }
public RolePanelMediator(RolePanel viewComponent) : base(NAME, viewComponent) { RolePanel.AddRole += onAddRole; RolePanel.RemoveRole += onRemoveRole; RoleProxy = (RoleProxy)Facade.RetrieveProxy(RoleProxy.NAME); ClearForm(); }
/// <summary> /// retrieve the user and role proxies and delete the user /// and his roles. then send the USER_DELETED notification /// </summary> /// <param name="notification"></param> public override void Execute(INotification notification) { UserVO user = (UserVO)notification.Body; UserProxy userProxy = (UserProxy)Facade.RetrieveProxy(UserProxy.NAME); RoleProxy roleProxy = (RoleProxy)Facade.RetrieveProxy(RoleProxy.NAME); userProxy.DeleteItem(user); roleProxy.DeleteItem(user); SendNotification(NotificationConst.USER_DELETED); }
private int addRoleTo(List <IRole> results, IList roles, int i) { foreach (IRole role in roles) { RoleProxy rr = new RoleProxy(); rr.Id = i; rr.Name = role.Name; rr.Role = role; results.Add(rr); i++; } return(i); }
public override void OnRegister() { base.OnRegister(); roleProxy = (RoleProxy)Facade.RetrieveProxy(RoleProxy.NAME); }