public ActionResult AppointmentBookingByDepartment(int id) { var department = _context.Departments.Where(d => d.DepartmentId == id); if (department.Any()) { var viewModel = new AppointmentViewModel { Departments = department, AppointmentDate = DateTime.Now.ToString("dd-MM-yyyy hh:mm tt"), DoctorDepartments = _context.DoctorDepartments.Include(d => d.DoctorUser).Where(d => d.DepartmentId == id) }; ViewBag.SearchBy = "Department"; return(View("AppointmentBooking", viewModel)); } return(RedirectToAction("Departments", "Home")); }
public async Task <IActionResult> Index(AppointmentViewModel model) { if (!ModelState.IsValid) { return(View(model)); } if (User.Identity.IsAuthenticated) { var userId = this.userManager.GetUserId(User); model.UserId = userId; } await this.appointments.Add(model.FirstName, model.LastName, model.Email, model.PhoneNumber, model.VehicleInformation, model.Reason, model.DateTime, model.SpecialId, model.UserId); return(RedirectToAction(nameof(Success))); }
public ActionResult Appointment(Guid DoctorId) { var appointment = new AppointmentViewModel(); var Id = User.Identity.GetUserId(); var patient = _context.PacientRepository.GetBy(x => x.UserId == Id); if (patient == null) { return(View("Error")); } appointment = Mapper.Map <Patient, AppointmentViewModel>(patient); appointment.DoctorId = DoctorId; appointment.WorkingDays = _doctorBll.GetWorkingDays(DoctorId); return(View("Appointment", appointment)); }
public async Task <IActionResult> AppointmentHistory(string id) { HttpClientHandler clientHandler = new HttpClientHandler(); clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); }; HttpClient client = new HttpClient(clientHandler); var response = await client.GetAsync(apiUrl + apiAppointmentController + "/GetByProUsernameFufilled/" + id); var appointments = JsonConvert.DeserializeObject <List <AppointmentModel> >(await response.Content.ReadAsStringAsync()); Console.WriteLine(appointments.Count); AppointmentViewModel appointment = new AppointmentViewModel(); appointment.Appointments = appointments; appointment.ProfessionalUsername = id; return(View("AppointmentHistory", appointment)); }
// GET: Appointments public ActionResult Index() { List <AppointmentViewModel> listModel = new List <AppointmentViewModel>(); var listOfAppointment = Appointments.GetAppointments(); foreach (var item in listOfAppointment) { AppointmentViewModel model = new AppointmentViewModel(); model.Id = item.Id; model.CustomerName = Customers.GetCustomerById(item.CustomerId).Name; model.VehicleBrand = Vehicles.GetVehicleById(item.VehicleId).Brand; listModel.Add(model); } return(View(listModel)); }
public async Task <IActionResult> Index(string searchName = null, string searchEmail = null, string searchPhone = null, string searchDate = null) { //get the current logged in user System.Security.Claims.ClaimsPrincipal currentUser = this.User; var claimsIdentity = (ClaimsIdentity)this.User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); AppointmentViewModel appointmentVM = new AppointmentViewModel() { Appointments = new List <Models.Appointments>() }; if (searchName != null) { appointmentVM.Appointments = appointmentVM.Appointments.Where(a => a.CustomerName.ToLower().Contains(searchName.ToLower())).ToList(); } if (searchEmail != null) { appointmentVM.Appointments = appointmentVM.Appointments.Where(a => a.CustomerEmail.ToLower().Contains(searchEmail.ToLower())).ToList(); } if (searchPhone != null) { appointmentVM.Appointments = appointmentVM.Appointments.Where(a => a.CustomerPhoneNumber.ToLower().Contains(searchPhone.ToLower())).ToList(); } if (searchDate != null) { try { DateTime appDate = Convert.ToDateTime(searchDate); appointmentVM.Appointments = appointmentVM.Appointments.Where(a => a.AppointmentDate.ToShortDateString().Equals(appDate.ToShortDateString())).ToList(); } catch (Exception) { throw; } } appointmentVM.Appointments = _db.Appointments.Include(a => a.SalesPerson).ToList(); if (User.IsInRole(SD.AdminEndUser)) { appointmentVM.Appointments = _db.Appointments.Include(a => a.SalesPersonId == claim.Value).ToList(); } return(View(appointmentVM)); }
public async Task <ActionResult> PutAppointmentAsync([FromBody] AppointmentViewModel model) { try { if (!ModelState.IsValid) { return(BadRequest()); } await _logic.PutAsync(model); return(Ok(model)); } catch (Exception e) { return(StatusCode(500, e)); } }
public JsonResult SaveAppointment(AppointmentViewModel objAppointment) { string filepath = Server.MapPath(ConfigurationManager.AppSettings["EmailTemplatePath"].ToString() + "AppointmentTemplate.html"); // homeService.SaveAppointment(objAppointment); if (homeService.SaveAppointment(objAppointment)) { Mailer.SendEmail("Appointment Mail", filepath, objAppointment); return(Json("Your Appointment date is booked .You will get confirmation mail shortly ", JsonRequestBehavior.AllowGet)); } else { Mailer.SendEmail("Appointment Mail", filepath, objAppointment); return(Json("Unable to book your appointment .Please try again later", JsonRequestBehavior.DenyGet)); } }
public ActionResult AppointmentBookingByDoctor(int id) { var doctor = _context.DoctorDepartments.Include(d => d.Department).Include(d => d.DoctorUser).Where(d => d.Id == id); if (doctor.Any()) { var viewModel = new AppointmentViewModel { Departments = _context.Departments.Join(doctor, a => a.DepartmentId, b => b.DepartmentId, (a, b) => a), AppointmentDate = DateTime.Now.ToString("dd-MM-yyyy hh:mm tt"), DoctorDepartments = doctor }; ViewBag.SearchBy = "Doctor"; return(View("AppointmentBooking", viewModel)); } return(RedirectToAction("Doctors", "Home")); }
public ActionResult DisplayForm(string id) { var model = new AppointmentViewModel(); // inherits CategoryItemViewModel or an interface model.Heading = new ContentViewModel().AddTitle("Add new 'Appointment with Jobseeker' event."); if (!string.IsNullOrEmpty(id)) { // populate event details here for this event ID. var categoryItemViewModel = GetAppointment(id); if (categoryItemViewModel != null) { model = categoryItemViewModel.ToAppointmentViewModel(); model.Heading = new ContentViewModel().AddTitle("Edit 'Appointment with Jobseeker' event ID: " + model.Id); } } return(PartialView("EditorTemplates/Object", model)); }
public async Task <IActionResult> AcceptAppointment(AppointmentViewModel model) { HttpClientHandler clientHandler = new HttpClientHandler(); clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); }; HttpClient client = new HttpClient(clientHandler); var response = await client.GetAsync(apiUrl + apiAppointmentController + "/AppointmentAccept/" + model.AppointmentID); HttpClientHandler clientHandler2 = new HttpClientHandler(); clientHandler2.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); }; HttpClient client2 = new HttpClient(clientHandler2); var response2 = await client2.GetAsync(apiUrl + apiProfessionalController + "/GetOneUserByUsername/" + model.ProfessionalUsername); UserModel user = JsonConvert.DeserializeObject <UserModel>(await response2.Content.ReadAsStringAsync()); return(View("ProfessionalHome", user)); }
public bool saveAppointment(AppointmentViewModel avm) { string quary = "insert into appointments (appointmentwith,title,dateandtime,details,userid) values('" + avm.AppointmentWith + "','" + avm.Title + "','" + avm.DateTime + "','" + avm.Details + "' , '" + avm.id + "')"; MySqlCommand cmd = new MySqlCommand(quary, connection); try { OpenConnection(); cmd.ExecuteNonQuery(); CloseConnection(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString(), "Error in Database", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return(false); } }
public void Put(Guid id, [FromBody] AppointmentViewModel appointment) { Debug.Print("--> PUT: " + JsonConvert.SerializeObject(appointment)); var schedule = _scheduleRepository.GetScheduleForDate(_settings.ClinicId, _settings.TestDate); var appointmentToUpdate = schedule.Appointments.FirstOrDefault(a => a.Id == id); if (appointmentToUpdate == null) { throw new ApplicationException("Appointment not found."); } appointmentToUpdate.UpdateRoom(appointment.RoomId); var startEnd = new DateTimeRange(appointment.Start.ToLocalTime(), appointment.End.ToLocalTime()); appointmentToUpdate.UpdateTime(startEnd); _scheduleRepository.Update(schedule); }
static AppointmentViewModel CreateAppointment(DataRow row) { AppointmentViewModel appointment = AppointmentViewModel.Create(); appointment.EventType = (int?)row["EventType"]; appointment.StartDate = (DateTime?)row["StartDate"]; appointment.EndDate = (DateTime?)row["EndDate"]; appointment.AllDay = (bool?)row["AllDay"]; appointment.Subject = Convert.ToString(row["Subject"]); appointment.Location = Convert.ToString(row["Location"]); appointment.Description = Convert.ToString(row["Description"]); appointment.Status = (int?)row["Status"]; appointment.Label = (int?)row["Label"]; appointment.RecurrenceInfo = Convert.ToString(row["RecurrenceInfo"]); appointment.ReminderInfo = Convert.ToString(row["ReminderInfo"]); appointment.ContactInfo = Convert.ToString(row["ContactInfo"]); return(appointment); }
public IActionResult CreateClient() { var confirmedAppointments = _appointmentRepository.GetAll().Include(v => v.Vehicle).ThenInclude(b => b.Brand) .Include(a => a.AppointmentType) .Where(p => p.IsConfirmed == true); var model = new AppointmentViewModel { Vehicles = _vehicleRepository.GetAll().Where(m => m.Client.User.UserName == User.Identity.Name).ToList(), Appointments = _appointmentRepository.GetAll().Where(m => m.IsConfirmed == true).ToList(), AppointmentTypes = _appointmentTypeRepository.GetAll().ToList(), UnconfirmedAppointments = confirmedAppointments, MechanicsCombo = _mechanicRepository.GetComboMecanics() }; return(View(model)); }
public ActionResult RequestAppointment() { if (Session["PatientId"] == null || Session["PatientId"].ToString() == "") { return(RedirectToAction("Login", "Account")); } DateTime dt = DateTime.Now.Date; var appointmentModel = new AppointmentViewModel(); appointmentModel.AppointmentDate = dt.ToString("yyyy-MM-dd"); appointmentModel.Providers = new DrodownItemsViewModel(); appointmentModel.Providers.Items = GetProvidersForAppointment(); appointmentModel.AppointmentViewModelList = new AppointementRepository().GetAppointmentsByPatientID(int.Parse(Session["PatientId"].ToString()), appointmentModel.AppointmentDate); return(View(appointmentModel)); }
public ActionResult Delete(int id, AppointmentViewModel collection) { Appointment a = AS.GetById(id); // a.AppointmentId = collection.AppointmentId; a.AppDate = collection.AppDate; a.AppRate = collection.AppRate; a.VisitReason = collection.VisitReason; a.DoctorId = collection.DoctorId; a.PatientId = collection.PatientId; // a.ReportId = collection.ReportId; AS.Delete(a); AS.Commit(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Appointment(AppointmentViewModel model) { // Get PatientId var userId = await GetUserId(); var patientId = this._patientService.GetPatientId(userId); var schedules = _doctorService.GetSchedulesByDoctorId(model.DoctorId); model.ScheduleDates = schedules.ToList().Select(s => new SelectListItem { Value = s.Dates.ToString(), Text = s.Dates.ToString() }); if (ModelState.IsValid) { model.PatientId = patientId; model.CreatedOn = DateTime.UtcNow; model.UpdatedOn = DateTime.UtcNow; model.Start = DateTime.UtcNow; model.End = DateTime.UtcNow; model.Uid = Guid.NewGuid().ToString(); var appointment = Mapper.Map <Appointment>(model); if (_patientService.IsAppointmentTaken(appointment.PatientId, appointment.Date, appointment.DoctorId)) { //return Json("Appointment already taken", JsonRequestBehavior.AllowGet); model.Doctor = _doctorService.GetDoctor(model.DoctorId); TempData["UnSuccess"] = " Appointment Already Taken"; return(View(model)); } var isSave = _patientService.RegisterAppointment(appointment); if (isSave > 0) { return(RedirectToAction("Appointments")); } else { TempData["UnSuccess"] = " Appointment Not Avaiable"; } } model.Doctor = _doctorService.GetDoctor(model.DoctorId); return(View(model)); }
private void SchedulerControl_MouseMove(object sender, MouseEventArgs e) { // Obtain hit information under the test point. Point position = e.GetPosition(schedulerControl1); ISchedulerHitInfo hitInfo = schedulerControl1.CalcHitInfo(position); if (hitInfo != null) { this.hitResultsHeader.Text = "Hit Test Results"; StringBuilder builder = new StringBuilder(); builder.AppendLine(Enum.GetName(typeof(SchedulerHitTestType), hitInfo.HitTestType)); switch (hitInfo.HitTestType) { case SchedulerHitTestType.Appointment: AppointmentViewModel appViewModel = hitInfo.ViewModel as AppointmentViewModel; if (appViewModel != null) { builder.AppendLine("Subject: " + appViewModel.Appointment.Subject); builder.AppendLine("Start: " + appViewModel.Appointment.Start.ToString()); builder.AppendLine("End: " + appViewModel.Appointment.End.ToString()); } break; case SchedulerHitTestType.Cell: builder.AppendLine("Interval: " + hitInfo.ViewModel.Interval.ToString()); builder.AppendLine("Selected: " + hitInfo.ViewModel.IsSelected.ToString()); break; case SchedulerHitTestType.Ruler: TimeRulerCellViewModel rulerViewModel = hitInfo.ViewModel as TimeRulerCellViewModel; if (rulerViewModel != null) { builder.AppendLine("Time: " + rulerViewModel.Time.ToString()); builder.AppendLine("Time Scale: " + rulerViewModel.TimeScale.ToString()); } break; } this.hitResultsText.Text = builder.ToString(); } else { ClearResults(); } }
public ActionResult CreateAppointment(AppointmentViewModel appointment) { appointment.AppointmentCreationDate = DateTime.Now; appointment.AppointmentUpdateDate = DateTime.Now; //add var model = new Appointment(); model.AppointmentCreationDate = appointment.AppointmentCreationDate; model.CarId = appointment.CarId; model.AppointmentDate = appointment.AppointmentDate; model.AppointmentDescription = appointment.AppointmentDescription; model.AppointmentUpdateDate = appointment.AppointmentUpdateDate; _appointmentService.AddAppointment(model); return(RedirectToAction("GetListAppointmentByCustomerId", new RouteValueDictionary( new { controller = "Appointments", action = "GetListAppointmentByCustomerId", Id = appointment.CustomerId }))); }
public ActionResult Edit(int?id) { var appointment = _repository.SelectByID(id.Value); var viewModel = new AppointmentViewModel(); var newAppointment = Mapper.Map(appointment, viewModel); return(View(newAppointment)); // Appointment app = Service.Get(a => a.Id == id); // AppointmentVM appVM = new AppointmentVM(); // Mapper.Map(app, appVM); // appVM.Activities = Mapper.Map<List<ActivityVM>>(activityService.GetAll()); // foreach (Activity act in app.Activities) // { // appVM.Activities.Find(a => a.Name == act.Name).IsChecked = true; // } // return View(appVM); }
public ActionResult AddEdit(int serviceId, int?id) { var model = new AppointmentViewModel() { Appointment = new AppointmentModel { ServiceId = serviceId }, Medics = _usersRepo.GetMedicsForAppointment(), Pets = _petsRepo.GetPetsByOwner(ApplicationHelper.LoggedUser.Id) }; if (id.GetValueOrDefault() != default) { model.Appointment = _appointmentsRepo.Get(id.GetValueOrDefault()); } return(View("AppointmentForm", model)); }
public ActionResult PayAppointmentBill() //Loads the View { List <Appointment> appointmentsInDb = db.Appointments.Where(a => a.IsPaid == false) .Where(d => d.CreatedDate == DateTime.Today).ToList(); List <AppointmentViewModel> AppVMList = new List <AppointmentViewModel>(); foreach (Appointment item in appointmentsInDb) { AppointmentViewModel appVM = new AppointmentViewModel(); appVM.Patient = db.Patients.Find(item.PatientId); Doctor doc = db.Doctors.Find(item.DoctorId); appVM.ChannelNumber = doc.Room.ToString() + "-" + item.ChannelNumber.ToString(); appVM.ReferenceNumber = item.Id; AppVMList.Add(appVM); ViewBag.Role = "cashier"; } return(View("AppointmentList", AppVMList)); }
//selects appointment to update public ActionResult Update(int id) { //checks if logged in if ((System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { string query = "select * from appointments where appointmentID = @id"; var Parameter = new SqlParameter("@id", id); Appointment appointment = db.Appointments.SqlQuery(query, Parameter).FirstOrDefault(); AppointmentViewModel appointmentViewModel = new AppointmentViewModel(); appointmentViewModel.appointment = appointment; appointmentViewModel.doctors = db.Doctors.ToList(); //using a view model to also show doctors return(View(appointmentViewModel)); } else { return(RedirectToAction("index")); } }
public ActionResult Create(AppointmentViewModel appointmentViewModel) { try { if (appointmentViewModel.Appointment.StartDateTime.Date > DateTime.Today.Date) { ViewBag.Title = "Request Service"; Customer customer = HttpContext.Session.GetObject <Customer>("customer"); appointmentViewModel.Appointment.CustomerId = customer.Id; appointmentViewModel.Appointment.EmployeeId = null; appointmentViewModel.Appointment.EndDateTime = appointmentViewModel.Appointment.StartDateTime; appointmentViewModel.Appointment.Status = "Unscheduled"; string serializedObject = JsonConvert.SerializeObject(appointmentViewModel.Appointment); var content = new StringContent(serializedObject); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); var insertAppointmentResponse = client.PostAsync("Appointment/", content).Result; string insertAppointmentResult = insertAppointmentResponse.Content.ReadAsStringAsync().Result; if (insertAppointmentResponse.StatusCode == System.Net.HttpStatusCode.OK) { return(RedirectToAction("Index", "Appointment")); } else { throw new Exception(insertAppointmentResult); } } else { throw new Exception("Date must be in the future."); } } catch (Exception ex) { ViewBag.Title = "Request Service"; appointmentViewModel = HttpContext.Session.GetObject <AppointmentViewModel>("AppointmentViewModel"); ViewBag.Error = ex.Message; return(View(appointmentViewModel)); } }
/// <inheritdoc /> /// <summary> /// Translates the specified view model. /// </summary> /// <param name="viewModel">The view model.</param> /// <returns></returns> public AppointmentModel Translate(AppointmentViewModel viewModel) { AppointmentModel model = new AppointmentModel { Id = viewModel.Id, CreatedTime = viewModel.CreatedTime, CreatedUser = viewModel.CreatedUser, LasteUpdatedTime = viewModel.LastUpdatedTime, LastedUpdatedUser = viewModel.LastedUpdatedUser, StartTime = viewModel.StartTime, Duration = viewModel.Duration, Location = viewModel.Location, Description = viewModel.Description, PaymentId = viewModel.PaymentId, InvoiceId = viewModel.InvoiceId }; return(model); }
public ActionResult Student() { var studentList = new List <SelectListItem>() { new SelectListItem { Text = "Peter Cech", Value = "S001" }, new SelectListItem { Text = "Leo Messi", Value = "S002" }, }; ViewData["studentList"] = studentList; AppointmentViewModel model = new AppointmentViewModel(); model.FK_StudentId = "S001"; return(View(model)); }
public ActionResult DisplayForm(AppointmentViewModel model) { if (model != null && ModelState.IsValid) { // TODO: If everything is valid, then add the event in database then redirect to Index() action which will populate this newly created event inside of calendar. // else if something has failed then redirect this partial view. if (string.IsNullOrEmpty(model.Id)) { // Add new event. meetingCategoryEventsList.Add (new CategoryItemViewModel() { Id = new Random().Next(20, 1000).ToString(), EventDescription = new ContentViewModel().AddText(model.Description), Title = model.Title, Start = model.Start, End = model.End, } ); } else { // Edit existing event. var eventToUpdate = GetAppointment(model.Id); if (eventToUpdate != null) { eventToUpdate = model.ToCategoryItemViewModel(eventToUpdate); meetingCategoryEventsList.Remove(eventToUpdate); meetingCategoryEventsList.Add(eventToUpdate); } } model.ModelStateIsValid = true; } else if (model == null) { AddErrorMessage("Model is null."); return(Content(string.Empty)); } return(PartialView("EditorTemplates/Object", model)); }
public async Task <int> AddOrUpdateAppointment(AppointmentViewModel model) { var startDate = DateTime.Parse(model.StartDate); var endDate = DateTime.Parse(model.StartDate).AddMinutes(Convert.ToDouble(model.Duration)); if (model != null && model.Id > 0) { //update var appointment = _context.Appointments.FirstOrDefault(x => x.Id == model.Id); appointment.Title = model.Title; appointment.Description = model.Description; appointment.StartDate = startDate; appointment.EndDate = endDate; appointment.Duration = model.Duration; appointment.DoctorId = model.DoctorId; appointment.PatientId = model.PatientId; appointment.AdminId = model.AdminId; await _context.SaveChangesAsync(); return(1); } else { // create Appointment appointment = new Appointment() { Title = model.Title, Description = model.Description, StartDate = startDate, EndDate = endDate, Duration = model.Duration, DoctorId = model.DoctorId, PatientId = model.PatientId, IsDoctorApproved = false, AdminId = model.AdminId }; _context.Add(appointment); await _context.SaveChangesAsync(); return(2); } }
public Dictionary <string, string> FixAppointment(AppointmentViewModel appointmentViewModel) { try { appointment = new Appointment(); nurseBusinessLayer = new NurseBusinessLayer(); doctorBusinessLayer = new DoctorBusinessLayer(); patientDataLayer = new PatientDataLayer(); appointmentViewModel.TimeSlot = TimeSlots.Timings.IndexOf(doctorBusinessLayer.GetDoctorAvailableTimeSlots(appointmentViewModel.DoctorId.ToString(), appointmentViewModel.AppointmentDate.ToString())[int.Parse(appointmentViewModel.TimeSlot)]).ToString(); int isAlreadyBooked = patientDataLayer.GetTotalAppointments(Convert.ToDateTime(appointmentViewModel.AppointmentDate), int.Parse(appointmentViewModel.TimeSlot), appointmentViewModel.DoctorId); if (isAlreadyBooked > 0) { return(new Dictionary <string, string>() { { "", "Time slot already booked." } }); } int NurseId = nurseBusinessLayer.GetAvailableNurse(Convert.ToDateTime(appointmentViewModel.AppointmentDate), TimeSlots.Timings.IndexOf(appointmentViewModel.TimeSlot)); if (NurseId == -1) { return(new Dictionary <string, string>() { { "", "Appointment not booked, Please contact the clinic." } }); } appointment.NurseId = NurseId; appointment.DoctorId = appointmentViewModel.DoctorId; appointment.PatientId = appointmentViewModel.PatientId; appointment.Date = Convert.ToDateTime(appointmentViewModel.AppointmentDate); appointment.Time = int.Parse(appointmentViewModel.TimeSlot); appointment.Status = AppointmentStatus.Pending; appointment = patientDataLayer.FixAppointment(appointment); return(null); }catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw; } }
public ActionResult PatientAppointments() { if (!LogOnHelper.CheckLogOn()) return RedirectToAction("Login", "Account"); var appointmentViewModel = new AppointmentViewModel(); appointmentViewModel.Patients = GetPatients(); return View(appointmentViewModel); }