public async Task <ActionResult> ViewAllVendors() { var vendorsList = new List <VendorViewModel>(); int _companyId = Convert.ToInt32(User.Identity.GetUserId()); if (_companyId > 0) { try { EMSDbContext db = new EMSDbContext(); var vendors = _vendorService.GetAllVendors(_companyId); foreach (var obj in vendors.vendors) { var vendor = new VendorViewModel(); var user = db.Users.Where(x => x.Id == obj.Id).FirstOrDefault(); vendor.FullName = obj.FirstName + " " + obj.LastName; vendor.DateOfBirth = obj.DateOfBirth; vendor.Gender = obj.Gender; vendor.DateOfJoin = obj.DateOfJoin; vendor.DateOfBirth = obj.DateOfBirth; vendor.Email = user.Email; vendor.PhoneNumber = user.PhoneNumber; vendor.VendorType = _vendortypeService.GetVendorTypeById(obj.VendorTypeId).Type; vendorsList.Add(vendor); } } catch (Exception ex) { } } return(View(vendorsList)); }
public async Task <ActionResult> ViewAllCustomers() { EMSDbContext db = new EMSDbContext(); var customersList = new List <CustomerViewModel>(); int _companyId = Convert.ToInt32(User.Identity.GetUserId()); if (_companyId > 0) { try { var customers = _customerService.GetAllCustomers(_companyId); foreach (var obj in customers.customers) { var customer = new CustomerViewModel(); var user = db.Users.Where(x => x.Id == obj.Id).FirstOrDefault(); customer.FullName = obj.FirstName + " " + obj.LastName; customer.DateOfBirth = obj.DateOfBirth; customer.Gender = obj.Gender; customer.Email = user.Email; customer.PhoneNumber = user.PhoneNumber; customersList.Add(customer); } } catch (Exception ex) { } } return(View(customersList)); }
public ActionResult EditEmployeeDocuments(EmployeeDocument employeedocument, HttpPostedFileBase file) { if (ModelState.IsValid) { if (file != null) { string fileName = Path.GetFileNameWithoutExtension(file.FileName); string extension = Path.GetExtension(file.FileName); fileName = fileName + DateTime.Now.ToString("yymmdd") + extension; employeedocument.FilePath = "~/Image/" + fileName; fileName = Path.Combine(Server.MapPath("~/Image/"), fileName); file.SaveAs(Path.Combine(fileName)); employeedocument.FilePath = fileName; } using (EMSDbContext dc = new EMSDbContext()) { dc.Entry(employeedocument).State = EntityState.Modified; dc.SaveChanges(); } ModelState.Clear(); ViewBag.FileStatus = "File edit successfully."; } ViewBag.DocumentTypeId = new SelectList(db.DocumentTypes, "Id", "TypeName", employeedocument.DocumentTypeId); ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeedocument.EmployeeId); return(View(employeedocument)); }
public async Task <ActionResult> ViewAllSchedules() { var schedulesList = new List <ScheduleViewModel>(); int _companyId = Convert.ToInt32(User.Identity.GetUserId()); if (_companyId > 0) { try { EMSDbContext db = new EMSDbContext(); var schedules = _scheduleService.GetAllSchedules(_companyId); foreach (var obj in schedules.schedules) { var schedule = new ScheduleViewModel(); var eventResult = _eventService.GetEventById(schedule.Id); schedule.Date = obj.Date; schedule.StartTime = obj.StartTime; schedule.EndTime = obj.EndTime; schedule.AddressLine = obj.AddressLine; schedule.ZipCode = obj.ZipCode; schedule.City = obj.City; schedule.Province = obj.Province; schedule.Country = obj.Country; schedule.EventDescription = eventResult.Description; schedulesList.Add(schedule); } } catch (Exception ex) { } } return(View(schedulesList)); }
public async Task <ActionResult> ViewAllEmployees() { var employeesList = new List <EmployeeViewModel>(); int _companyId = Convert.ToInt32(User.Identity.GetUserId()); if (_companyId > 0) { try { EMSDbContext db = new EMSDbContext(); var employees = _employeeService.GetAllEmployees(_companyId); foreach (var obj in employees.employees) { var employee = new EmployeeViewModel(); var user = db.Users.Where(x => x.Id == obj.Id).FirstOrDefault(); employee.FullName = obj.FirstName + " " + obj.LastName; employee.DateOfBirth = obj.DateOfBirth; employee.Gender = obj.Gender; employee.MaritalStatus = obj.MaritalStatus; employee.Salary = obj.Salary; employee.DateOfHire = obj.DateOfHire; employee.Email = user.Email; employee.PhoneNumber = user.PhoneNumber; employeesList.Add(employee); } } catch (Exception ex) { } } return(View(employeesList)); }
public UnitOfWork(EMSDbContext context, IPropertyMappingService propertyMappingService) { _context = context ?? throw new ArgumentNullException(nameof(context)); Jobs = new JobRepository(context); JobSkills = new JobSkillRepository(context); Skills = new SkillRepository(context, propertyMappingService); Employees = new EmployeeRepository(context); }
public bool IsUserNameExists(string username) { using (EMSDbContext dc = new EMSDbContext()) { var v = dc.AppUsers.Where(a => a.UserName == username).FirstOrDefault(); return(v != null); } }
public bool IsEmailExists(string emailID) { using (EMSDbContext dc = new EMSDbContext()) { var v = dc.AppUsers.Where(a => a.EmailAddress == emailID).FirstOrDefault(); return(v != null); } }
//For Union public JsonResult GetUnion(int policeStationId) { using (EMSDbContext db = new EMSDbContext()) { db.Configuration.ProxyCreationEnabled = false; List <Union> unions = db.Unions.Where(d => d.PoliceStationId == policeStationId).ToList(); return(Json(unions, JsonRequestBehavior.AllowGet)); } }
//For Upozella public JsonResult GetPolicestation(int districtId) { using (EMSDbContext db = new EMSDbContext()) { db.Configuration.ProxyCreationEnabled = false; List <PoliceStation> upozellas = db.PoliceStations.Where(d => d.DistrictId == districtId).ToList(); return(Json(upozellas, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetDistrict(int divisionId) { using (EMSDbContext db = new EMSDbContext()) { db.Configuration.ProxyCreationEnabled = false; List <District> zillas = db.Districts.Where(d => d.DivisionId == divisionId).ToList(); return(Json(zillas, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetDivision(int countryId) { using (EMSDbContext db = new EMSDbContext()) { db.Configuration.ProxyCreationEnabled = false; List <Division> divisions = db.Divisions.Where(d => d.CountryId == countryId).ToList(); return(Json(divisions, JsonRequestBehavior.AllowGet)); } }
public JsonResult Delete(int?id) { EMSDbContext db = new EMSDbContext(); Country country = db.Countries.Find(id); db.Countries.Remove(country); db.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult GetExam(int educationId) { using (EMSDbContext db = new EMSDbContext()) { db.Configuration.ProxyCreationEnabled = false; List <Exam> exams = db.Exams.Where(e => e.EducationId == educationId).ToList(); return(Json(exams, JsonRequestBehavior.AllowGet)); } }
public static void SeedHostDb(EMSDbContext context) { context.SuppressAutoSetTenantId = true; // Host seed new InitialHostDbBuilder(context).Create(); // Default tenant seed (in host database). new DefaultTenantBuilder(context).Create(); new TenantRoleAndUserBuilder(context, 1).Create(); }
public ActionResult Login(AppUserLogin login, string ReturnUrl = "") { string message = ""; using (EMSDbContext dc = new EMSDbContext()) { var validUser = dc.AppUsers.Where(a => a.UserName == login.UserName).FirstOrDefault(); if (validUser != null) { if (string.Compare(Crypto.Hash(login.Password), validUser.Password) == 0) { int timeout = login.RememberMe ? 525600 : 20; // 525600 min = 1 year var ticket = new FormsAuthenticationTicket(login.UserName, login.RememberMe, timeout); string encrypted = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted); cookie.Expires = DateTime.Now.AddMinutes(timeout); cookie.HttpOnly = true; Response.Cookies.Add(cookie); if (Url.IsLocalUrl(ReturnUrl)) { return(Redirect(ReturnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { message = "Invalid credential provided"; } } else { message = "Invalid credential provided"; } } ViewBag.Message = message; return(View()); }
public BaseDbService() { dba = new EMSDbContext(); }
public DefaultSettingsCreator(EMSDbContext context) { _context = context; }
public DefaultTenantBuilder(EMSDbContext context) { _context = context; }
public InitialHostDbBuilder(EMSDbContext context) { _context = context; }
public DefaultTenantCreator(EMSDbContext context) { _context = context; }
public SkillRepository(EMSDbContext context, IPropertyMappingService propertyMappingService) { _context = context ?? throw new ArgumentNullException(nameof(context)); _propertyMappingService = propertyMappingService ?? throw new ArgumentNullException(nameof(propertyMappingService)); }
public HostRoleAndUserCreator(EMSDbContext context) { _context = context; }
public DefaultLanguagesCreator(EMSDbContext context) { _context = context; }
public EmployeeRepository(EMSDbContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public EmployeeController(EMSDbContext _db) { db = _db; }
public TenantRoleAndUserBuilder(EMSDbContext context, int tenantId) { _context = context; _tenantId = tenantId; }
public DefaultEditionCreator(EMSDbContext context) { _context = context; }
public EMSUoW(string conStr) { this._context = new EMSDbContext(); }