public ActionResult GetAllDataValue(int SiteId, string utcDateDDMMYYYY) { Hydro.HydroService theHydro = new HydroService(); DateTime utcDateBgn = DateTime.ParseExact(utcDateDDMMYYYY + " 00:00:00", "ddMMyyyy H:mm:ss", new CultureInfo("en-US")); DateTime utcDateEnd = DateTime.ParseExact(utcDateDDMMYYYY + " 23:59:59", "ddMMyyyy H:mm:ss", new CultureInfo("en-US")); Hydro.Site[] _sites = theHydro.GetSiteList(null, true); int siteTypeId = 0; if (_sites != null) { foreach (var site in _sites) { if (site.SiteId == SiteId) { siteTypeId = site.Type.Id; } } } Hydro.Variable[] theVariables = theHydro.GetSiteTypeVariables(siteTypeId, true); Dictionary <string, List <Hydro.DataValue> > dictionary_in = new Dictionary <string, List <Hydro.DataValue> >(); foreach (var variable in theVariables) { Hydro.DataValue[] theDataValues = theHydro.GetDataValues(SiteId, true, utcDateBgn, true, utcDateEnd, true, variable.Id, true, null, true, null, true, null, true); if (theDataValues == null) { continue; } List <Hydro.DataValue> theDataValuesList = new List <Hydro.DataValue>(); foreach (var value in theDataValues) { theDataValuesList.Add(value); } dictionary_in.Add(variable.Name, theDataValuesList); } ViewBag.Variables = theVariables; ViewBag.dictionary_in = dictionary_in; return(View()); }
public ActionResult GetDataValues(int SiteId, string date_start, string date_end) { try { Hydro.HydroService theHydro = new HydroService(); DateTime utcDateBgn = DateTime.ParseExact(date_start + " 00:00:00", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")).AddHours(-11); DateTime utcDateEnd = DateTime.ParseExact(date_end + " 23:59:59", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")).AddHours(-11); Hydro.Site[] _sites = theHydro.GetSiteList(null, true); int siteTypeId = 0; if (_sites != null) { foreach (var site in _sites) { if (site.SiteId == SiteId) { siteTypeId = site.Type.Id; } } } Hydro.Variable[] theVariables = theHydro.GetSiteTypeVariables(siteTypeId, true); List <string> theUtcDateStrings = new List <string>(); DateTime dt = utcDateBgn; while (dt < utcDateEnd) { dt = dt.AddHours(1); theUtcDateStrings.Add(String.Format("{0:yyyyMMddHHmmss}", dt)); } theUtcDateStrings.Sort(); theUtcDateStrings.Reverse(); ViewBag.UtcDateStrings = theUtcDateStrings; List <string> theVariableList = new List <string>(); foreach (var item in theVariables) { theVariableList.Add (item.Name); } ViewBag.VariableList = theVariableList; Dictionary <string, List <Hydro.DataValue> > dictionary_in = new Dictionary <string, List <Hydro.DataValue> >(); foreach (var variable in theVariables) { Hydro.DataValue[] theDataValues = theHydro.GetDataValues(SiteId, true, utcDateBgn, true, utcDateEnd, true, variable.Id, true, null, true, null, true, null, true); if (theDataValues == null) { continue; } List <Hydro.DataValue> theDataValuesList = new List <Hydro.DataValue>(); foreach (var value in theDataValues) { theDataValuesList.Add(value); } dictionary_in.Add(variable.Name, theDataValuesList); } ViewBag.Variables = theVariables; ViewBag.dictionary_in = dictionary_in; } catch (Exception ex) { ViewBag.Error = ex.Message; } return(View("GetAllDataValue")); }
public JsonResult GetMonitoring(int SiteId) { DateTime utcBeginDate = DateTime.Now.AddDays(-30); DateTime utcEndDate = DateTime.Now; Hydro.HydroService theHydro = new HydroService(); Hydro.DataValue[] theDataValues = theHydro.GetDataValuesForReport(SiteId, true, utcBeginDate, true, utcEndDate, true, 2, true, 22, true, null, true, null, true, null, true); List <object> theObjs = new List <object>(); List <float> theInts = new List <float>(); List <string> theStrs = new List <string>(); if (theDataValues != null) { foreach (var value in theDataValues) { theInts.Add(value.Value); theStrs.Add(value.Date.ToLongDateString()); } theObjs.Add(theInts); theObjs.Add(theStrs); } return(Json(theObjs, JsonRequestBehavior.AllowGet)); /* * Hydro.HydroService theHydro = new HydroService(); * //DateTime utcDateBgn = DateTime.ParseExact(date_start + " 00:00:00", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")).AddHours(-11); * //DateTime utcDateEnd = DateTime.ParseExact(date_end + " 23:59:59", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")).AddHours(-11); * DateTime utcDateBgn = DateTime.Now.AddDays(-30); * DateTime utcDateEnd = DateTime.Now; * * Hydro.Site[] _sites = theHydro.GetSiteList(null, true); * int siteTypeId = 0; * if (_sites != null) * { * foreach (var site in _sites) * { * if (site.SiteId == SiteId) * { * siteTypeId = site.Type.Id; * } * } * } * * Hydro.Variable[] theVariables = theHydro.GetSiteTypeVariables(siteTypeId, true); * * List<string> theUtcDateStrings = new List<string>(); * DateTime dt = utcDateBgn; * while (dt < utcDateEnd) * { * dt = dt.AddHours(1); * theUtcDateStrings.Add(String.Format("{0:yyyyMMddHHmmss}", dt)); * } * theUtcDateStrings.Sort(); * theUtcDateStrings.Reverse(); * ViewBag.UtcDateStrings = theUtcDateStrings; * * List<string> theVariableList = new List<string>(); * foreach (var item in theVariables) * { * theVariableList.Add * (item.Name); * } * ViewBag.VariableList = theVariableList; * * Dictionary<string, List<Hydro.DataValue>> dictionary_in = new Dictionary<string, List<Hydro.DataValue>>(); * * * foreach (var variable in theVariables) * { * Hydro.DataValue[] theDataValues = theHydro.GetDataValues(SiteId, true, * utcDateBgn, true, * utcDateEnd, true, * variable.Id, true, * null, true, * null, true, * null, true); * if (theDataValues == null) continue; * List<Hydro.DataValue> theDataValuesList = new List<Hydro.DataValue>(); * foreach (var value in theDataValues) * { * theDataValuesList.Add(value); * } * dictionary_in.Add(variable.Name, theDataValuesList); * } * ViewBag.Variables = theVariables; * ViewBag.dictionary_in = dictionary_in; * return View(); * */ }
public ActionResult GetSiteTypeVariables(int siteTypeId) { Hydro.HydroService theHydro = new HydroService(); Hydro.Variable[] theVariables = theHydro.GetSiteTypeVariables(siteTypeId, true); return(View()); }
public HydroController(ref DatabaseDriver databaseDriver) : base(ref databaseDriver) { hydroService = new HydroService(ref databaseDriver); }
public ActionResult GetReportAgk08(string date_report) { const int TYPE_AGK_SITE = 6; const int srocUTC = 8; const int variableId = 2; const int variableId22 = 22; DateTime utcBeginDate = DateTime.ParseExact(date_report + " 00:00:00", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")); DateTime utcEndDate = DateTime.ParseExact(date_report + " 23:59:59", "dd.MM.yyyy H:mm:ss", new CultureInfo("en-US")); Hydro.HydroService theHydro = new HydroService(); Hydro.Site[] _sites = theHydro.GetSiteList(TYPE_AGK_SITE, true); ViewBag.Sites = _sites; Dictionary <int, List <Hydro.DataValue> > SiteDataValues = new Dictionary <int, List <Hydro.DataValue> >(); Dictionary <int, List <Hydro.DataValue> > SiteDataValues22 = new Dictionary <int, List <Hydro.DataValue> >(); if (_sites != null) { foreach (var theSite in _sites) { Hydro.DataValue[] theDataValues = theHydro.GetDataValuesForReport(theSite.SiteId, true, utcBeginDate, true, utcEndDate, true, variableId, true, 22, true, null, true, null, true, null, true); List <Hydro.DataValue> theList = new List <DataValue>(); SiteDataValues.Add(theSite.SiteId, theList); if (theDataValues == null) { continue; } foreach (var datavalue in theDataValues) { theList.Add(datavalue); } SiteDataValues[theSite.SiteId] = theList; } ViewBag.SiteDataValues = SiteDataValues; foreach (var theSite in _sites) { Hydro.DataValue[] theDataValues = theHydro.GetDataValuesForReport(theSite.SiteId, true, utcBeginDate, true, utcEndDate, true, variableId22, true, srocUTC, true, null, true, null, true, null, true); List <Hydro.DataValue> theList = new List <DataValue>(); SiteDataValues22.Add(theSite.SiteId, theList); if (theDataValues == null) { continue; } foreach (var datavalue in theDataValues) { theList.Add(datavalue); } SiteDataValues22[theSite.SiteId] = theList; } } ViewBag.SiteDataValues = SiteDataValues; ViewBag.SiteDataValues22 = SiteDataValues22; return(View()); }