コード例 #1
0
ファイル: NereidController.cs プロジェクト: sitkatech/neptune
        public JsonResult ValidateTreatmentFacility(TreatmentBMPPrimaryKey treatmentBMPPrimaryKey)
        {
            var treatmentFacilityUrl = $"{NeptuneWebConfiguration.NereidUrl}/api/v1/treatment_facility/validate?state=ca&region=soc";

            var treatmentFacility = treatmentBMPPrimaryKey.EntityObject.ToTreatmentFacility(true);

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = new List <TreatmentFacility> {
                    treatmentFacility
                }
            };

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            NereidUtilities.RunJobAtNereid <TreatmentFacilityTable, object>(treatmentFacilityTable, treatmentFacilityUrl,
                                                                            out var responseContent, HttpClient);
            var stopwatchElapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            return(Json(
                       new
            {
                rpcTime = stopwatchElapsedMilliseconds,
                responseContent,
                requestContent = JsonConvert.SerializeObject(treatmentFacilityTable)
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: NereidController.cs プロジェクト: sitkatech/neptune
        public JsonResult NoTreatmentFacility()
        {
            var treatmentFacilityUrl = $"{NeptuneWebConfiguration.NereidUrl}/api/v1/treatment_facility/validate?state=ca&region=soc";

            var treatmentFacilities = HttpRequestStorage.DatabaseEntities.TreatmentBMPs
                                      .Where(x => x.TreatmentBMPID == 9974).ToList().Select(x => x.ToTreatmentFacility(true)).ToList();

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = treatmentFacilities
            };
            bool   failed          = false;
            string responseContent = null;

            try
            {
                NereidUtilities.RunJobAtNereid <TreatmentFacilityTable, object>(treatmentFacilityTable,
                                                                                treatmentFacilityUrl,
                                                                                out responseContent, HttpClient);
            }
            catch (Exception)
            {
                failed = true;
            }

            return(Json(
                       new
            {
                firstCallFailed = failed,
                responseContent,
                requestContent = JsonConvert.SerializeObject(treatmentFacilityTable)
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: NereidController.cs プロジェクト: sitkatech/neptune
        public JsonResult TreatmentFacility()
        {
            var treatmentFacilityUrl = $"{NeptuneWebConfiguration.NereidUrl}/api/v1/treatment_facility/validate?state=ca&region=soc";

            var treatmentFacilities = NereidUtilities.ModelingTreatmentBMPs(HttpRequestStorage.DatabaseEntities)
                                      .ToList().Where(x => x.IsFullyParameterized())
                                      .Select(x => x.ToTreatmentFacility(false)).ToList();

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = treatmentFacilities
            };

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            NereidUtilities.RunJobAtNereid <TreatmentFacilityTable, object>(treatmentFacilityTable, treatmentFacilityUrl,
                                                                            out var responseContent, HttpClient);
            var stopwatchElapsedMilliseconds = stopwatch.ElapsedMilliseconds;

            return(Json(
                       new
            {
                rpcTime = stopwatchElapsedMilliseconds,
                responseContent,
                requestContent = JsonConvert.SerializeObject(treatmentFacilityTable)
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
ファイル: NereidController.cs プロジェクト: sitkatech/neptune
        public ContentResult TreatmentFacilityTable()
        {
            var treatmentFacilities = NereidUtilities.ModelingTreatmentBMPs(HttpRequestStorage.DatabaseEntities)
                                      .ToList()
                                      .Select(x => x.ToTreatmentFacility(false)).ToList();

            var treatmentFacilityTable = new TreatmentFacilityTable()
            {
                TreatmentFacilities = treatmentFacilities
            };

            var serializeObject = JsonConvert.SerializeObject(treatmentFacilityTable);

            return(Content(serializeObject, "application/json"));
        }