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 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 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 })); } }