Exemple #1
0
        private questStatus delete(FMSEntities dbContext, GroupPrivilegeId groupPrivilegeId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                Quest.Services.Dbio.FMS.GroupPrivileges _groupPrivileges = null;
                status = read(dbContext, groupPrivilegeId, out _groupPrivileges);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the record.
                dbContext.GroupPrivileges.Remove(_groupPrivileges);
                dbContext.SaveChanges();
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
Exemple #2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * UserPrivileges
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(FMSEntities dbContext, GroupPrivilege groupPrivilege, out GroupPrivilegeId groupPrivilegeId)
        {
            // Initialize
            groupPrivilegeId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.FMS.GroupPrivileges _groupPrivileges = new Quest.Services.Dbio.FMS.GroupPrivileges();
                _groupPrivileges.PrivilegeId = groupPrivilege.Privilege.Id;
                _groupPrivileges.GroupId     = groupPrivilege.Group.Id;
                _groupPrivileges.Created     = DateTime.Now;
                dbContext.GroupPrivileges.Add(_groupPrivileges);
                dbContext.SaveChanges();
                if (_groupPrivileges.Id == 0)
                {
                    return(new questStatus(Severity.Error, "GroupPrivilege not created"));
                }
                groupPrivilegeId = new GroupPrivilegeId(_groupPrivileges.Id);
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
Exemple #3
0
        public questStatus Read(DbMgrTransaction trans, GroupPrivilegeId groupPrivilegeId, out GroupPrivilege groupPrivilege)
        {
            // Initialize
            questStatus status = null;

            groupPrivilege = null;


            // Perform read
            Quest.Services.Dbio.FMS.GroupPrivileges _groupPrivileges = null;
            status = read((FMSEntities)trans.DbContext, groupPrivilegeId, out _groupPrivileges);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            groupPrivilege = new GroupPrivilege();
            BufferMgr.TransferBuffer(_groupPrivileges, groupPrivilege);

            return(new questStatus(Severity.Success));
        }
Exemple #4
0
        private questStatus read(FMSEntities dbContext, GroupPrivilegeId groupPrivilegeId, out Quest.Services.Dbio.FMS.GroupPrivileges groupPrivilege)
        {
            // Initialize
            groupPrivilege = null;


            try
            {
                groupPrivilege = dbContext.GroupPrivileges.Where(r => r.Id == groupPrivilegeId.Id).SingleOrDefault();
                if (groupPrivilege == null)
                {
                    return(new questStatus(Severity.Warning, String.Format("WARNING: {0}.{1}: {2}",
                                                                           this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                           String.Format("Id {0} not found", groupPrivilegeId.Id))));
                }
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }