Exemple #1
0
 public override IEnumerable <SystemRole> Get(Dictionary <string, object> whereConditions, int limit = 25, string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
 {
     throw new NotImplementedException();
 }
Exemple #2
0
 public override IEnumerable <SystemRole> Get(System.Linq.Expressions.Expression <Func <SystemRole, bool> > predicate, string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
        public override bool Delete(SystemRole dataObject, string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
        {
            bool status = false;

            if (dataObject == null)
            {
                return(status);
            }

            //
            // Existence check
            var role = _allSystemRoles.Find(item => item.Id == dataObject.Id);

            //
            // In case the dataObject's Id was modified!
            if (role == null)
            {
                role = _allSystemRoles.Find(item => item.RoleId == dataObject.RoleId && item.SipAccount == dataObject.SipAccount && item.SiteId == dataObject.SiteId);
            }

            //
            // Only perform update if the role object is not null
            if (role != null)
            {
                try
                {
                    status = base.Delete(dataObject, dataSourceName, dataSourceType);

                    if (status == true)
                    {
                        lock (_allSystemRoles)
                        {
                            _allSystemRoles.Remove(role);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex.InnerException;
                }
            }

            return(status);
        }
Exemple #4
0
        public override int Insert(SystemRole dataObject, string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
        {
            //
            // Null check
            if (dataObject == null)
            {
                return(-1);
            }

            //
            // Containment and existence checks
            var isContained = _allSystemRoles.Contains(dataObject);

            var itExists = _allSystemRoles.Exists(
                item =>
                item.RoleId == dataObject.RoleId &&
                item.SiteId == dataObject.SiteId &&
                item.SipAccount == dataObject.SipAccount);

            if (isContained || itExists)
            {
                return(-1);
            }

            //
            // Inserting process
            try
            {
                dataObject.Id = base.Insert(dataObject, dataSourceName, dataSourceType);

                lock (_allSystemRoles)
                {
                    _allSystemRoles.Add(dataObject);
                }
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }

            return(dataObject.Id);
        }
Exemple #5
0
 public override IEnumerable <SystemRole> GetAll(string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
 {
     return(_allSystemRoles);
 }
Exemple #6
0
 public override SystemRole GetById(long id, string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
 {
     return(_allSystemRoles.Find(role => role.Id == id));
 }
Exemple #7
0
 public override IEnumerable <DelegateRole> GetAll(string dataSourceName = null, CCC.ORM.Globals.DataSource.Type dataSourceType = CCC.ORM.Globals.DataSource.Type.Default)
 {
     try
     {
         return((new List <DelegateRole>())
                .GetWithRelations(
                    item => item.DelegeeAccount,
                    item => item.ManagedUser,
                    item => item.ManagedSiteDepartment,
                    item => item.ManagedSite)
                .IncludeSiteDepartments());
     }
     catch (Exception ex)
     {
         throw ex.InnerException;
     }
 }