public IActionResult SaveCalendarData(AppointmentVM appointmentVM) { CommonResponse <int> commonResponse = new CommonResponse <int>(); try { commonResponse.Status = _aS.AddUpdate(appointmentVM).Result; if (commonResponse.Status == 1) { commonResponse.Message = Helper.appointmentUpdated; } if (commonResponse.Status == 2) { commonResponse.Message = Helper.appointmentAdded; } } catch (Exception e) { commonResponse.Message = e.Message; commonResponse.Status = Helper.FailureCode; } return(Ok(commonResponse)); }
//public ActionResult ViewAppointment() //{ // return View(db.Appointments.ToList()); //} public ActionResult ViewMyAppointment(int patientId) { var patient = db.Patients.Find(patientId); string fullname = string.Format("{0} {1}", patient.FirstName, patient.Surname); Appointment appointment = (from a in db.Appointments where a.PatientName == fullname && a.Complete == false && a.PatientID == patientId select a).FirstOrDefault(); if (appointment == null) { appointment = new Appointment(); } var model = new AppointmentVM { AppointmentID = appointment.AppointmentID, AppointmentTime = appointment.AppointmentTime, DoctorName = appointment.DoctorName, Confirmed = appointment.Confirmed, PatientName = appointment.PatientName, isPaid = appointment.isPaid, PatientID = appointment.PatientID, DoctorID = appointment.DoctorID, Complete = appointment.Complete }; return(View(model)); }
public async Task <int> AddUpdate(AppointmentVM 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 return(1); } else { //create Appointment appointment = new Appointment() { Title = model.Title, Description = model.Description, StartDate = startDate, EndDate = endDate, Duriation = model.Duration, DoctorId = model.DoctorId, PatientId = model.PatientId, IsDoctorApproved = false, AdminId = model.AdminId }; _db.Appointments.Add(appointment); await _db.SaveChangesAsync(); return(2); } }
public ResponseData AppointmentBooking(AppointmentVM model) { using (IDbConnection con = Connection) { con.Open(); try { var appointment = new Appointment { DoctorId = model.DoctorId, PatientId = model.PatientId, Date = model.Date, FromTime = model.FromTime, ToTime = model.ToTime, StatusId = GlobalVariables.isPending }; var id = con.Insert <Appointment>(appointment); return(new ResponseData { Status = true, Message = "Appointment booked successfully" }); } catch (Exception ae) { return(new ResponseData { Status = false, Message = ae.Message.ToString() }); } } }
public AppointmentManagement() { InitializeComponent(); DataContext = new AppointmentVM(); dgPractitioner.DataContext = new PractitionerVM(); }
public async Task <ActionResult> Create(AppointmentVM Model) { HttpClient Client = new HttpClient(); Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Session["authtoken"] + ""); //User currentUser = (User)Session["authtoken"]; Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); AppointmentVM a = new AppointmentVM(); string date = String.Concat(Model.date_start, ":00"); a.date_start = date; a.state = "1"; a.doctor = new Doctor(); System.Diagnostics.Debug.WriteLine("********* Daaaaaate******* " + a.date_start); a.doctor.id = Model.doctor_id; a.patient = new Patient(); a.patient.Id = 8; a.patient_id = 8; a.message = Model.message; a.reason = new Reason() { id = Model.reason_id }; a.reason_id = Model.reason_id; var request = new HttpRequestMessage(HttpMethod.Post, "http://*****:*****@gmail.com")); //replace with valid value message.Subject = "Appointment confirmation"; message.Body = string.Format("Your appointment on " + Model.date_start + " has been confirmed"); message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { await smtp.SendMailAsync(message); return(RedirectToAction("AppointmentByPatient")); } } else { ViewBag.result = "Not added ! "; return(View()); } }
public async Task <int> AddUpdate(AppointmentVM model) { var startDate = DateTime.Parse(model.StartDate); var endDate = DateTime.Parse(model.StartDate).AddMinutes(Convert.ToDouble(model.Duration)); var patient = _db.Users.FirstOrDefault(u => u.Id == model.PatientId); var doctor = _db.Users.FirstOrDefault(u => u.Id == model.DoctorId); //var message = new Mesage(new string[] { "*****@*****.**" }, "Test email async", "This is the content from our email.");//File.ReadAllText(path).Replace() var mesageBody = File.ReadAllText(Path.Combine(_emailConfig.TemplatesPath, "WelcomeEmail.cshtml")); mesageBody = mesageBody.Replace("[UserName]", model.AdminName); var message = new Mesage(new string[] { "*****@*****.**" }, "Test email async", mesageBody); if (model != null && model.Id > 0) { //update var appointment = _db.Appointments.Single(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.IsDoctorApproved = false; appointment.AdminId = model.AdminId; return(await _db.SaveChangesAsync() == 1 ? 1 : -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 }; _db.Appointments.Add(appointment); /*await _emailSender.SendEmailAsync(doctor.Email, "Appointment Created", * $"Your appointment with {patient.Name} is created and in pending status"); * await _emailSender.SendEmailAsync(patient.Email, "Appointment Created", * $"Your appointment with {doctor.Name} is created and in pending status");*/ await _emailSender.SendEmailAsync(message); return(await _db.SaveChangesAsync() == 1 ? 2 : -2); } return(0); }
/// <summary> /// 详情 /// </summary> /// <param name="vm"></param> /// <returns></returns> public ActionResult Detail(AppointmentVM vm) { vm.Appointment = _AppointmentService.GetById(vm.Id) ?? new Appointment(); if (vm.Appointment != null) { var ids = Array.ConvertAll(vm.Appointment.ValueIds.Split(','), int.Parse); vm.GoodsList = _goodsService.GetGoodsByIds(ids.ToList()); } return(View(vm)); }
public LawyerController(ApplicationDbContext context, RoleManager <AppRole> roleManager, UserManager <AppUser> userManager, ILawyerService lawyerService, IHostingEnvironment hostingEnvironment, IDegreeService degreeService, ISpecializationService specializationService, ICaseCategoryService caseCategoryService) { _context = context; _roleManager = roleManager; _userManager = userManager; _lawyerService = lawyerService; _hostingEnvironment = hostingEnvironment; _degreeService = degreeService; _specializationService = specializationService; _caseCategoryService = caseCategoryService; AVM = new AppointmentVM(); }
public AppointmentController(ApplicationDbContext context, RoleManager <IdentityRole> roleMaager, UserManager <IdentityUser> userManager) { _context = context; AppointmentVM = new AppointmentVM() { Appointments = new List <Appointment>(), Employees = new List <Employee>() }; this.roleManager = roleMaager; this.userManager = userManager; }
public async Task <int> AddUpdate(AppointmentVM model) { var startDate = DateTime.Parse(model.StartDate); var endDate = DateTime.Parse(model.StartDate).AddMinutes(Convert.ToDouble(model.Duration)); var patient = _db.Users.FirstOrDefault(u => u.Id == model.PatientId); var doctor = _db.Users.FirstOrDefault(u => u.Id == model.DoctorId); if (model != null && model.Id > 0) { //update var appointment = _db.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.IsDoctorApproved = false; appointment.AdminId = model.AdminId; await _db.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 }; await _emailSender.SendEmailAsync(doctor.Email, "Appointment created", $"Your appointment with {patient.Name} is created and in a pending state"); await _emailSender.SendEmailAsync(patient.Email, "Appointment created", $"Your appointment with {doctor.Name} is created and in a pending state"); _db.Appointments.Add(appointment); await _db.SaveChangesAsync(); return(2); } }
public PartialViewResult EditAppointment(long appointmentId) { List <DoctorVM> doctorVMs = MapperUtilVM.MapToDoctorVMList(doctorService.GetDoctors()); List <PatientVM> patientVMs = MapperUtilVM.MapToPatientVMList(patientService.GetPatients()); SelectList doctorNamesList = new SelectList(doctorVMs, "DoctorId", "FullName"); SelectList patientNamesList = new SelectList(patientVMs, "PatientId", "FullName"); ViewBag.doctorNamesList = doctorNamesList; ViewBag.patientNamesList = patientNamesList; AppointmentVM appointment = MapperUtilVM.MapToAppointmentVM(appointmentService.GetAppointment(appointmentId)); return(PartialView("_EditAppointment", appointment)); }
public JsonResult SaveEvent(AppointmentVM l) { //int id = ressourceId; var status = false; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:18080"); client.PostAsJsonAsync <AppointmentVM>("epione-jee-web/api/Appointment/addAPPhh", l) .ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode()); //client.PostAsJsonAsync<Appointment>("epione-jee-web/api/Appointment/addAPPhh", l).ContinueWith((p => p.Result.EnsureSuccessStatusCode())); status = true; return(new JsonResult { Data = new { status = status } }); }
public async Task <IActionResult> BookAppointment(AppointmentVM model) { if (!ModelState.IsValid) { return(BadRequest(new { status = false, message = "Parameters are not correct." })); } try { var response = _appointmentService.AppointmentBooking(model); return(Ok(new { status = response.Status, message = response.Message })); } catch (Exception ae) { return(BadRequest(new { status = false, message = ae.Message.ToString() })); } }
/// <summary> /// 分页 /// </summary> /// <param name="_dictionariesVM"></param> /// <param name="pn"></param> /// <returns></returns> public ActionResult List(AppointmentVM vm, int pn = 1) { int totalCount, pageIndex = pn, pageSize = PagingConfig.PAGE_SIZE; var list = _AppointmentService.GetManagerList(vm.QueryUserName, vm.QueryPhone, pageIndex, pageSize, out totalCount); var paging = new Paging <Appointment>() { Items = list, Size = PagingConfig.PAGE_SIZE, Total = totalCount, Index = pn, }; vm.Paging = paging; return(View(vm)); }
public async Task <int> AddUpdate(AppointmentVM appointmentVM) { var startDate = DateTime.Parse(appointmentVM.StartDate); var endDate = DateTime.Parse(appointmentVM.StartDate).AddMinutes(Convert.ToDouble(appointmentVM.Duration)); if (appointmentVM != null && appointmentVM.Id > 0) { //update appointment var appointment = _db.Appointments.FirstOrDefault(x => x.Id == appointmentVM.Id); appointment.Title = appointmentVM.Title; appointment.Desctiption = appointmentVM.Desctiption; appointment.StartDate = startDate; appointment.EndDate = endDate; appointment.Duration = appointmentVM.Duration; appointment.HairdresserId = appointmentVM.HairdresserId; appointment.ClientId = appointmentVM.ClientId; appointment.IsHairdresserApproved = false; appointment.AdminId = appointmentVM.AdminId; await _db.SaveChangesAsync(); return(1); } else { //create appointment Appointment appointment = new Appointment { Title = appointmentVM.Title, Desctiption = appointmentVM.Desctiption, StartDate = startDate, EndDate = endDate, Duration = appointmentVM.Duration, HairdresserId = appointmentVM.HairdresserId, ClientId = appointmentVM.ClientId, IsHairdresserApproved = false, AdminId = appointmentVM.AdminId }; _db.Appointments.Add(appointment); await _db.SaveChangesAsync(); return(2); } }
public ActionResult Edit(int id) { HttpClient Client = new HttpClient(); Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Session["authtoken"] + ""); Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = Client.GetAsync("http://localhost:18080/epione-jee-web/api/Appointment?id=" + id).Result; AppointmentVM app = response.Content.ReadAsAsync <AppointmentVM>().Result; System.Diagnostics.Debug.WriteLine("********* update app : app doc******* " + app.doctor.name); HttpResponseMessage response2 = Client.GetAsync("http://localhost:18080/epione-jee-web/api/Reason/SearchReasonsByDoctor?idDoctor=" + app.doctor.id).Result; var reasons = response2.Content.ReadAsAsync <List <Reason> >().Result; ViewBag.doctorname1 = app.doctor.name; ViewData["reason"] = new SelectList(reasons, "id", "name"); return(View(app)); }
public ActionResult CalendarRessource(int id) { AppointmentVM r = new AppointmentVM(); HttpClient Client = new HttpClient(); Client.BaseAddress = new Uri("http://localhost:18080"); Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = Client.GetAsync("epione-jee-web/api/Appointment?id=" + id).Result; if (response.IsSuccessStatusCode) { try { r = response.Content.ReadAsAsync <AppointmentVM>().Result; } catch (NullReferenceException) { } } return(View(r)); }
protected override async Task ExecuteAsync(object parameter) { if (_appointmentsVM.AppointmentSelected != null) { AppointmentDialog dialog = new AppointmentDialog(); List <User> users = await _userRepository.GetAll(); List <Customer> customers = await _customerRepository.GetAll(); List <AppointmentDTO> dtos = _appointmentsVM.AllAppointments .Where(pr => pr.Id != _appointmentsVM.AppointmentSelected.Id).ToList(); AppointmentVM VM = new AppointmentVM(_repository, CUD.Delete, new Action(() => dialog.Close()), _user, users, customers, dtos, _appointmentsVM.AppointmentSelected); dialog.DataContext = VM; bool?result = dialog.ShowDialog(); if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { List <Appointment> transfer = await _appointmentsVM.GetAll().ConfigureAwait(true); _appointmentsVM.AllAppointments.Clear(); _appointmentsVM.Appointments.Clear(); foreach (Appointment appointment in transfer) { _appointmentsVM.AllAppointments.Add(new AppointmentDTO(appointment)); AppointmentDTO dto = new AppointmentDTO(appointment); dto.Start = dto.Start.ToLocalTime(); dto.End = dto.End.ToLocalTime(); _appointmentsVM.Appointments.Add(dto); } _state.SetState(_appointmentsVM.Appointments.Where(pr => pr.Start >= DateTime.Now).ToList()); } } }
public IActionResult SaveCalendarData(AppointmentVM data) { CommonResponse <int> commonResponse = new CommonResponse <int>(); try { commonResponse.status = _appointmentService.AddUpdate(data).Result; if (commonResponse.status == 1) { commonResponse.message = Helper.appointmentUpdated; } if (commonResponse.status == 2) { commonResponse.message = Helper.appointmentAdded; } } catch (Exception e) { commonResponse.message = e.Message; commonResponse.status = Helper.failure_code; } return(Ok(commonResponse)); }
public async Task <ActionResult> Edit(AppointmentVM app) { HttpClient Client = new HttpClient(); Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Session["authtoken"] + ""); Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost:18080/epione-jee-web/api/Appointment"); request.Content = new StringContent("{}", Encoding.UTF8, "application/json"); app.reason = new Reason() { id = app.reason_id }; string date = String.Concat(app.date_start, ":00"); app.date_start = date; app.state = "1"; var json = JsonConvert.SerializeObject(app); request.Content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await Client.SendAsync(request); response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); System.Diagnostics.Debug.WriteLine("****************** app updated i*****"); if (response.IsSuccessStatusCode) { System.Diagnostics.Debug.WriteLine("******************okkk:" + response.StatusCode); return(RedirectToAction("AppointmentByPatient")); } else { ViewData["updated"] = "erreur"; return(View()); } }
public SearchUsersCommand(AppointmentVM appointmentVM) { _appointmentVM = appointmentVM; }
/// <summary> /// 编辑 /// </summary> /// <param name="vm"></param> /// <returns></returns> public ActionResult Edit(AppointmentVM vm) { vm.Appointment = _AppointmentService.GetById(vm.Id) ?? new Appointment(); return(View(vm)); }
public JsonResult CreateAppointment(AppointmentVM appointmentVM) { appointmentService.AddAppointment(MapperUtilVM.MapToAppointmentDTO(appointmentVM)); return(Json(appointmentVM, JsonRequestBehavior.AllowGet)); }
public override BussinessCustomResponse <AppointmentVM> Update(AppointmentVM entityToUpdateVM) { return(base.Update(entityToUpdateVM)); }
public static AppointmentDTO MapToAppointmentDTO(AppointmentVM appointmentVM) { return(new MapperConfiguration(cfg => cfg.CreateMap <AppointmentVM, AppointmentDTO>()).CreateMapper() .Map <AppointmentVM, AppointmentDTO>(appointmentVM)); }
public SearchCustomersCommand(AppointmentVM appointmentVM) { _appointmentVM = appointmentVM; }
public AppointmentCRUDCommand(AppointmentVM appointmentVM) { _appointmentVM = appointmentVM; _appointmentVM.PropertyChanged += ErrorsChanged; }