public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; context.Response.ContentEncoding = Encoding.UTF8; // The Request QueryString here is protected against XSS attacks by Request Validation QuerySettings settings = CCHSerializer.DeserializeSettings <QuerySettings>(context.Request.QueryString); if (settings.Lat == null) { settings.Lat = context.GetLatitude <String>(); } if (settings.Lng == null) { settings.Lng = context.GetLongitude <String>(); } ResultsBack rb = new ResultsBack(); using (GetDoctorsForService gdfs = new GetDoctorsForService()) { gdfs.ServiceName = context.GetServiceName <String>(); gdfs.Latitude = settings.Lat; gdfs.Longitude = settings.Lng; gdfs.SpecialtyID = context.GetSpecialtyID <Int32>(); //gdfs.MemberMedicalID = ThisSession.SubscriberMedicalID; gdfs.CCHID = context.GetCCHID <Int32>(); gdfs.UserID = context.GetUserLogginID <String>(); gdfs.SessionID = context.GetSessionID <String>(); gdfs.Domain = context.GetDomain <String>(); gdfs.GetData(); if (!gdfs.HasErrors) { ResultData rd = new ResultData(); gdfs.ForEachResult(delegate(object Result) { rd = CCHSerializer.DeserializeDataRow <ResultData>(Result); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.NumericDistance)); rb.AddResult(rd); }); } } JavaScriptSerializer jss = new JavaScriptSerializer(); String jsonBack = jss.Serialize(rb); context.Response.Write(jsonBack); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; context.Response.ContentEncoding = Encoding.UTF8; // The Request QueryString here is protected against XSS attacks by Request Validation QuerySettings settings = CCHSerializer.DeserializeSettings<QuerySettings>(context.Request.QueryString); if (settings.Lat == null) { settings.Lat = context.GetLatitude<String>(); } if (settings.Lng == null) { settings.Lng = context.GetLongitude<String>(); } ResultsBack rb = new ResultsBack(); using (GetDoctorsForService gdfs = new GetDoctorsForService()) { gdfs.ServiceName = context.GetServiceName<String>(); gdfs.Latitude = settings.Lat; gdfs.Longitude = settings.Lng; gdfs.SpecialtyID = context.GetSpecialtyID<Int32>(); //gdfs.MemberMedicalID = ThisSession.SubscriberMedicalID; gdfs.CCHID = context.GetCCHID<Int32>(); gdfs.UserID = context.GetUserLogginID<String>(); gdfs.SessionID = context.GetSessionID<String>(); gdfs.Domain = context.GetDomain<String>(); gdfs.GetData(); if (!gdfs.HasErrors) { ResultData rd = new ResultData(); gdfs.ForEachResult(delegate(object Result) { rd = CCHSerializer.DeserializeDataRow<ResultData>(Result); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.NumericDistance)); rb.AddResult(rd); }); } } JavaScriptSerializer jss = new JavaScriptSerializer(); String jsonBack = jss.Serialize(rb); context.Response.Write(jsonBack); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; context.Response.ContentEncoding = Encoding.UTF8; // The Request QueryString here is protected against XSS attacks by Request Validation QuerySettings settings = CCHSerializer.DeserializeSettings<QuerySettings>(context.Request.QueryString); if (settings.Latitude == null) { settings.Latitude = context.GetLatitude<String>(); } if (settings.Longitude == null) { settings.Longitude = context.GetLongitude<String>(); } if (String.IsNullOrWhiteSpace(settings.CurrentSort)) settings.CurrentSort = ThisSession.DefaultSort; if (String.IsNullOrWhiteSpace(settings.Distance)) settings.Distance = "20"; if (settings.ToRow == 0) { settings.ToRow = 49; } ResultsBack rb = new ResultsBack(); if (context.GetChosenDrugs<DataTable>() == null || context.GetChosenDrugs<DataTable>().CheckForRows()) { using (GetDrugPricingResults gdpr = new GetDrugPricingResults()) { gdpr.Distance = settings.Distance.To<Int32>(); gdpr.Latitude = settings.Latitude; gdpr.Longitude = settings.Longitude; gdpr.FromIndex = settings.FromRow; gdpr.ToIndex = settings.ToRow; gdpr.OrderByField = settings.CurrentDirection; //gdpr.MemberRXID = ThisSession.SubscriberRXID; gdpr.CCHID = context.GetCCHID<Int32>(); gdpr.UserID = context.GetUserLogginID<String>(); // System.Web.Security.Membership.GetUser(ThisSession.PatientEmail).ProviderUserKey.ToString(); if (context.GetChosenDrugs<DataTable>() == null) { gdpr.DrugID = context.GetDrugID<String>();// ThisSession.DrugID; gdpr.GPI = context.GetDrugGPI<String>();// ThisSession.DrugGPI; gdpr.Quantity = context.GetDrugQuantity<String>();// ThisSession.DrugQuantity; if (!String.IsNullOrWhiteSpace(context.GetPastCareID<String>())) gdpr.PastCareID = context.GetPastCareID<String>(); } else { gdpr.DrugID = context.GetDrugID<String>(0);// ThisSession.ChosenDrugs.Rows[0]["DrugID"].ToString(); gdpr.GPI = context.GetDrugGPI<String>(0);// ThisSession.ChosenDrugs.Rows[0]["GPI"].ToString(); gdpr.Quantity = context.GetDrugQuantity<String>(0);// ThisSession.ChosenDrugs.Rows[0]["Quantity"].ToString(); gdpr.PastCareID = context.GetPastCareID<String>(0);// ThisSession.ChosenDrugs.Rows[0]["PastCareID"].ToString(); } gdpr.SessionID = context.GetSessionID<String>(); gdpr.Domain = context.GetDomain<String>(); gdpr.GetData(); if (gdpr.RawResults.TableName != "EmptyTable") { foreach (DataRow dr in gdpr.RawResults.Rows) { ResultData rd = CCHSerializer.DeserializeDataRow<ResultData>(dr); rd.Price = String.Format("{0:C2}", Convert.ToDouble(rd.Price)); rd.YourCost = String.Format("{0:C2}", Convert.ToDouble(rd.YourCost)); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.Distance)); rb.AddResult(rd); } } } } else { using (GetDrugMultiPricingResults gdmpr = new GetDrugMultiPricingResults()) { using (DataView dv = new DataView(ThisSession.ChosenDrugs)) gdmpr.DrugList = dv.ToTable("DrugInput", false, new String[] { "DrugID", "GPI", "Quantity", "PastCareID" }); gdmpr.Latitude = settings.Latitude; gdmpr.Longitude = settings.Longitude; gdmpr.GetData(); if (gdmpr.RawResults.TableName != "EmptyTable") { foreach (DataRow dr in gdmpr.RawResults.Rows) { ResultData rd = CCHSerializer.DeserializeDataRow<ResultData>(dr); rd.Price = String.Format("{0:C2}", Convert.ToDouble(rd.Price)); rd.YourCost = String.Format("{0:C2}", Convert.ToDouble(rd.YourCost)); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.Distance)); rb.AddResult(rd); } } } } JavaScriptSerializer jss = new JavaScriptSerializer(); String jsonBack = jss.Serialize(rb); context.Response.Write(jsonBack); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; context.Response.ContentEncoding = Encoding.UTF8; // The Request QueryString here is protected against XSS attacks by Request Validation QuerySettings settings = CCHSerializer.DeserializeSettings <QuerySettings>(context.Request.QueryString); if (settings.Latitude == null) { settings.Latitude = context.GetLatitude <String>(); } if (settings.Longitude == null) { settings.Longitude = context.GetLongitude <String>(); } if (String.IsNullOrWhiteSpace(settings.CurrentSort)) { settings.CurrentSort = ThisSession.DefaultSort; } if (String.IsNullOrWhiteSpace(settings.Distance)) { settings.Distance = "20"; } if (settings.ToRow == 0) { settings.ToRow = 49; } ResultsBack rb = new ResultsBack(); if (context.GetChosenDrugs <DataTable>() == null || context.GetChosenDrugs <DataTable>().CheckForRows()) { using (GetDrugPricingResults gdpr = new GetDrugPricingResults()) { gdpr.Distance = settings.Distance.To <Int32>(); gdpr.Latitude = settings.Latitude; gdpr.Longitude = settings.Longitude; gdpr.FromIndex = settings.FromRow; gdpr.ToIndex = settings.ToRow; gdpr.OrderByField = settings.CurrentDirection; //gdpr.MemberRXID = ThisSession.SubscriberRXID; gdpr.CCHID = context.GetCCHID <Int32>(); gdpr.UserID = context.GetUserLogginID <String>(); // System.Web.Security.Membership.GetUser(ThisSession.PatientEmail).ProviderUserKey.ToString(); if (context.GetChosenDrugs <DataTable>() == null) { gdpr.DrugID = context.GetDrugID <String>(); // ThisSession.DrugID; gdpr.GPI = context.GetDrugGPI <String>(); // ThisSession.DrugGPI; gdpr.Quantity = context.GetDrugQuantity <String>(); // ThisSession.DrugQuantity; if (!String.IsNullOrWhiteSpace(context.GetPastCareID <String>())) { gdpr.PastCareID = context.GetPastCareID <String>(); } } else { gdpr.DrugID = context.GetDrugID <String>(0); // ThisSession.ChosenDrugs.Rows[0]["DrugID"].ToString(); gdpr.GPI = context.GetDrugGPI <String>(0); // ThisSession.ChosenDrugs.Rows[0]["GPI"].ToString(); gdpr.Quantity = context.GetDrugQuantity <String>(0); // ThisSession.ChosenDrugs.Rows[0]["Quantity"].ToString(); gdpr.PastCareID = context.GetPastCareID <String>(0); // ThisSession.ChosenDrugs.Rows[0]["PastCareID"].ToString(); } gdpr.SessionID = context.GetSessionID <String>(); gdpr.Domain = context.GetDomain <String>(); gdpr.GetData(); if (gdpr.RawResults.TableName != "EmptyTable") { foreach (DataRow dr in gdpr.RawResults.Rows) { ResultData rd = CCHSerializer.DeserializeDataRow <ResultData>(dr); rd.Price = String.Format("{0:C2}", Convert.ToDouble(rd.Price)); rd.YourCost = String.Format("{0:C2}", Convert.ToDouble(rd.YourCost)); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.Distance)); rb.AddResult(rd); } } } } else { using (GetDrugMultiPricingResults gdmpr = new GetDrugMultiPricingResults()) { using (DataView dv = new DataView(ThisSession.ChosenDrugs)) gdmpr.DrugList = dv.ToTable("DrugInput", false, new String[] { "DrugID", "GPI", "Quantity", "PastCareID" }); gdmpr.Latitude = settings.Latitude; gdmpr.Longitude = settings.Longitude; gdmpr.GetData(); if (gdmpr.RawResults.TableName != "EmptyTable") { foreach (DataRow dr in gdmpr.RawResults.Rows) { ResultData rd = CCHSerializer.DeserializeDataRow <ResultData>(dr); rd.Price = String.Format("{0:C2}", Convert.ToDouble(rd.Price)); rd.YourCost = String.Format("{0:C2}", Convert.ToDouble(rd.YourCost)); rd.Distance = String.Format("{0:#0.0 mi}", Convert.ToDouble(rd.Distance)); rb.AddResult(rd); } } } } JavaScriptSerializer jss = new JavaScriptSerializer(); String jsonBack = jss.Serialize(rb); context.Response.Write(jsonBack); }