public string UpdateAdminSetting(string ObjADmin)
 {
     try
     {
         AdminRepository ObjAdminRepo = new AdminRepository();
         Domain.Myfashion.Domain.Admin objadmin = (Domain.Myfashion.Domain.Admin)(new JavaScriptSerializer().Deserialize(ObjADmin, typeof(Domain.Myfashion.Domain.Admin)));
         AdminRepository.Update(objadmin);
         return new JavaScriptSerializer().Serialize("Setting Updated Successfully");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return null;
     }
 }
Пример #2
0
 public static List<EntityMenuModel> GetMenus()
 {
     List<EntityMenuModel> menus = null;
     if (Authentication.CurrentEntity != null) {
         string key = string.Format(ENTITYMENUKEY, Authentication.CurrentEntity.EntityID);
         ICacheManager cacheManager = new MemoryCacheManager();
         menus = cacheManager.Get(key, () => {
             IAdminRepository adminRepository = new AdminRepository();
             return adminRepository.GetAllEntityMenus();
         });
     } else {
         menus = new List<EntityMenuModel>();
     }
     return menus;
 }
 public string Login(string UserName, string Password)
 {
     try
     {
         AdminRepository AdminRepo = new AdminRepository();
         Domain.Myfashion.Domain.Admin Admin = AdminRepo.GetUserInfo(UserName, Password);
         if (Admin != null)
         {
             return new JavaScriptSerializer().Serialize(Admin);
         }
         else
         {
             return new JavaScriptSerializer().Serialize("Not Exist");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return null;
     }
 }
 public string ChangeAdminPassword(string NewPassword,string OldPassword, string UserName)
 {
     try
     {
         AdminRepository AdminRepo = new AdminRepository();
         int i = AdminRepo.ChangePassword(NewPassword, OldPassword,UserName);
         if (i != 0)
         {
             return new JavaScriptSerializer().Serialize("Password Changed Successfully");
         }
         else
         {
             return new JavaScriptSerializer().Serialize("Not Exist");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return null;
     }
 }
Пример #5
0
 public AdminManager()
 {
     repo = new AdminRepository();
 }
Пример #6
0
        public admin GetAdminByPersonId(int personid)
        {
            IAdminRepository repo = new AdminRepository();

            return(repo.GetAdminByUserId(personid));
        }
Пример #7
0
 public static void AddDetails(Admin admin)
 {
     AdminRepository.AddDetails(admin);
 }
Пример #8
0
 public void SetUp()
 {
     _repo = new AdminRepository(new EmartDBContext());
 }
Пример #9
0
        public IEnumerable <RoomModel> GetRoomsByAdminId(int id)
        {
            AdminRepository cr = new AdminRepository();

            return(cr.GetRoomsByAdminId(id).ToList().Select(c => _adminFactory.Create(c)));
        }
Пример #10
0
 public AdminController()
 {
     _adminService = new AdminService(ConnectionString.DB);
     _adminRepo    = new AdminRepository(ConnectionString.DB);
 }
 public static bool PostJob(PostedJobs postjob)
 {
     return(AdminRepository.PostJob(postjob));
 }
 public static bool AddCategory(Category category)
 {
     return(AdminRepository.AddCategory(category));
 }
 public static int GetID(string Email)
 {
     return(AdminRepository.GetID(Email));
 }
Пример #14
0
        public void Initialize()
        {
            IrcClient.Connect(Settings.Host, Settings.Port);
            LogInformation(string.Format("IrcBot Connecting to {0}:{1}", Settings.Host, Settings.Port));

            if (IrcClient.IsConnected)
                IrcClient.Login(Settings.BotName, Settings.RealBotName);

            foreach (string channel in Settings.Channels)
            {
                string channelname = MakeValidChannel(channel);
                LogInformation(string.Format("Joining {0}", channelname));
                IrcClient.RfcJoin(channelname);
            }

            PluginManager = new PluginManager(string.Format("{0}{1}", FilePath, Settings.PluginFolder), this);
            PluginManager.LoadPluginsBlind();

            foreach (BotPlugin plugin in PluginManager.Plugins)
                plugin.LoadCommands();

            AdminUserRepository = new AdminRepository(Settings.AdminPass, FilePath);
            AdminUserRepository.LoadAdmins();
            SendMessageToAdmins("IrcBot is online and you are admin.");

            IrcClient.Listen();
        }
Пример #15
0
 public AccountController()
 {
     accountRepository = new AccountRepository();
     adminRepository   = new AdminRepository();
 }
Пример #16
0
 public AdminController(AdminRepository adminRepository)
 {
     this.adminRepository = adminRepository;
 }
Пример #17
0
        public IEnumerable <RoomModel> GetAllRooms(string HotelName)
        {
            AdminRepository cr = new AdminRepository();

            return(cr.GetAllRoomsByHotelName(HotelName).ToList().Select(c => _adminFactory.Create(c)));
        }
Пример #18
0
        public async Task <IActionResult> EditRightsOfPermission(RightsForPermissionDTO model)
        {
            var roleManager        = _serviceProvider.GetRequiredService <RoleManager <ApplicationRole> >();
            var permissionRights   = new List <AssignRightsToPermission>();
            var permissionRightIDs = new List <string>();

            foreach (var right in model.RightsWithIsAssigned)
            {
                if (right.IsAssigned)
                {
                    permissionRightIDs.Add(right.ID.ToString());
                }
            }

            var modelToList = new List <RightsForPermissionDTO> {
                model
            };

            permissionRights = modelToList.GroupBy(x => new { x.PermissionID }).Select(y =>
                                                                                       new AssignRightsToPermission {
                PermissionID = y.Key.PermissionID,
                RightIDs     = string.Join(",", permissionRightIDs)
            }).ToList();
            AdminRepository.AssignRightsToPermission(permissionRights);

            // Get all roles affected by permissions change
            var rolesHavingPermission = AdminRepository.GetRolesHavingPermission(model.PermissionID);

            // Get all RightIDs
            var allRightIDs = AdminRepository.GetAllRightIDs();

            // Foreach role with Permission model.PermissionID
            foreach (var roleItem in rolesHavingPermission)
            {
                var assignRightsToRole = new AssignRightsToRole {
                    RoleID = roleItem.ID, RightIDs = string.Join(",", permissionRightIDs)
                };
                var applicationRoleItem = new ApplicationRole(roleItem.Name, roleItem.ID);

                var listAssignRightsToRole = new List <AssignRightsToRole> {
                    assignRightsToRole
                };
                // Update RoleRights Table - Delete all values where Role ID is RoleID and Insert RoleRights model
                AdminRepository.AssignRightsToRole(listAssignRightsToRole);

                // Get Application Role
                var applicationRole = roleManager.FindByNameAsync(roleItem.Name).Result;

                // Modify Identity Table AspNetRoleClaims
                foreach (var rightID in allRightIDs)
                {
                    if (permissionRightIDs.Contains(rightID))
                    {
                        await roleManager.AddClaimAsync(applicationRole, new Claim(AdminRepository.GetRightNameByRightID(int.Parse(rightID)), "True"));
                    }
                    else
                    {
                        await roleManager.RemoveClaimAsync(applicationRole, new Claim(AdminRepository.GetRightNameByRightID(int.Parse(rightID)), "True"));
                    }
                }
            }
            await HttpContext.RefreshLoginAsync();

            return(RedirectToAction("Index"));
        }
Пример #19
0
        public List <Admin> Get()
        {
            AdminRepository adminRepository = new AdminRepository();

            return(adminRepository.GetAll());
        }
 public AdminHandler(AdminRepository repository)
 {
     _repository = repository;
 }
Пример #21
0
        public Admin Get(int Id)
        {
            AdminRepository adminRepository = new AdminRepository();

            return(adminRepository.Get(Id));
        }
Пример #22
0
 public AdminsController(AdminRepository adminRepository)
 {
     _adminRepository = adminRepository;
 }
Пример #23
0
        public bool Put(Admin a)
        {
            AdminRepository adminRepository = new AdminRepository();

            return(adminRepository.Put(a));
        }
Пример #24
0
 public static void GetDetails()
 {
     AdminRepository.GetDetails();
 }
Пример #25
0
        public bool Delete(int Id)
        {
            AdminRepository adminRepository = new AdminRepository();

            return(adminRepository.Delete(Id));
        }
Пример #26
0
        public void CreateAdmin(admin objAdmin)
        {
            IAdminRepository repo = new AdminRepository();

            repo.CreateAdmin(objAdmin);
        }
Пример #27
0
 public AccountController()
 {
     adminRepository = ClassInstance <AdminRepository> .Instance;
 }
Пример #28
0
        public admin GetAdminByUserId(int userid)
        {
            IAdminRepository repo = new AdminRepository();

            return(repo.GetAdminByUserId(userid));
        }
Пример #29
0
 public AdminUsersController(AdminUsersService service, AdminRepository repo, IServiceProvider sp) : base(sp)
 {
     _service = service;
     _repo    = repo;
 }
Пример #30
0
        public async Task When_getting_an_admin_identity_with_a_valid_parent_email_should_return_an_admin_identity()
        {
            // Arrange
            // Supplied Data: Setting up our baseline of supplied data.

            var suppliedStaff = new List <Staff>();
            var suppliedStaffElectronicEmail = new List <StaffElectronicMail>();

            string suppliedEmail   = "*****@*****.**";
            var    suppliedParents = new List <Parent>
            {
                new Parent {
                    ParentUsi = 1, ParentUniqueId = "S1", FirstName = "Parent", LastSurname = "Perez"
                },
                new Parent {
                    ParentUsi = 99, ParentUniqueId = "S99", FirstName = "Should be filtered out", LastSurname = "X"
                },
            };

            var suppliedParentElectronicEmail = new List <ParentElectronicMail>
            {
                new ParentElectronicMail {
                    ParentUsi = 1, ElectronicMailAddress = suppliedEmail
                },
                new ParentElectronicMail {
                    ParentUsi = 99, ElectronicMailAddress = "*****@*****.**"
                }
            };

            var suppliedAdmins = new List <Admin>
            {
                new Admin {
                    ElectronicMailAddress = suppliedEmail
                },
                new Admin {
                    ElectronicMailAddress = "*****@*****.**"
                }
            };

            var dbContextMock = new Mock <IEdFi31Context>();

            dbContextMock.Setup(p => p.Staffs).Returns(DbContextMockingHelper.GetAsyncQueryableDbSetMock(suppliedStaff));
            dbContextMock.Setup(p => p.StaffElectronicMails).Returns(DbContextMockingHelper.GetAsyncQueryableDbSetMock(suppliedStaffElectronicEmail));

            dbContextMock.Setup(p => p.Parents).Returns(DbContextMockingHelper.GetAsyncQueryableDbSetMock(suppliedParents));
            dbContextMock.Setup(p => p.ParentElectronicMails).Returns(DbContextMockingHelper.GetAsyncQueryableDbSetMock(suppliedParentElectronicEmail));

            dbContextMock.Setup(p => p.Admins).Returns(DbContextMockingHelper.GetAsyncQueryableDbSetMock(suppliedAdmins));

            var edFiContextMock = dbContextMock.Object;

            // Act
            var repoUnderTest = new AdminRepository(edFiContextMock);
            var actualResult  = await repoUnderTest.GetAdminIdentityByEmailAsync(suppliedEmail);

            // Assert
            Assert.IsNotNull(actualResult);
            Assert.AreEqual(1, actualResult.Count);

            var expectedParent = suppliedParents.Single(x => x.ParentUsi == 1);
            var actualParent   = actualResult.Single();

            Assert.AreEqual(expectedParent.ParentUsi, actualParent.Usi);
            Assert.AreEqual(expectedParent.ParentUniqueId, actualParent.UniqueId);
            Assert.AreEqual(expectedParent.FirstName, actualParent.FirstName);
            Assert.AreEqual(expectedParent.LastSurname, actualParent.LastSurname);
            Assert.AreEqual(ChatLogPersonTypeEnum.Parent.Value, actualParent.PersonTypeId);
            Assert.AreEqual(suppliedEmail, actualParent.Email);
        }
Пример #31
0
 public AdminService(AdminRepository adminRepository)
 {
     this.adminRepository = adminRepository;
 }
Пример #32
0
 public AdminService()
 {
     repo = new AdminRepository();
 }
Пример #33
0
 public MovieController(MovieRepository movieRepository, AdminRepository adminRepository)
 {
     _movieRepository = movieRepository;
     _adminRepository = adminRepository;
 }
Пример #34
0
 ///<summary>
 ///Associates the repo and the mapper.
 ///</summary>
 public ReportingLogic(AdminRepository _repo, Mapper _mapper)
 {
     this._repo   = _repo;
     this._mapper = _mapper;
 }
Пример #35
0
        private List <AdminModel> GetAdmins()
        {
            AdminRepository _adminRepository = new AdminRepository();

            return(_adminRepository.GetAdmins());
        }