public static JObject GetEPrescriptionUrl(DoseSpotPatientEntry oModel) { DoseSpotPatient oDoseSpotPatient = new DoseSpotPatient { PatientId = oModel.PatientId, FirstName = oModel.FirstName, MiddleName = "", LastName = oModel.LastName, DateOfBirth = oModel.DateOfBirth, Prefix = "", Suffix = "", Gender = oModel.Gender, Address1 = oModel.Address1, Address2 = oModel.Address2, City = oModel.City, State = oModel.State, ZipCode = oModel.ZipCode, PrimaryPhone = oModel.Phone, PrimaryPhoneType = "Cell", PhoneAdditional1 = "", PhoneAdditionalType1 = "", PhoneAdditional2 = "", PhoneAdditionalType2 = "", PharmacyId = oModel.PharmacyId }; //Default Criterias - Starts int SingleSignOnUserId = 2844; int SingleSignOnClinicId = 664; string ClinicKey = "qeF5FJef6T6FNTanQS9HuvvuNdkTvvZT"; //Default Criterias - Ends string cPostData = SingleSignOnUtils.GetSingleSignOnQueryStringForPatient(ClinicKey, SingleSignOnClinicId, SingleSignOnUserId, oDoseSpotPatient); string cPrefix = SingleSignOnUtils.GetSingleSignOnPageLocation("my.staging.dosespot.com", true); // string cRetUrl = cPrefix + cPostData; dynamic cRetUrl = new JObject(); cRetUrl.url = cPrefix + cPostData; return(cRetUrl); }
public HttpResponseMessage GetPatientDoseSpotUrl(long patientId) { try { //Search if patient contains doseSpot Id var oPatientInfo = db.Patients.FirstOrDefault(x => x.patientID == patientId); int?DoseSpotPatientId = null; if (oPatientInfo != null) { var oDoseSpotPatientEntry = new DoseSpotPatientEntry { PatientId = DoseSpotPatientId, FirstName = oPatientInfo.firstName, LastName = oPatientInfo.lastName, MiddleName = "", Address1 = oPatientInfo.address1, Address2 = oPatientInfo.address2, City = oPatientInfo.city, State = oPatientInfo.state, ZipCode = oPatientInfo.zip, Gender = oPatientInfo.gender, Phone = oPatientInfo.cellPhone, DateOfBirth = oPatientInfo.dob.Value, PharmacyId = oPatientInfo.pharmacyid }; if (string.IsNullOrEmpty(oPatientInfo.DoseSpotPatientId)) { var oRet = DoseSpotHelper.RegisterPatientWithDoseSpot(oDoseSpotPatientEntry); int DoseSpotPatId; int.TryParse(oRet, out DoseSpotPatId); if (DoseSpotPatId != 0) { oPatientInfo.DoseSpotPatientId = oRet; db.Entry(oPatientInfo).State = EntityState.Modified; db.SaveChanges(); } oDoseSpotPatientEntry.PatientId = DoseSpotPatId; } else { oDoseSpotPatientEntry.PatientId = Convert.ToInt32(oPatientInfo.DoseSpotPatientId); } //Register Patient var cFinalUrl = DoseSpotHelper.GetEPrescriptionUrl(oDoseSpotPatientEntry); return(Request.CreateResponse(HttpStatusCode.OK, cFinalUrl)); } return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "This patient does not exists")); } catch (Exception ex) { //return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex); return(ThrowError(ex, "GetPatientDoseSpotUrl in DoseSpotController")); } }