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; } }
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; } }
public AdminManager() { repo = new AdminRepository(); }
public admin GetAdminByPersonId(int personid) { IAdminRepository repo = new AdminRepository(); return(repo.GetAdminByUserId(personid)); }
public static void AddDetails(Admin admin) { AdminRepository.AddDetails(admin); }
public void SetUp() { _repo = new AdminRepository(new EmartDBContext()); }
public IEnumerable <RoomModel> GetRoomsByAdminId(int id) { AdminRepository cr = new AdminRepository(); return(cr.GetRoomsByAdminId(id).ToList().Select(c => _adminFactory.Create(c))); }
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)); }
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(); }
public AccountController() { accountRepository = new AccountRepository(); adminRepository = new AdminRepository(); }
public AdminController(AdminRepository adminRepository) { this.adminRepository = adminRepository; }
public IEnumerable <RoomModel> GetAllRooms(string HotelName) { AdminRepository cr = new AdminRepository(); return(cr.GetAllRoomsByHotelName(HotelName).ToList().Select(c => _adminFactory.Create(c))); }
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")); }
public List <Admin> Get() { AdminRepository adminRepository = new AdminRepository(); return(adminRepository.GetAll()); }
public AdminHandler(AdminRepository repository) { _repository = repository; }
public Admin Get(int Id) { AdminRepository adminRepository = new AdminRepository(); return(adminRepository.Get(Id)); }
public AdminsController(AdminRepository adminRepository) { _adminRepository = adminRepository; }
public bool Put(Admin a) { AdminRepository adminRepository = new AdminRepository(); return(adminRepository.Put(a)); }
public static void GetDetails() { AdminRepository.GetDetails(); }
public bool Delete(int Id) { AdminRepository adminRepository = new AdminRepository(); return(adminRepository.Delete(Id)); }
public void CreateAdmin(admin objAdmin) { IAdminRepository repo = new AdminRepository(); repo.CreateAdmin(objAdmin); }
public AccountController() { adminRepository = ClassInstance <AdminRepository> .Instance; }
public admin GetAdminByUserId(int userid) { IAdminRepository repo = new AdminRepository(); return(repo.GetAdminByUserId(userid)); }
public AdminUsersController(AdminUsersService service, AdminRepository repo, IServiceProvider sp) : base(sp) { _service = service; _repo = repo; }
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); }
public AdminService(AdminRepository adminRepository) { this.adminRepository = adminRepository; }
public AdminService() { repo = new AdminRepository(); }
public MovieController(MovieRepository movieRepository, AdminRepository adminRepository) { _movieRepository = movieRepository; _adminRepository = adminRepository; }
///<summary> ///Associates the repo and the mapper. ///</summary> public ReportingLogic(AdminRepository _repo, Mapper _mapper) { this._repo = _repo; this._mapper = _mapper; }
private List <AdminModel> GetAdmins() { AdminRepository _adminRepository = new AdminRepository(); return(_adminRepository.GetAdmins()); }