Ejemplo n.º 1
0
        public questStatus Read(PrivilegeId privilegeId, out PrivilegeEditorViewModel privilegeEditorViewModel)
        {
            // Initialize
            questStatus status = null;

            privilegeEditorViewModel = null;


            // Read
            Quest.Functional.ASM.Privilege privilege = null;
            PrivilegesMgr privilegesMgr = new PrivilegesMgr(this.UserSession);

            status = privilegesMgr.Read(privilegeId, out privilege);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model.
            privilegeEditorViewModel = new PrivilegeEditorViewModel(this.UserSession);
            BufferMgr.TransferBuffer(privilege, privilegeEditorViewModel);



            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 2
0
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        // CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus Save(PrivilegeEditorViewModel privilegeEditorViewModel)
        {
            // Initialize
            questStatus status = null;


            // Transfer model
            Quest.Functional.ASM.Privilege privilege = new Quest.Functional.ASM.Privilege();
            BufferMgr.TransferBuffer(privilegeEditorViewModel, privilege);


            // Determine if this is a create or update
            PrivilegesMgr privilegesMgr = new PrivilegesMgr(this.UserSession);

            if (privilegeEditorViewModel.Id < BaseId.VALID_ID)
            {
                // Create
                PrivilegeId privilegeId = null;
                status = privilegesMgr.Create(privilege, out privilegeId);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, privilegeEditorViewModel);
                    return(status);
                }
                privilegeEditorViewModel.Id = privilegeId.Id;
            }
            else
            {
                // Update
                status = privilegesMgr.Update(privilege);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, privilegeEditorViewModel);
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 3
0
 public UserSessionPrivilege()
 {
     User      = new User();
     Privilege = new Privilege();
 }
Ejemplo n.º 4
0
 public UserPrivilege()
 {
     User      = new User();
     Privilege = new Privilege();
 }
Ejemplo n.º 5
0
 public PrivilegeUserList()
 {
     Privilege = new Privilege();
     UserList  = new List <User>();
 }
Ejemplo n.º 6
0
 public PrivilegeUser()
 {
     Privilege = new Privilege();
     User      = new User();
 }