示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
 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));
 }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
 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);
 }
示例#7
0
 public bool IsUserNameExists(string username)
 {
     using (EMSDbContext dc = new EMSDbContext())
     {
         var v = dc.AppUsers.Where(a => a.UserName == username).FirstOrDefault();
         return(v != null);
     }
 }
示例#8
0
 public bool IsEmailExists(string emailID)
 {
     using (EMSDbContext dc = new EMSDbContext())
     {
         var v = dc.AppUsers.Where(a => a.EmailAddress == emailID).FirstOrDefault();
         return(v != null);
     }
 }
示例#9
0
 //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));
     }
 }
示例#10
0
 //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));
     }
 }
示例#11
0
 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));
     }
 }
示例#12
0
 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));
     }
 }
示例#13
0
        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));
        }
示例#14
0
 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));
     }
 }
示例#15
0
        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();
        }
示例#16
0
        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());
        }
示例#17
0
 public BaseDbService()
 {
     dba = new EMSDbContext();
 }
示例#18
0
 public DefaultSettingsCreator(EMSDbContext context)
 {
     _context = context;
 }
示例#19
0
 public DefaultTenantBuilder(EMSDbContext context)
 {
     _context = context;
 }
示例#20
0
 public InitialHostDbBuilder(EMSDbContext context)
 {
     _context = context;
 }
示例#21
0
 public DefaultTenantCreator(EMSDbContext context)
 {
     _context = context;
 }
示例#22
0
 public SkillRepository(EMSDbContext context, IPropertyMappingService propertyMappingService)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _propertyMappingService = propertyMappingService
                               ?? throw new ArgumentNullException(nameof(propertyMappingService));
 }
示例#23
0
 public HostRoleAndUserCreator(EMSDbContext context)
 {
     _context = context;
 }
示例#24
0
 public DefaultLanguagesCreator(EMSDbContext context)
 {
     _context = context;
 }
 public EmployeeRepository(EMSDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
示例#26
0
 public EmployeeController(EMSDbContext _db)
 {
     db = _db;
 }
示例#27
0
 public TenantRoleAndUserBuilder(EMSDbContext context, int tenantId)
 {
     _context  = context;
     _tenantId = tenantId;
 }
示例#28
0
 public DefaultEditionCreator(EMSDbContext context)
 {
     _context = context;
 }
示例#29
0
 public EMSUoW(string conStr)
 {
     this._context = new EMSDbContext();
 }