public void DeleteAppointmentSchedule(AppointmentSchedule schedule) { if (schedule == null) { throw new ArgumentNullException(nameof(schedule)); } _scheduleRepository.Delete(schedule); }
public JsonResult updatestatus(string appointmentid, string status) { string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;//"US Eastern Standard Time";// try { if (!string.IsNullOrEmpty(appointmentid) && !string.IsNullOrEmpty(status)) { AppointmentSchedule lappointment = lIAppointmentScheduleRepository.GetAppointment(appointmentid); if (lappointment != null && lappointment.PatientId.HasValue) { Patient lpatient = IPatient.GetPatientByPatientID(lappointment.PatientId.Value); if (lpatient != null) { lappointment.CallStatus = status; int _result = lIAppointmentScheduleRepository.UpdateAppointment(lappointment); if (_result > 0) { return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", TimeZone = timezoneid })); } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "appointment is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = timezoneid })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = timezoneid })); } }
public JsonResult FinishBooking(FormCollection form) { if (!string.IsNullOrWhiteSpace(form["booking_date"]) && !string.IsNullOrWhiteSpace("slottime") && !string.IsNullOrWhiteSpace("subject") && !string.IsNullOrWhiteSpace("username") && !string.IsNullOrWhiteSpace("mobilenumber") && !string.IsNullOrWhiteSpace("useremail") && !string.IsNullOrWhiteSpace("booking_note") && !string.IsNullOrWhiteSpace("payment") && !string.IsNullOrWhiteSpace("doctorId") && Request.IsAuthenticated) { const string statusFlag = "Pending"; var bookingStatus = _scheduleService.GetAppointmentStatusByName(statusFlag); var userId = User.Identity.GetUserId(); var booking = new AppointmentSchedule { DoctorId = form["doctorId"], PatientId = userId, Subject = form["subject"], DiseasesDescription = form["booking_note"], AppointmentTime = form["slottime"].Trim(), StatusId = bookingStatus.Id, AppointmentDate = form["booking_date"] }; _scheduleService.InsertAppointmentSchedule(booking); return(Json(new { result = "success" })); } return(Json(new { result = "fail" })); }
public JsonResult FinishBooking(FormCollection form) { if (!string.IsNullOrWhiteSpace(form["booking_date"]) && !string.IsNullOrWhiteSpace("slottime") && !string.IsNullOrWhiteSpace("subject") && !string.IsNullOrWhiteSpace("username") && !string.IsNullOrWhiteSpace("mobilenumber") && !string.IsNullOrWhiteSpace("useremail") && !string.IsNullOrWhiteSpace("booking_note") && !string.IsNullOrWhiteSpace("payment") && !string.IsNullOrWhiteSpace("doctorId") && Request.IsAuthenticated) { const string statusFlag = "Pending"; var bookingStatus = _scheduleService.GetAppointmentStatusByName(statusFlag); var userId = User.Identity.GetUserId(); var booking = new AppointmentSchedule { DoctorId = form["doctorId"], PatientId = userId, Subject = form["subject"], DiseasesDescription = form["booking_note"], AppointmentTime = form["slottime"].Trim(), StatusId = bookingStatus.Id, AppointmentDate = form["booking_date"] }; _scheduleService.InsertAppointmentSchedule(booking); var patient = _context.AspNetUsers.Where(p => p.Id == userId).FirstOrDefault(); var doc = _context.Doctors.Where(p => p.DoctorId == booking.DoctorId).FirstOrDefault(); //Patient alert if (!string.IsNullOrWhiteSpace(patient.PhoneNumber)) { string msg = string.Empty; msg += "CONFIRMED Appoinment ID:" + booking.Id; msg += " for " + booking.AppointmentDate + " at time " + booking.AppointmentTime; msg += " with Dr." + doc.AspNetUser.FirstName + " " + doc.AspNetUser.LastName; msg += " Ph:" + doc.AspNetUser.PhoneNumber; msg += "To Cancel login on Doctor 365"; SendOtp(patient.PhoneNumber, msg); } //Doctor Alert if (!string.IsNullOrWhiteSpace(doc.AspNetUser.PhoneNumber)) { string msg = string.Empty; msg += "CONFIRMED Appoinment ID:" + booking.Id; msg += " for " + booking.AppointmentDate + " at time " + booking.AppointmentTime; msg += " Patient:" + patient.FirstName + " " + patient.LastName; msg += " Ph:" + patient.PhoneNumber; SendOtp(patient.PhoneNumber, msg); } return(Json(new { result = "success" })); } return(Json(new { result = "fail" })); }
public OutlookAppointment(AppointmentItem appointment) { _appointment = appointment; Schedule = new AppointmentSchedule(appointment); }
public JsonResult insertschedule(string date = "", string timezoneoffset = "", string color = "") { try { if (!string.IsNullOrEmpty(date) && !string.IsNullOrEmpty(timezoneoffset) && !string.IsNullOrEmpty(color)) { if (color == "green") { DateTime datevalue = Convert.ToDateTime(Utilities.ConverTimetoServerTimeZone(Convert.ToDateTime(date), timezoneoffset)); AppointmentSchedule lappointment = lIAppointmentScheduleRepository.CheckAppointmentSchedule(HttpContext.Session.GetString("UserId"), Utilities.getUserType(HttpContext.Session.GetString("UserType")), datevalue); if (lappointment == null) { AppointmentSchedule lbookAppointment = new AppointmentSchedule(); lbookAppointment.AppointmentId = Guid.NewGuid().ToString(); lbookAppointment.UserType = Utilities.getUserType(HttpContext.Session.GetString("UserType")); lbookAppointment.UserId = HttpContext.Session.GetString("UserId"); lbookAppointment.Datetime = Convert.ToDateTime(Utilities.ConverTimetoServerTimeZone(Convert.ToDateTime(date), timezoneoffset)); lbookAppointment.SlotStatus = "Blocked"; lbookAppointment.CallStatus = "Caller No Show"; lbookAppointment.CreateDate = DateTime.UtcNow; lbookAppointment.UpdateDate = DateTime.UtcNow; lbookAppointment.RecordedFile = ""; int _result = lIAppointmentScheduleRepository.InsertAppointment(lbookAppointment); return(Json(new { result = _result > 0 ? "success" : "" })); } else { int _result = lIAppointmentScheduleRepository.DeleteAppointmentSchedule(lappointment.AppointmentId); return(Json(new { result = _result > 0 ? "success" : "" })); } } else if (color == "white") { AppointmentSchedule lbookAppointment = new AppointmentSchedule(); lbookAppointment.AppointmentId = Guid.NewGuid().ToString(); lbookAppointment.UserType = Utilities.getUserType(HttpContext.Session.GetString("UserType")); lbookAppointment.UserId = HttpContext.Session.GetString("UserId"); lbookAppointment.Datetime = Convert.ToDateTime(Utilities.ConverTimetoServerTimeZone(Convert.ToDateTime(date), timezoneoffset)); lbookAppointment.SlotStatus = "Extra"; lbookAppointment.CallStatus = "Extra"; lbookAppointment.CreateDate = DateTime.UtcNow; lbookAppointment.UpdateDate = DateTime.UtcNow; lbookAppointment.RecordedFile = ""; int _result = lIAppointmentScheduleRepository.InsertAppointment(lbookAppointment); return(Json(new { result = _result > 0 ? "success" : "" })); } else if (color == "grey") { DateTime datevalue = Convert.ToDateTime(Utilities.ConverTimetoServerTimeZone(Convert.ToDateTime(date), timezoneoffset)); AppointmentSchedule lappointment = lIAppointmentScheduleRepository.CheckAppointmentSchedule(HttpContext.Session.GetString("UserId"), Utilities.getUserType(HttpContext.Session.GetString("UserType")), datevalue); if (lappointment != null) { int _result = lIAppointmentScheduleRepository.DeleteAppointmentSchedule(lappointment.AppointmentId); return(Json(new { result = _result > 0 ? "success" : "" })); } } } } catch (Exception ex) { return(Json("")); } return(Json("")); }
public JsonResult generateuri(string id = "") { try { if (!string.IsNullOrEmpty(id)) { AppointmentSchedule lappointment = lIAppointmentScheduleRepository.GetAppointment(id); if (lappointment != null && lappointment.PatientId.HasValue) { Patient lpatient = IPatient.GetPatientByPatientID(lappointment.PatientId.Value); if (lpatient != null) { User pPatient = lIUserRepository.getUser(lpatient.PatientLoginId); User pTherapistorSupport = lIUserRepository.getUser(lappointment.UserId); if (pPatient != null && !string.IsNullOrEmpty(pPatient.Vseeid) && pTherapistorSupport != null && !string.IsNullOrEmpty(pTherapistorSupport.Vseeid)) { VSeeHelper vsee = new VSeeHelper(); dynamic resURI = vsee.GetURI(pTherapistorSupport.Vseeid, pTherapistorSupport.Password, pPatient.Vseeid); if (resURI != null) { lappointment.VseeUrl = resURI; int _result = lIAppointmentScheduleRepository.UpdateAppointment(lappointment); if (_result > 0) { return(Json(new { result = "success", url = resURI })); } else { return(Json("")); } } else { return(Json("")); } } else { return(Json("")); } } else { return(Json("")); } } else { return(Json("")); } } else { return(Json("")); } } catch (Exception ex) { return(Json("")); } }
public JsonResult updateappointment(string appointmentid) { string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;//"US Eastern Standard Time";// try { if (!string.IsNullOrEmpty(appointmentid)) { AppointmentSchedule lappointment = lIAppointmentScheduleRepository.GetAppointment(appointmentid); if (lappointment != null && lappointment.PatientId.HasValue) { Patient lpatient = IPatient.GetPatientByPatientID(lappointment.PatientId.Value); if (lpatient != null) { User pPatient = lIUserRepository.getUser(lpatient.PatientLoginId); User pTherapistorSupport = lIUserRepository.getUser(lappointment.UserId); if (pPatient != null && !string.IsNullOrEmpty(pPatient.Vseeid) && pTherapistorSupport != null && !string.IsNullOrEmpty(pTherapistorSupport.Vseeid)) { VSeeHelper vsee = new VSeeHelper(); dynamic resURI = vsee.GetURI(pTherapistorSupport.Vseeid, pTherapistorSupport.Password, pPatient.Vseeid); if (resURI != null) { lappointment.VseeUrl = resURI; int _result = lIAppointmentScheduleRepository.UpdateAppointment(lappointment); if (_result > 0) { return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", url = resURI, TimeZone = timezoneid })); } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "appointment is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = timezoneid })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = timezoneid })); } }
public JsonResult bookappointment([FromBody] bookappointment pbookappointment, string sessionid) { string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;//"US Eastern Standard Time";// try { if (!string.IsNullOrEmpty(sessionid) && pbookappointment != null && !string.IsNullOrEmpty(pbookappointment.UserID) && !string.IsNullOrEmpty(pbookappointment.DateTime)) { Patient lpatient = IPatient.GetPatientBySessionID(sessionid); if (lpatient != null) { User luser = lIUserRepository.getUser(pbookappointment.UserID); if (luser != null) { AppointmentSchedule lbookAppointment = lIAppointmentScheduleRepository.CheckAppointmentSchedule(pbookappointment.UserID, Utilities.getUserType(luser.Type.ToString()), Convert.ToDateTime(pbookappointment.DateTime)); if (lbookAppointment == null) { lbookAppointment = new AppointmentSchedule(); lbookAppointment.UserType = luser.Type == 1 ? "Support" : "Therapist"; lbookAppointment.UserId = luser.UserId; lbookAppointment.Datetime = Convert.ToDateTime(pbookappointment.DateTime); lbookAppointment.PatientId = lpatient.PatientId; lbookAppointment.SlotStatus = "Booked"; lbookAppointment.CallStatus = "Open"; lbookAppointment.CreateDate = DateTime.UtcNow; lbookAppointment.UpdateDate = DateTime.UtcNow; lbookAppointment.RecordedFile = ""; } else if (lbookAppointment != null && lbookAppointment.CallStatus == "Extra") { lbookAppointment.Datetime = Convert.ToDateTime(pbookappointment.DateTime); lbookAppointment.PatientId = lpatient.PatientId; lbookAppointment.SlotStatus = "Booked"; lbookAppointment.CallStatus = "Open"; lbookAppointment.UpdateDate = DateTime.UtcNow; } User pPatient = lIUserRepository.getUser(lpatient.PatientLoginId); User pTherapistorSupport = lIUserRepository.getUser(luser.UserId); if (pPatient != null && !string.IsNullOrEmpty(pPatient.Vseeid) && pTherapistorSupport != null && !string.IsNullOrEmpty(pTherapistorSupport.Vseeid)) { VSeeHelper vsee = new VSeeHelper(); dynamic resURI = vsee.GetURI(pTherapistorSupport.Vseeid, pTherapistorSupport.Password, pPatient.Vseeid); if (resURI != null) { lbookAppointment.VseeUrl = resURI; int _result = 0; if (!string.IsNullOrEmpty(lbookAppointment.AppointmentId)) { _result = lIAppointmentScheduleRepository.UpdateAppointment(lbookAppointment); } else { lbookAppointment.AppointmentId = Guid.NewGuid().ToString(); _result = lIAppointmentScheduleRepository.InsertAppointment(lbookAppointment); } if (_result > 0) { string content = "New appointment has booked.<br><a href='" + ConfigVars.NewInstance.url + "?ruserid=" + Utilities.EncryptText(pTherapistorSupport.UserId) + "&rtype=" + Utilities.EncryptText(pTherapistorSupport.Type.ToString()) + "&rpage=" + Utilities.EncryptText("appointment") + "'> Click to view</a>"; Smtp.SendGridEmail(luser.Email, "Appointment", content); return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", TimeZone = timezoneid })); } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not inserted", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not inserted", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "not inserted", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "user record is not found", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = timezoneid })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = timezoneid })); } }