示例#1
0
        public HttpResponseMessage GetPharmacySearchResult(DoseSpotPharmacySearch oModel)
        {
            PharmacySearchMessageResult oResult = DoseSpotHelper.SearchPharmacy(oModel);

            var oRetRes = new List <PharmacyEntry>();

            if (oResult.Pharmacies != null)
            {
                foreach (var item in oResult.Pharmacies)
                {
                    oRetRes.Add(new PharmacyEntry
                    {
                        PharmacyId       = item.PharmacyId,
                        StoreName        = item.StoreName,
                        Address1         = item.Address1,
                        Address2         = item.Address2,
                        City             = item.City,
                        State            = item.State,
                        ZipCode          = item.ZipCode,
                        PrimaryPhone     = item.PrimaryPhone,
                        PrimaryPhoneType = item.PrimaryPhoneType
                    });
                }
            }

            HttpResponseMessage oResp = Request.CreateResponse(HttpStatusCode.OK, oRetRes);

            return(oResp);
        }
示例#2
0
 public HttpResponseMessage GetRefillReqURL()
 {
     try
     {
         var oResult = DoseSpotHelper.GetRefillUrl();
         HttpResponseMessage oResp = Request.CreateResponse(HttpStatusCode.OK, oResult);
         return(oResp);
     }
     catch (Exception ex)
     {
         return(ThrowError(ex, "GetRefillReqURL in DoseSpotController"));
     }
 }
示例#3
0
        public HttpResponseMessage GetRefillReqErr()
        {
            try
            {
                RefillRequestsTransmissionErrorsMessageResult oResult = DoseSpotHelper.RefillReqErr();

                HttpResponseMessage oResp = Request.CreateResponse(HttpStatusCode.OK, oResult);
                return(oResp);
            }
            catch (Exception ex)
            {
                return(ThrowError(ex, "GetRefillReqErr in DoseSpotController"));
            }
        }
示例#4
0
        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"));
            }
        }