///<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);
        }
Example #2
0
        public override void HandleNotification(INotification note)
        {
            UserVO user;
            RoleVO role;
            string userName;

            switch (note.Name)
            {
            case NotiConst.NEW_USER:
                RolePanel.ClearForm();
                break;

            case NotiConst.USER_ADDED:
                user     = (UserVO)note.Body;
                userName = user == null ? "" : user.UserName;
                role     = new RoleVO(userName);
                roleProxy.AddItem(role);
                RolePanel.ClearForm();
                break;

            case NotiConst.USER_UPDATED:
                RolePanel.ClearForm();
                break;

            case NotiConst.USER_DELETED:
                RolePanel.ClearForm();
                break;

            case NotiConst.CANCEL_SELECTED:
                RolePanel.ClearForm();
                break;

            case NotiConst.USER_SELECTED:
                user     = (UserVO)note.Body;
                userName = user == null ? "" : user.UserName;
                RolePanel.ShowUser(user, roleProxy.GetUserRoles(userName));
                break;

            case NotiConst.ADD_ROLE:
                userName = RolePanel.User == null ? "" : RolePanel.User.UserName;
                RolePanel.ShowUserRoles(roleProxy.GetUserRoles(userName));
                break;

            case NotiConst.DEL_ROLE:
                userName = RolePanel.User == null ? "" : RolePanel.User.UserName;
                RolePanel.ShowUserRoles(roleProxy.GetUserRoles(userName));
                break;
            }
        }
Example #3
0
        override public void HandleNotification(INotification note)
        {
            switch (note.Name)
            {
            case ApplicationFacade.NEW_USER:
                ClearForm();
                break;

            case ApplicationFacade.USER_ADDED:
                RolePanel.User = note.Body as UserVo;
                RoleVo roleVO = new RoleVo(RolePanel.User.Username, new ObservableCollection <RoleEnum>());
                RoleProxy.AddItem(roleVO);
                ClearForm();
                break;

            case ApplicationFacade.USER_UPDATED:
                ClearForm();
                break;

            case ApplicationFacade.USER_DELETED:
                ClearForm();
                break;

            case ApplicationFacade.CANCEL_SELECTED:
                ClearForm();
                break;

            case ApplicationFacade.USER_SELECTED:
                RolePanel.User      = note.Body as UserVo;
                RolePanel.UserRoles = RoleProxy.GetUserRoles(RolePanel.User.Username);
                RolePanel.RoleCombo.SelectedItem = RoleEnum.NONE_SELECTED;
                RolePanel.IsEnabled = true;
                RolePanel.RemoveButton.IsEnabled = false;
                RolePanel.AddButton.IsEnabled    = false;
                break;
            }
        }