public List <Doctor> getAllFreeDoctors(BusinessHoursModel businessHours) { List <Doctor> freeDoctors = new List <Doctor>(); foreach (Doctor doctor in FindAll()) { if (doctor.BusinessHours is null) { doctor.BusinessHours = new BusinessHoursModel(); doctor.BusinessHours.FromDate = DateTime.Today; doctor.BusinessHours.ToDate = DateTime.Today; doctor.BusinessHours.FromHour = DateTime.Today; doctor.BusinessHours.ToHour = DateTime.Today; } // Check for range of doctor business hours if (businessHours.FromDate > doctor.BusinessHours.FromDate && businessHours.FromDate < doctor.BusinessHours.ToDate) { continue; } if (businessHours.ToDate > doctor.BusinessHours.FromDate && businessHours.ToDate < doctor.BusinessHours.ToDate) { continue; } // doctor.BusinessHours.FromDate - doctor.BusinessHours.ToDate // businessHours.FromDate - businessHours.ToDate freeDoctors.Add(doctor); } return(freeDoctors); }
public List <Secretary> getAllFreeSecretaries(BusinessHoursModel businessHours) { List <Secretary> freeSecretaries = new List <Secretary>(); foreach (Secretary secretary in FindAll()) { if (secretary.BusinessHours is null) { secretary.BusinessHours = new BusinessHoursModel(); secretary.BusinessHours.FromDate = DateTime.Today; secretary.BusinessHours.ToDate = DateTime.Today; secretary.BusinessHours.FromHour = DateTime.Today; secretary.BusinessHours.ToHour = DateTime.Today; } // Check for range of doctor business hours if (businessHours.FromDate > secretary.BusinessHours.FromDate && businessHours.FromDate < secretary.BusinessHours.ToDate) { continue; } if (businessHours.ToDate > secretary.BusinessHours.FromDate && businessHours.ToDate < secretary.BusinessHours.ToDate) { continue; } // doctor.BusinessHours.FromDate - doctor.BusinessHours.ToDate // businessHours.FromDate - businessHours.ToDate freeSecretaries.Add(secretary); } return(freeSecretaries); }
public List <Employee> getAllFreeEmployees(BusinessHoursModel businessHours) { List <Employee> freeEmployees = new List <Employee>(); freeEmployees.AddRange(doctorRepository.getAllFreeDoctors(businessHours)); freeEmployees.AddRange(secretaryRepository.getAllFreeSecretaries(businessHours)); return(freeEmployees); }
public void setBusinessHoursForEmployees(List <Employee> employees, BusinessHoursModel businessHours) { List <Secretary> secretaries; List <Doctor> doctors; parseEmployeesToDctorsAndSecretaries(employees, out secretaries, out doctors); doctorRepository.SetDoctorsBusinessHours(doctors, businessHours); secretaryRepository.SetSecretarysBusinessHours(secretaries, businessHours); }
// GET: BusinessHours public ActionResult Add() { BusinessHoursModel businessHoursModel = new BusinessHoursModel() { ListofDays = Dayslist(), ListofHour = Hourlist(), ListofPeriod = Periodslist(), SelectedDays = new List <string>(), ListofBusinessHoursType = _businessHours.ListofBusinessHoursType() }; return(View(businessHoursModel)); }
public List <Employee> getAllFreeEmployees(BusinessHoursModel businessHours) { List <Employee> allEmployees = (List <Employee>)FindAll(); List <Employee> freeEmployees = new List <Employee>(); foreach (Employee tempEmployee in allEmployees) { /* * If businessHours is range 20.04 - 25.04 * and my ToDate is 19.04, a im free at businessHours range */ if (tempEmployee.BusinessHours.ToDate < businessHours.FromDate) { freeEmployees.Add(tempEmployee); } } return(freeEmployees); }
public void SetDoctorsBusinessHours(List <Doctor> doctors, BusinessHoursModel businessHours) { List <Doctor> allDoctors = (List <Doctor>)FindAll(); foreach (Doctor tempEntityForChange in doctors) { foreach (Employee employee in allDoctors) { if (tempEntityForChange.Id.Equals(employee.Id)) { employee.BusinessHours = new BusinessHoursModel(); employee.BusinessHours.FromDate = businessHours.FromDate; employee.BusinessHours.ToDate = businessHours.ToDate; employee.BusinessHours.FromHour = businessHours.FromHour; employee.BusinessHours.ToHour = businessHours.ToHour; break; } } } // I want immediately to save changes SaveAll(allDoctors); }
public void SetSecretarysBusinessHours(List <Secretary> secretaries, BusinessHoursModel businessHours) { List <Secretary> allSecretaries = (List <Secretary>)FindAll(); foreach (Secretary tempEntityForChange in secretaries) { foreach (Employee employee in allSecretaries) { if (tempEntityForChange.Username.Equals(employee.Username)) { employee.BusinessHours = new BusinessHoursModel(); employee.BusinessHours.FromDate = businessHours.FromDate; employee.BusinessHours.ToDate = businessHours.ToDate; employee.BusinessHours.FromHour = businessHours.FromHour; employee.BusinessHours.ToHour = businessHours.ToHour; break; } } } // I want immediately to save changes SaveAll(allSecretaries); }
public List <Doctor> getAllFreeDoctors(BusinessHoursModel businessHours) { throw new NotImplementedException(); }
public void SetDoctorsBusinessHours(List <Doctor> doctors, BusinessHoursModel businessHours) { throw new NotImplementedException(); }
public void SetSecretarysBusinessHours(List <Secretary> doctors, BusinessHoursModel businessHours) { throw new NotImplementedException(); }
public List <Doctor> FindMatchedDoctors(BusinessHoursModel bussinesHours) { throw new NotImplementedException(); }
public List <Employee> getAllFreeEmployees(BusinessHoursModel businessHours) { return(employeeService.getAllFreeEmployees(businessHours)); }
public List <Secretary> getAllFreeSecretaries(BusinessHoursModel businessHours) { throw new NotImplementedException(); }
public void setBusinessHoursForEmployees(List <Employee> employees, BusinessHoursModel businessHours) { employeeService.setBusinessHoursForEmployees(employees, businessHours); }
public void Save(BusinessHoursModel entity) { throw new NotImplementedException(); }
public List <PatientModel> FindMatchedPatientModels(BusinessHoursModel bussinesHours) { throw new NotImplementedException(); }
public void SetPatientModelsBusinessHours(List <PatientModel> patients, BusinessHoursModel businessHours) { throw new NotImplementedException(); }
public List <Secretary> FindMatchedSecretarys(BusinessHoursModel bussinesHours) { throw new NotImplementedException(); }
public ActionResult Add( BusinessHoursModel model, List <string> morningHour, List <string> morningPeriod, List <string> eveningHour, List <string> eveningPeriod) { if (model.SelectedBusinessHoursType == "1") { BusinessHours businessHours = new BusinessHours() { BusinessHoursId = 0, Description = model.Description, HelpdeskHoursType = Convert.ToInt32(model.SelectedBusinessHoursType), Name = model.Name }; _businessHours.AddBusinessHours(businessHours); TempData["BusinessHoursMessage"] = "BusinessHours Saved Successfully"; } else { if (model.SelectedDays == null) { ModelState.AddModelError("", "Please SelectedDays"); } else { BusinessHours businessHours = new BusinessHours { BusinessHoursId = 0, Description = model.Description, HelpdeskHoursType = Convert.ToInt32(model.SelectedBusinessHoursType), Name = model.Name }; List <BusinessHoursDetails> listBusinessHoursDetails = new List <BusinessHoursDetails>(); for (int i = 0; i < model.SelectedDays.Count(); i++) { var currentMorningHour = morningHour[i]; var currentMorningPeriod = morningPeriod[i]; var currentEveningHour = eveningHour[i]; var currentEveningPeriod = eveningPeriod[i]; var currentday = model.SelectedDays[i]; var starthours = DateTime.Parse($"{currentMorningHour + ":00" + " " + currentMorningPeriod.ToUpper()}").ToString("HH:mm:ss", CultureInfo.InvariantCulture); var endhours = DateTime.Parse($"{currentEveningHour + ":00" + " " + currentEveningPeriod.ToUpper()}").ToString("HH:mm:ss", CultureInfo.InvariantCulture); BusinessHoursDetails businessHoursDetails = new BusinessHoursDetails() { BusinessHoursId = 0, BusinessHoursDetailsId = 0, CreateDate = DateTime.Now, Day = currentday, MorningTime = $"{currentMorningHour + ":00" + " " + currentMorningPeriod.ToUpper()}", EveningTime = $"{currentEveningHour + ":00" + " " + currentEveningPeriod.ToUpper()}", MorningPeriods = currentMorningPeriod, EveningPeriods = currentEveningPeriod, StartTime = starthours, CloseTime = endhours }; listBusinessHoursDetails.Add(businessHoursDetails); } _businessHours.AddBusinessHours(businessHours, listBusinessHoursDetails); TempData["BusinessHoursMessage"] = "BusinessHours Saved Successfully"; return(RedirectToAction("Add", "BusinessHours")); } } model.ListofDays = Dayslist(); model.ListofHour = Hourlist(); model.ListofPeriod = Periodslist(); model.SelectedDays = new List <string>(); model.ListofBusinessHoursType = _businessHours.ListofBusinessHoursType(); return(View(model)); }
public void setBusinessHoursForEmployees(List <Employee> employeesForSettingBH, BusinessHoursModel businessHours) { List <Employee> allEmployees = (List <Employee>)FindAll(); foreach (Employee tempEmployeeForChange in employeesForSettingBH) { foreach (Employee employee in allEmployees) { if (tempEmployeeForChange.Username.Equals(employee.Username)) { employee.BusinessHours = new BusinessHoursModel(); employee.BusinessHours.FromDate = businessHours.FromDate; employee.BusinessHours.ToDate = businessHours.ToDate; employee.BusinessHours.FromHour = businessHours.FromHour; employee.BusinessHours.ToHour = businessHours.ToHour; break; } } } // I want immediately to save changes SaveAll(allEmployees); }