Exemplo n.º 1
0
        public ActionResult GetCompanyId(int id)
        {
            var company          = _company.GetCompanyById(id);
            var serializeCompany = CompanyMapper.SerializeCompany(company);

            return(PartialView(serializeCompany));
        }
Exemplo n.º 2
0
        public IActionResult Edit(int id)
        {
            Company company = _company.GetCompanyById(id);

            if (company != null)
            {
                return(View(company));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task<PartialViewResult> EditCompany(int companyId)
        {
            ViewBag.CurrencyList = await _currency.GetCurrencySelectList();

            CompanyModel companyModel = await _company.GetCompanyById(companyId);

            return PartialView("_AddCompany", companyModel);
        }
Exemplo n.º 4
0
        // Company controller part

        public IActionResult Company(int id)
        {
            IndexVM CompanyInfoVM = new IndexVM
            {
                CompanyId = id,
                Company   = _companyService.GetCompanyById(id)
            };

            return(View("Index", CompanyInfoVM));
        }
Exemplo n.º 5
0
        public ActionResult GetEmployees()
        {
            var employee      = _employee.GetEmployees();
            var employeeModel = employee.Select(x => new employeeViewModel
            {
                Id          = x.Id,
                Code        = x.Code,
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                MCompany    = CompanyMapper.SerializeCompany(_company.GetCompanyById(x.MCompany.Id)),
                Email       = x.Email,
                IsDelete    = x.IsDelete,
                CreatedBy   = x.CreatedBy,
                CreatedDate = x.CreatedDate,
                UpdatedBy   = x.UpdatedBy,
                UpdatedDate = x.UpdatedDate
            }).ToList();
            var employes = new employeeIndex
            {
                employees = employeeModel
            };

            return(PartialView(employes));
        }
Exemplo n.º 6
0
        public IActionResult GetCompanyById([FromBody] CompanyInfoModel model)
        {
            var company = _company.GetCompanyById(model.CompanyId);

            if (company == null)
            {
                return(BadRequest());
            }

            company.AddressCompany = _address.GetAddressByCompanyId(company.CompanyId);
            company.ContactCompany = _contactCompany.GetContactCompanyByCompanyId(company.CompanyId);
            company.Promoter       = _companyPromotor.GetCompanyPromoterByCompanyId(company.CompanyId);

            return(Ok(company));
        }
        public IHttpActionResult CheckIn(AttendanceEntryModel model)
        {
            var attendanceFeed = _attendance.GetAttendanceFeed(model.CompanyId.Value, DateTime.UtcNow).ToList();

            if (attendanceFeed.Any(x => x.UserId == model.UserId && x.IsCheckedIn))
            {
                return(Ok(new ResponseModel {
                    Message = "Already checked-in."
                }));
            }

            var companyModel = _company.GetCompanyById(model.CompanyId.Value);

            if (companyModel != null && !string.IsNullOrEmpty(companyModel.MaximumOfficeHours))
            {
                var maxOfficeHourList = companyModel.MaximumOfficeHours.Split(':');
                model.OfficeHour = (Convert.ToInt32(maxOfficeHourList[0]) * 60) + Convert.ToInt32(maxOfficeHourList[1]);
            }

            if (companyModel != null && !string.IsNullOrEmpty(companyModel.OfficeOutTime))
            {
                var outTimeList = companyModel.OfficeOutTime.Split(':');
                model.AllowOfficeLessTime = (Convert.ToInt32(outTimeList[0]) * 60) + Convert.ToInt32(outTimeList[1]);
            }

            var response = _attendance.CheckIn(model);

            if (response.Success)
            {
                _attendance.SaveCheckPoint(new UserMovementLogModel {
                    UserId          = model.UserId,
                    CompanyId       = model.CompanyId,
                    Latitude        = model.Latitude,
                    Longitude       = model.Longitude,
                    LogLocation     = model.LogLocation,
                    DeviceName      = model.DeviceName,
                    DeviceOSVersion = model.DeviceOSVersion,
                    IsCheckInPoint  = true
                });
            }
            return(Ok(response));
        }
        public IActionResult Create(CreateEmploymentViewModel model)
        {
            if (ModelState.IsValid)
            {
                var company = _company.GetCompanyById(model.CompanyId);

                var student = _empReop.GetStudent(model.StudentId);

                if (company != null && student != null)
                {
                    _employment.AddEmployment(model);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Please, make sure company and student exist");
                }
            }
            return(View(model));
        }