Ejemplo n.º 1
0
        public bool SetRoleFeatures(int roleID, IEnumerable <RoleFeature> roleFeatures)
        {
            RoleLibrary lib = new RoleLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());

            List <RoleFeature> updatedFeatures = new List <RoleFeature>();
            List <RoleFeature> deletedFeatures = new List <RoleFeature>();

            foreach (RoleFeature roleFeature in roleFeatures)
            {
                if (!roleFeature.ViewAccessInd && !roleFeature.EditAccessInd && !roleFeature.DeleteAccessInd && !roleFeature.NewAccessInd)
                {
                    deletedFeatures.Add(roleFeature);
                }
                else
                {
                    updatedFeatures.Add(roleFeature);
                }
            }
            bool delRetVal    = lib.DeleteRoleFeatures(roleID, deletedFeatures);
            bool updateRetVal = lib.SetRoleFeatures(roleID, updatedFeatures);

            return(delRetVal && updateRetVal);
        }
Ejemplo n.º 2
0
        public IEnumerable <RoleFeature> GetRoleFeatures(int roleID)
        {
            RoleLibrary lib = new RoleLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());

            return(lib.GetRoleFeatures(roleID));
        }
Ejemplo n.º 3
0
        public IEnumerable <Role> GetRoles()
        {
            RoleLibrary lib = new RoleLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());

            return(lib.GetAll());
        }