public AccountsController(IMapper mapper, ApplicationDbContext context, ApplicationUserService applicationUserService, ApplicationRoleService applicationRoleService) { _mapper = mapper; _context = context; _applicationUserService = applicationUserService; _applicationRoleService = applicationRoleService; }
public AdministrationController() { _organizationHelper = new OrganizationHelper(); _userService = new UserService(); _genericService = new GenericService(); _applicationRoleService = new ApplicationRoleService(); _shiftManagemetHelper = new ShiftManagemetHelper(); }
//public readonly VisitorDetailsReportHelper _visitorDetailsReportHelper = null; public ReportController() { _userService = new UserService(); _visitorDetailsReportHelper = new VisitorDetailsReportHelper(); _applicationRoleService = new ApplicationRoleService(); _genericService = new GenericService(); _ShiftDetailsReportHelper = new ShiftDetailsReportHelper(); }
public async Task <ActionResult> Index() { var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); var _userService = new UserService(); var _applicationRole = new ApplicationRoleService(); var user = await _userService.GetAsync(x => x.Id == userId); var roleType = RoleType.SuperAdmin; var roleID = user.Roles.FirstOrDefault().RoleId; var role = await _applicationRole.FindByIdAsync(roleID); switch (role.Name) { case "SuperAdmin": roleType = RoleType.SuperAdmin; break; case "Supervisor": roleType = RoleType.SuperVisor; break; case "Security": roleType = RoleType.Security; break; case "BuildingAdmin": roleType = RoleType.BuildingAdmin; break; default: break; } var userSessionData = new UserSessionDataVM { ThemeName = (string.IsNullOrEmpty(user.ThemeName) ? "theme1" : user.ThemeName), ImageLogoPath = (user.Organization == null ? "~\\images\\logo\\main_logo.png" : (string.IsNullOrEmpty(user.Organization.ImagePath) ? "~\\images\\logo\\main_logo.png" : user.Organization.ImagePath)), UserRole = roleType, ProfilePicPath = user.ProfilePicturePath, FullName = user.FullName, IsImageAvailable = System.IO.File.Exists(Server.MapPath("\\") + "" + (!string.IsNullOrEmpty(user.ProfilePicturePath)? user.ProfilePicturePath.Replace("/", "\\"):Server.MapPath("~/images/avatar.jpg"))) //user.ProfilePicturePath.Replace("/", "\\")) }; Session["UserSession"] = userSessionData; return(View()); // IsImageAvailable = System.IO.File.Exists( Server.MapPath("\\") + "" + user.ProfilePicturePath.Replace("/", "\\")) }
public void Setup() { SetUpContextOptions(); SetUpJwtOptions(); SetUpServices(); SetUpMapper(); SetUpLogger(); SetUpContext(); Service = new ApplicationRoleService(Mapper, Context, Logger); }
// // GET: /Dashboard/ public async Task <ActionResult> _Dashboard() { //ShiftManagemetHelper obj = new ShiftManagemetHelper(); ////DateTime dd = DateTime.Now; ////var a = DateTime.DaysInMonth(dd.Year, dd.Month); //var q = obj.GetHeaders(DateTime.Now.AddDays(-12), DateTime.Now); //var test = obj.GetShiftData(DateTime.Now.AddDays(-12), DateTime.Now, 1, 23); var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); var _userService = new UserService(); var _applicationRole = new ApplicationRoleService(); var user = await _userService.GetAsync(x => x.Id == userId); int BuldingCount = 0; int GatesCount = 0; int CheckInCount = 0; int VisitorCount = 0; if (user.OrganizationId != null) { CheckInCount = _genericService.VisitDetails.GetAll().Where(x => (EntityFunctions.TruncateTime(x.CheckIn) == EntityFunctions.TruncateTime(DateTime.Now) && x.CheckOut == null) && x.GateMaster.BuildingMaster.OrganizationId == user.OrganizationId).Count(); VisitorCount = _genericService.VisitDetails.GetAll().Where(x => (EntityFunctions.TruncateTime(x.CheckIn) == EntityFunctions.TruncateTime(DateTime.Now)) && x.GateMaster.BuildingMaster.OrganizationId == user.OrganizationId).Count(); BuldingCount = _genericService.BuildingMaster.GetAll().Where(x => x.IsActive && x.OrganizationId == user.OrganizationId).Count(); GatesCount = _genericService.GateMaster.GetAll().Where(x => x.IsActive && x.BuildingMaster.OrganizationId == user.OrganizationId).Count(); } else { CheckInCount = _genericService.VisitDetails.GetAll().Where(x => (EntityFunctions.TruncateTime(x.CheckIn) == EntityFunctions.TruncateTime(DateTime.Now) && x.CheckOut == null)).Count(); VisitorCount = _genericService.VisitDetails.GetAll().Where(x => (EntityFunctions.TruncateTime(x.CheckIn) == EntityFunctions.TruncateTime(DateTime.Now))).Count(); BuldingCount = _genericService.BuildingMaster.GetAll().Where(x => x.IsActive).Count(); GatesCount = _genericService.GateMaster.GetAll().Where(x => x.IsActive).Count(); } var DashboardData = new DashboardVM { CheckInCount = CheckInCount, VisitorsCount = VisitorCount, BuldingCount = BuldingCount, GatesCount = GatesCount }; Session["DashboardData"] = DashboardData; return(View()); }
public async Task <VisitorDataVM> GetVisitorCheckInHistory(long visitorId)//, int pageIndex, int pageSize, string sortField = "", string sortOrder = "ASC") { var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); var visitorDataVMData = _visitorCheckInCheckOutHelper.GetVisitorCheckInHistory(visitorId, userId); if (visitorDataVMData != null) { var _userService = new UserService(); var _applicationRole = new ApplicationRoleService(); var user = await _userService.GetAsync(x => x.Id == userId); var roleID = user.Roles.FirstOrDefault().RoleId; var role = await _applicationRole.FindByIdAsync(roleID); if (role.Name == "Security") { visitorDataVMData.IsSecurityPerson = true; } } return(visitorDataVMData); }
public ApplicationRoleController(ApplicationRoleService applicationRoleService) { this.ApplicationRoleService = applicationRoleService; }