public ActionResult CadastreTypeDelete(int id) { RGEContext db = null; ViewBag.EGHLayout = "RGE.CadastreType"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("CadastreType.Delete.Delete")) { if (EGH01DB.Types.CadastreType.DeleteByCode(db, id)) { view = View("CadastreType", db); } } else if (menuitem.Equals("CadastreType.Delete.Cancel")) { view = View("CadastreType", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public static AnchorPointList CreateNear(Coordinates center, float radius1, float radius2) { bool rc = false; RGEContext db = new RGEContext(); AnchorPointList anchor_point_list = new AnchorPointList(); using (SqlCommand cmd = new SqlCommand("EGH.GetListAnchorPointOnDistanceLessThanD2MoreThanD1", db.connection)) { cmd.CommandType = CommandType.StoredProcedure; { SqlParameter parm = new SqlParameter("@ШиротаГрад", SqlDbType.Real); parm.Value = center.latitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@ДолготаГрад", SqlDbType.Real); parm.Value = center.lngitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@Расстояние1", SqlDbType.Real); parm.Value = radius1; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@Расстояние2", SqlDbType.Real); parm.Value = radius2; cmd.Parameters.Add(parm); } try { cmd.ExecuteNonQuery(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = (int)reader["IdТехногенногоОбъекта"]; float x = (float)reader["ШиротаГрад"]; float y = (float)reader["ДолготаГрад"]; int ground_type_code = (int)reader["ТипГрунта"]; int cadastre_type_code = (int)reader["КодНазначенияЗемель"]; float waterdeep = (float)reader["ГлубинаГрунтовыхВод"]; float height = (float)reader["ВысотаУровнемМоря"]; GroundType ground_type = new GroundType(ground_type_code); Coordinates coordinates = new Coordinates((float)x, (float)y); CadastreType cadastre_type = new CadastreType(cadastre_type_code); Point point = new Point(coordinates, ground_type, (float)waterdeep, (float)height); //delta = (float)reader["Расстояние"]; AnchorPoint anchor_point = new AnchorPoint(id, point, cadastre_type); anchor_point_list.Add(anchor_point); } rc = anchor_point_list.Count > 0; reader.Close(); } catch (Exception e) { rc = false; }; return(anchor_point_list); } }
public ActionResult SpreadingCoefficientDelete(int code) { RGEContext db = null; ViewBag.EGHLayout = "RGE.SpreadingCoefficient"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("SpreadingCoefficient.Delete.Delete")) { if (EGH01DB.Primitives.SpreadingCoefficient.DeleteByCode(db, code)) { view = View("SpreadingCoefficient", db); } } else if (menuitem.Equals("SpreadingCoefficient.Delete.Cancel")) { view = View("SpreadingCoefficient", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult RiskObjectTypeUpdate(RiskObjectTypeView rt) { RGEContext db = null; ViewBag.EGHLayout = "RGE.RiskObjectType"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("RiskObjectType.Update.Update")) { if (EGH01DB.Types.RiskObjectType.Update(db, new EGH01DB.Types.RiskObjectType(rt.type_code, rt.name))) { view = View("RiskObjectType", db); } } else if (menuitem.Equals("RiskObjectType.Update.Cancel")) { view = View("RiskObjectType", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult IncidentTypeCreate(IncidentTypeView itv) { RGEContext db = null; ViewBag.EGHLayout = "RGE"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("IncidentType", db); if (menuitem.Equals("IncidentType.Create.Create")) { if (EGH01DB.Types.IncidentType.Create(db, new IncidentType(0, itv.name))) { view = View("IncidentType", db); } else if (menuitem.Equals("IncidentType.Create.Cancel")) { view = View("IncidentType", db); } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EcoObjectDelete(int type_code) { RGEContext db = null; ViewBag.EGHLayout = "RGE.EcoObject"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("EcoObject.Delete.Delete")) { if (EGH01DB.Objects.EcoObject.DeleteById(db, type_code)) { view = View("EcoObject", db); } } else if (menuitem.Equals("EcoObject.Delete.Cancel")) { view = View("EcoObject", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult RGECalc() { { RGEContext db = new RGEContext(); RGEContext.ECOForecast f = new RGEContext.ECOForecast(); int k = 1; } //{ // Coordinates c1 = new Coordinates(53.663388f, 27.143777f); // Coordinates c2 = new Coordinates(53.663229f, 27.143831f); // Coordinates c3 = new Coordinates(53.663267f, 27.143574f); // Coordinates c4 = new Coordinates(53.663394f, 27.143552f); //} //{ // List<RiskObject> o = new List<RiskObject>(); // if (RiskObjectsList.GetListRiskObjectByLike(db, "Брест", ref o)) // { // int k = 1; // } //} return(View()); }
public ActionResult EGHMAP2() { ViewBag.EGHLayout = "MAP"; RGEContext db = null; ActionResult view = View("EGHMAP2"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; db = new RGEContext(); view = View("EGHMAP2", db); return(view); }
public ActionResult WaterPropertiesUpdate(WaterPropertiesView wpv) { RGEContext db = null; ViewBag.EGHLayout = "RGE.WaterProperties"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("WaterProperties.Update.Update")) { int water_code = wpv.water_code; string strtemperature = this.HttpContext.Request.Params["temperature"] ?? "Empty"; float temperature; Helper.FloatTryParse(strtemperature, out temperature); string strviscocity = this.HttpContext.Request.Params["viscocity"] ?? "Empty"; float viscocity; Helper.FloatTryParse(strviscocity, out viscocity); string strdensity = this.HttpContext.Request.Params["density"] ?? "Empty"; float density; Helper.FloatTryParse(strdensity, out density); string strtension = this.HttpContext.Request.Params["tension"] ?? "Empty"; float tension; Helper.FloatTryParse(strtension, out tension); WaterProperties wp = new WaterProperties((int)water_code, (float)temperature, (float)viscocity, (float)density, (float)tension); if (EGH01DB.Primitives.WaterProperties.Update(db, wp)) { view = View("WaterProperties", db); } } else if (menuitem.Equals("WaterProperties.Update.Cancel")) { view = View("WaterProperties", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult CadastreTypeUpdate(CadastreTypeView cd) { RGEContext db = null; ViewBag.EGHLayout = "RGE.CadastreType"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("CadastreType", db); if (menuitem.Equals("CadastreType.Update.Update")) { int id = cd.type_code; String name = cd.name; float pdk_coef = 0.0f; string strpdk_coef = this.HttpContext.Request.Params["pdk_coef"] ?? "Empty"; if (!Helper.FloatTryParse(strpdk_coef, out pdk_coef)) { pdk_coef = 0.0f; } float water_pdk_coef = cd.water_pdk_coef; string ground_doc_name = cd.ground_doc_name; string water_doc_name = cd.water_doc_name; EGH01DB.Types.CadastreType cadastre_type = new EGH01DB.Types.CadastreType(id, name, pdk_coef, water_pdk_coef, ground_doc_name, water_doc_name); //blinova if (EGH01DB.Types.CadastreType.Update(db, cadastre_type)) { view = View("CadastreType", db); } } else if (menuitem.Equals("CadastreType.Update.Cancel")) { view = View("CadastreType", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult ChoiceRiskObject() { RGEContext context = null; try { context = new RGEContext(this); } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(PartialView("_ChoiceRiskObject", context)); }
public ActionResult CadastreTypeCreate(CadastreTypeView cd) { RGEContext db = null; ViewBag.EGHLayout = "RGE.CadastreType"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("CadastreType", db); if (menuitem.Equals("CadastreType.Create.Create")) { int id = -1; if (EGH01DB.Types.CadastreType.GetNextCode(db, out id)) { String name = cd.name; EGH01DB.Types.CadastreType cadastre_type = new EGH01DB.Types.CadastreType(id, name, 0.0f, 0.0f, "ПДК", "ПДК"); // blinova if (EGH01DB.Types.CadastreType.Create(db, cadastre_type)) { view = View("CadastreType", db); } } } else if (menuitem.Equals("CadastreType.Create.Cancel")) { view = View("CadastreType", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EcoObjectTypeCreate(EcoObjectTypeView itv) { RGEContext db = null; ViewBag.EGHLayout = "RGE.EcoObjectType"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("EcoObjectType", db); if (menuitem.Equals("EcoObjectType.Create.Create")) { EGH01DB.Types.WaterProtectionArea water = new WaterProtectionArea(); if (EGH01DB.Types.WaterProtectionArea.GetByCode(db, itv.list_water, out water)) { if (EGH01DB.Types.EcoObjectType.Create(db, new EcoObjectType(0, itv.name, water))) { view = View("EcoObjectType", db); } else if (menuitem.Equals("EcoObjectType.Create.Cancel")) { view = View("EcoObjectType", db); } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public static bool Handler(RGEContext context, NameValueCollection parms) { bool rc = false; ChoiceRiskObjectContext viewcontext = null; string choicefind = parms["ChoiceRiskObject.choicefind"]; if (!string.IsNullOrEmpty(choicefind)) { if ((viewcontext = context.GetViewContext("_ChoiceRiskObject") as ChoiceRiskObjectContext) != null) { if (rc = choicefind.Equals("init")) { viewcontext.Regim = ChoiceRiskObjectContext.REGIM.INIT; } else if (rc = choicefind.Equals("choice")) { string template = parms["ChoiceRiskObject.template"]; if (!string.IsNullOrEmpty(template)) { viewcontext.Regim = ChoiceRiskObjectContext.REGIM.CHOICE; viewcontext.Template = template; } } else if (rc = choicefind.Equals("set")) { int id = 0; string formid = parms["ChoiceRiskObject.id"]; if (!string.IsNullOrEmpty(formid) && int.TryParse(formid, out id)) { viewcontext.Regim = ChoiceRiskObjectContext.REGIM.SET; viewcontext.RiskObjectID = id; } } } } return(rc); }
public ActionResult ReportDelete(int id) { RGEContext db = null; ViewBag.EGHLayout = "RGE"; ActionResult view = View("Index"); ViewBag.stage = "П"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); if (menuitem.Equals("Report.Delete.Delete")) { if (EGH01DB.Primitives.Report.DeleteById(db, id)) { view = View("Report", db); } } else if (menuitem.Equals("Report.Delete.Cancel")) { view = View("Report", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
//написать фильтр на открытие БД public ActionResult Index() { ViewBag.EGHLayout = "RGE"; RGEContext db = null; try { db = new RGEContext(); ViewBag.msg = "Соединение с базой данных установлено"; } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } finally { if (db != null) { db.Disconnect(); } } return(View()); }
public static ChoiceRiskObjectViewContext Handler(RGEContext context, NameValueCollection parms) { ChoiceRiskObjectViewContext viewcontext = context.GetViewContext(VIEWNAME) as ChoiceRiskObjectViewContext; if (viewcontext != null) { string choicefind = parms["ChoiceRiskObject.choicefind"]; if (!string.IsNullOrEmpty(choicefind)) { switch (choicefind) { case "init": viewcontext.Regim = ChoiceRiskObjectViewContext.REGIM.INIT; break; case "choice": string template = parms["ChoiceRiskObject.template"]; if (!string.IsNullOrEmpty(template)) { viewcontext.Regim = ChoiceRiskObjectViewContext.REGIM.CHOICE; viewcontext.Template = template; } break; case "set": int id = 0; string formid = parms["ChoiceRiskObject.id"]; if (!string.IsNullOrEmpty(formid) && int.TryParse(formid, out id)) { viewcontext.Regim = ChoiceRiskObjectViewContext.REGIM.SET; viewcontext.RiskObjectID = id; if (viewcontext.riskobject == null || viewcontext.riskobject.id != id) { viewcontext.riskobject = new RiskObject(); if (!RiskObject.GetById(context, id, ref viewcontext.riskobject)) { viewcontext.Regim = REGIM.ERROR; } } } break; case "geopinit": viewcontext.Regim = ChoiceRiskObjectViewContext.REGIM.INIT; break; case "geopchoice": viewcontext.Regim = ChoiceRiskObjectViewContext.REGIM.CHOICE; viewcontext.coordinates = viewcontext.getCoordinatesParm(viewcontext, parms); break; case "geopset": viewcontext.Regim = REGIM.SET; if ((viewcontext.coordinates = viewcontext.getCoordinatesParm(viewcontext, parms)) != null) { MapePoint mp = new MapePoint(context, viewcontext.coordinates); viewcontext.riskobject = new RiskObject(mp); } break; default: break; } } } else { viewcontext = new ChoiceRiskObjectViewContext(); viewcontext.Regim = REGIM.INIT; } return(viewcontext); }
public ActionResult SpreadingCoefficientCreate(SpreadingCoefficientView scv) { RGEContext db = null; ViewBag.EGHLayout = "RGE.SpreadingCoefficient"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("SpreadingCoefficient", db); if (menuitem.Equals("SpreadingCoefficient.Create.Create")) { EGH01DB.Types.GroundType type_groud = new EGH01DB.Types.GroundType(); if (EGH01DB.Types.GroundType.GetByCode(db, scv.list_groundType, out type_groud)) { EGH01DB.Types.PetrochemicalType petrochemical_type = new PetrochemicalType(); if (EGH01DB.Types.PetrochemicalType.GetByCode(db, scv.list_petrochemicalType, ref petrochemical_type)) { int code = scv.code; string strmin_angle = this.HttpContext.Request.Params["min_angle"] ?? "Empty"; float min_angle; Helper.FloatTryParse(strmin_angle, out min_angle); string strmax_angle = this.HttpContext.Request.Params["max_angle"] ?? "Empty"; float max_angle; Helper.FloatTryParse(strmax_angle, out max_angle); string strmin_volume = this.HttpContext.Request.Params["min_volume"] ?? "Empty"; float min_volume; Helper.FloatTryParse(strmin_volume, out min_volume); string strmax_volume = this.HttpContext.Request.Params["max_volume"] ?? "Empty"; float max_volume; Helper.FloatTryParse(strmax_volume, out max_volume); string strkoef = this.HttpContext.Request.Params["koef"] ?? "Empty"; float koef; Helper.FloatTryParse(strkoef, out koef); SpreadingCoefficient sc = new EGH01DB.Primitives.SpreadingCoefficient((int)code, type_groud, petrochemical_type, (float)min_volume, (float)max_volume, (float)min_angle, (float)max_angle, (float)koef); // исправить тип нефтепродукта //koef = EGH01DB.Primitives.SpreadingCoefficient.Get(db, sc); //sc = new EGH01DB.Primitives.SpreadingCoefficient((int)code, type_groud, (float)min_volume, (float)max_volume, (float)min_angle, (float)max_angle, (float)koef); if (EGH01DB.Primitives.SpreadingCoefficient.Create(db, sc)) { view = View("SpreadingCoefficient", db); } else if (menuitem.Equals("SpreadingCoefficient.Create.Cancel")) { view = View("SpreadingCoefficient", db); } } else if (menuitem.Equals("SpreadingCoefficient.Create.Cancel")) { view = View("SpreadingCoefficient", db); } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult SpreadingCoefficient() { RGEContext db = null; ActionResult view = View("Index"); ViewBag.EGHLayout = "RGE.SpreadingCoefficient"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("SpreadingCoefficient", db); if (menuitem.Equals("SpreadingCoefficient.Create")) { view = View("SpreadingCoefficientCreate"); } else if (menuitem.Equals("SpreadingCoefficient.Delete")) { string code = this.HttpContext.Request.Params["code"]; if (code != null) { int c = 0; if (int.TryParse(code, out c)) { EGH01DB.Primitives.SpreadingCoefficient sc = new EGH01DB.Primitives.SpreadingCoefficient(); if (EGH01DB.Primitives.SpreadingCoefficient.GetByCode(db, c, out sc)) { view = View("SpreadingCoefficientDelete", sc); } } } } else if (menuitem.Equals("SpreadingCoefficient.Update")) { string code = this.HttpContext.Request.Params["code"]; if (code != null) { int c = 0; if (int.TryParse(code, out c)) { SpreadingCoefficient sc = new SpreadingCoefficient(); if (EGH01DB.Primitives.SpreadingCoefficient.GetByCode(db, c, out sc)) { view = View("SpreadingCoefficientUpdate", sc); } } } } else if (menuitem.Equals("SpreadingCoefficient.Excel")) { EGH01DB.Primitives.SpreadingCoefficientList list = new SpreadingCoefficientList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/SpreadingCoefficient.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/SpreadingCoefficient.xml"), "text/plain", "Коэффициент растекания.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public JsonResult CreateFromECO(EGH01.Models.EGHMAP.MapPointView mp) { ViewBag.EGHLayout = "MAP"; RGEContext db = null; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; ActionResult view = View("EGHMAPECO"); db = new RGEContext(); view = View("EGHMAPECO", db); String Latitude = mp.Latitude; ViewData["Latitude"] = Latitude; String Lat_m = mp.Lat_m; ViewData["Lat_m"] = Lat_m; String Lat_s = mp.Lat_s; ViewData["Lat_s"] = Lat_s; String Lngitude = mp.Lngitude; ViewData["Lngitude"] = Lngitude; String Lng_m = mp.Lng_m; ViewData["Lng_m"] = Lng_m; String Lng_s = mp.Lng_s; ViewData["Lng_s"] = Lng_s; float coords = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Latitude), int.Parse(Lat_m), float.Parse(Lat_s)); float coordm = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Lngitude), int.Parse(Lng_m), float.Parse(Lng_s)); EGH01DB.Primitives.Coordinates mapPoint = new Coordinates(coordm, coords); EGH01DB.Types.District district = new District(); EGH01DB.Primitives.MapHelper.GetRegion(db, mapPoint, out district); ViewData["district"] = district.name; ViewData["region"] = district.region.name; string nationalpark = ""; string nationalpark_type = ""; string nationalpark_subtype = ""; string nationalpark_city = ""; EGH01DB.Primitives.MapHelper.GetEcoNational(db, mapPoint, out nationalpark, out nationalpark_type, out nationalpark_subtype, out nationalpark_city); // blinova - поправить метод string republicpoint = ""; string republicpoly = ""; string republic = ""; EGH01DB.Primitives.MapHelper.GetEcoRepublic(db, mapPoint, out republic); string local = ""; EGH01DB.Primitives.MapHelper.GetEcoLocal(db, mapPoint, out local); var heights = new { District = district.name, Region = district.region.name, Republic = republic, Local = local, Nationalpark = nationalpark, Nationalparktype = nationalpark_type, Nationalparksubtype = nationalpark_subtype, Nationalparkcity = nationalpark_city, Republicpoint = republicpoint, Republicpoly = republicpoly }; return(Json(heights)); }
public GroundBlur(SpreadPoint spreadpoint) { this.spreadpoint = spreadpoint; RGEContext db = new RGEContext(); // заглушка, выставить правильный контекст //blinova this.bordercoordinateslist = new CoordinatesList(); if (this.spreadpoint.groundtype.watercapacity >= this.spreadpoint.groundtype.porosity) { throw new EGHDBException(string.Format(errormssageformat, "Влагоемкость грунта не может быть больше или равна пористости")); } if (this.spreadpoint.groundtype.watercapacity >= this.spreadpoint.groundtype.soilmoisture) { throw new EGHDBException(string.Format(errormssageformat, "Влагоемкость грунта не может быть больше или равна влажности грунта")); } if (this.spreadpoint.petrochemicaltype.tension <= 0) { throw new EGHDBException(string.Format(errormssageformat, "Коэффициент поверностного натяжение нефтеродукта не может быть меньше или равным нулю ")); } { // коэф. разлива float k = SpreadingCoefficient.GetByData(db, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, this.spreadpoint.volume, 0.0f); this.spreadingcoefficient = new SpreadingCoefficient(0, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, 0.0f, this.spreadpoint.volume, 0.0f, 0.02f, k); } if (this.spreadingcoefficient.koef <= 0.0f) { //this.spreadingcoefficient = new SpreadingCoefficient(0, this.spreadpoint.groundtype, this.spreadpoint.petrochemicaltype, 0.0f, this.spreadpoint.volume, 0.0f, 0.02f, 5.0f); // заглушка throw new EGHDBException(string.Format(errormssageformat, "Коэффициент разлива не может быть меньше или равен нулю")); } { // свойства воды WaterProperties x = new WaterProperties(); // RGEContext db = new RGEContext();// заглушка, выставить правильный контекст //blinova float delta = 0.0f; if (WaterProperties.Get(db, 20.0f, out x, out delta)) { this.waterproperties = x; } } if (this.waterproperties.viscocity <= 0) { throw new EGHDBException(string.Format(errormssageformat, "Вязкость воды не может быть меньше или равным нулю ")); } this.square = this.spreadpoint.volume * this.spreadingcoefficient.koef; // площадь пятна this.radius = (float)Math.Sqrt(square / Math.PI); // радиус пятна this.petrochemicalheight = this.spreadpoint.volume / this.square; // высота слоя разлитого нефтепродукта (м) this.totalmass = this.spreadpoint.volume * this.spreadpoint.petrochemicaltype.density; // масса пролива this.anchorpointlist = AnchorPointList.CreateNear(this.spreadpoint.coordinates, this.radius); this.ecoobjectsearchradius = this.radius; this.ecoobjecstlist = EcoObjectsList.CreateEcoObjectsList(db, this.spreadpoint, this.ecoobjectsearchradius); this.groundpolutionlist = new GroundPollutionList(this.spreadpoint); this.groundpolutionlist.AddRange(this.spreadpoint, this.anchorpointlist, this.spreadpoint.petrochemicaltype); this.groundpolutionlist.AddRange(this.spreadpoint, this.ecoobjecstlist, this.spreadpoint.petrochemicaltype); // переделать как метод this.groundpolutionlist this.avgdeep = // средняя глубина грунтовых вод по опорным точкам и техногенному объекту ( anchorpointlist.sumwaterdeep + (this.spreadpoint.riskobject != null ? this.spreadpoint.waterdeep : 0.0f) ) / (anchorpointlist.Count + 1); this.limitadsorbedmass = // максиальная маса нефтепродукта, кот. может быть адсорбирована грунтом (кг) this.avgdeep * // средняя глубина грутовы вод this.square * // площадь пролива this.waterproperties.density * // плотность воды this.spreadpoint.groundtype.porosity * (0.01f) * // пористость грунта * 0.01 (smw 2017.06.18) this.spreadpoint.groundtype.watercapacity * // капилярная влагоемкость грунта // максиальная маса нефтепродукта, кот. может быть адсорбирована грунтом (кг) (float)Math.Pow(this.spreadpoint.petrochemicaltype.dynamicviscosity, 2) * // динамическая вязкость this.waterproperties.tension / // коэфициент поверхностного натяжения воды ( this.spreadpoint.petrochemicaltype.tension * // коэфициент поверхностного натяжения нефтепродукта (float)Math.Pow(this.waterproperties.viscocity, 2) // вязкость воды ); this.adsorbedmass = (limitadsorbedmass >= this.totalmass ? this.totalmass : limitadsorbedmass); // адсорбированная масса нефтепродукта в грунте т - М1 this.restmass = (this.adsorbedmass >= this.totalmass ? 0 : this.totalmass - this.adsorbedmass); // масса нефтепродукта достигшая грунтовых вод this.depth = (this.restmass > 0 ? this.avgdeep : (float)Math.Round(this.avgdeep * (this.totalmass / this.limitadsorbedmass), 3)); // глубина проникновения нефтепродукта в грунт if (this.depth > 0) // если глубина проникновения > 0 { this.concentrationinsoil = // средняя концентрация нефтепродуктов в грунте this.adsorbedmass / // адсорбированная масса нефтепродукта в грунте ( this.square * // площадь пятна this.depth * // глубина проникновения нефтепродукта в грунт this.spreadpoint.groundtype.density // средняя плотность грунта ); } else { this.concentrationinsoil = 0.0f; } { // вертикальная скорость проникновения нефтепродукта в грунт (м/с) float ka = // формула аверьянова this.spreadpoint.groundtype.waterfilter * // коэф. фильтрации воды ( this.spreadpoint.groundtype.soilmoisture - // влажность грунта this.spreadpoint.groundtype.watercapacity // капилярная влагоемкость грунта ) / ( this.spreadpoint.groundtype.porosity - // пористость грунта this.spreadpoint.groundtype.watercapacity // капилярная влагоемкость грунта ); float r = // коэффициент задержки ( this.spreadpoint.petrochemicaltype.dynamicviscosity * // вязкость нефтепродукта this.waterproperties.density // плотность воды ) / ( this.waterproperties.viscocity * // вязкость воды this.spreadpoint.petrochemicaltype.density // плотность нефтепродукта ); this.speedvertical = this.petrochemicalheight * // А.Авхимович: высота слоя разлитого нефтепродукта (м) // вы (ka / r); // вертикальная скорость проникновения нефтепродукта в грунт (м/с) } this.timeconcentrationinsoil = // время достижения усреднееной концентации в грунте this.depth / // глубина проникновения нефтепродукта в грунт this.speedvertical; // вертикальная скорость проникновения нефтепродукта в грунт (м/с) if (this.restmass > 0) { this.timewatercomletion = // время продвижения нефтепродукта до грунтовых вод this.avgdeep / // средняя глубина грунтовых вод по опорным точкам (м) this.speedvertical; // вертикальная скорость проникновения нефтепродукта в грунт (м/с) this.dtimemaxwaterconc = // время (с) достижения максимальной концентрации нефтепродуктом грунтовых вод после достиженич границы грунтовых вод this.petrochemicalheight / // высота слоя разлитого нефтепродукта (м) ( this.speedvertical * // вертикальная скорость проникновения нефтепродукта в грунт (м/с) this.spreadpoint.groundtype.porosity // пористость грунта ); this.timemaxwaterconc = this.timewatercomletion + this.dtimemaxwaterconc; // время (с) достижения максимальной концентрации на уровне грунтовых вод } else { this.timewatercomletion = Const.TIME_INFINITY; // никогда this.dtimemaxwaterconc = Const.TIME_INFINITY; // никогда this.timemaxwaterconc = Const.TIME_INFINITY; // никогда } { if (restmass > 0) // если не все адсорбировалось в грунте { this.ozcorrection = // OZ-поправка this.petrochemicalheight * // высота слоя разлитого нефтепродукта (м) this.restmass / // масса нефтепродукта достигшая грунтовых вод (кг) this.totalmass; // масса пролива (кг) this.maxconcentrationwater = (float) // максимальной концентрация на уровне грунтовых вод кг/м3 ( this.restmass / // масса нефтепродукта достигшая грунтовых вод (кг) (Math.PI * this.radius * this.radius) * 1.0f // объем воды / (this.ozcorrection * Math.Sqrt(2 * Math.PI)) // поправка 0Z ); } else // если все адсорбировалось в грунте { this.ozcorrection = 0.0f; this.maxconcentrationwater = 0.0f; } } }
public JsonResult CreateFrom2(EGH01.Models.EGHMAP.MapPointView mp) { ViewBag.EGHLayout = "MAP"; RGEContext db = null; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; ActionResult view = View("EGHMAPsoil"); db = new RGEContext(); view = View("EGHMAPsoil", db); String Latitude = mp.Latitude; ViewData["Latitude"] = Latitude; String Lat_m = mp.Lat_m; ViewData["Lat_m"] = Lat_m; String Lat_s = mp.Lat_s; ViewData["Lat_s"] = Lat_s; String Lngitude = mp.Lngitude; ViewData["Lngitude"] = Lngitude; String Lng_m = mp.Lng_m; ViewData["Lng_m"] = Lng_m; String Lng_s = mp.Lng_s; ViewData["Lng_s"] = Lng_s; float coords = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Latitude), int.Parse(Lat_m), float.Parse(Lat_s)); float coordm = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Lngitude), int.Parse(Lng_m), float.Parse(Lng_s)); EGH01DB.Primitives.Coordinates mapPoint = new Coordinates(coordm, coords); EGH01DB.Types.District district = new District(); EGH01DB.Primitives.MapHelper.GetRegion(db, mapPoint, out district); ViewData["district"] = district.name; ViewData["region"] = district.region.name; string protection_level = ""; EGH01DB.Primitives.MapHelper.GetGroundWaterMapProtectLevel(db, mapPoint, out protection_level); string self_cleaning_zone = ""; EGH01DB.Primitives.MapHelper.GetSelfCleaningZone(db, mapPoint, out self_cleaning_zone); string protect_zone = ""; int protect_grade = 0; EGH01DB.Primitives.MapHelper.GetGroundProtectZone(db, mapPoint, out protect_zone, out protect_grade); var heights = new { District = district.name, Region = district.region.name, Protectionlevel = protection_level, Selfcleaningzone = self_cleaning_zone, Protectzone = protect_zone, Protectgrade = protect_grade }; return(Json(heights)); }
public static ForecastViewConext Handler(RGEContext context, NameValueCollection parms) { ForecastViewConext viewcontext = context.GetViewContext(VIEWNAME) as ForecastViewConext; if (viewcontext == null) { context.SaveViewContext(new RGEContext.ViewContextEntry(ForecastViewConext.VIEWNAME, viewcontext = new ForecastViewConext(context))); } if (viewcontext.Regim != REGIM.INIT) { viewcontext.Regim = REGIM.CHOICE; string date = parms["date"]; if (String.IsNullOrEmpty(date)) { viewcontext.Regim = REGIM.ERROR; } else { DateTime incident_date = DateTime.MinValue; if (DateTime.TryParse(date, out incident_date)) { viewcontext.Incident_date = (DateTime?)incident_date; } else { viewcontext.Regim = REGIM.ERROR; } } string date_message = parms["date_message"]; if (String.IsNullOrEmpty(date_message)) { viewcontext.Regim = REGIM.ERROR; } else { DateTime incident_date_message = DateTime.MinValue; if (DateTime.TryParse(date_message, out incident_date_message)) { viewcontext.Incident_date_message = (DateTime?)incident_date_message; } else { viewcontext.Regim = REGIM.ERROR; } } string parmpetrochemicaltype = parms["petrochemicaltype"]; if (String.IsNullOrEmpty(parmpetrochemicaltype)) { viewcontext.Regim = REGIM.ERROR; } else { int code = -1; if (int.TryParse(parmpetrochemicaltype, out code)) { if (viewcontext.petrochemicaltype == null || viewcontext.petrochemicaltype.code_type != code) { viewcontext.petrochemicaltype = new PetrochemicalType(); if (!PetrochemicalType.GetByCode(context, code, ref viewcontext.petrochemicaltype)) { viewcontext.Regim = REGIM.ERROR; } } } else { viewcontext.Regim = REGIM.ERROR; } } string incidenttype = parms["incidenttype"]; if (String.IsNullOrEmpty(incidenttype)) { viewcontext.Regim = REGIM.ERROR; } else { int code = -1; if (int.TryParse(incidenttype, out code)) { viewcontext.Incident_type_code = (int?)code; if (viewcontext.incidenttype == null || viewcontext.incidenttype.type_code != code) { if (!IncidentType.GetByCode(context, code, out viewcontext.incidenttype)) { viewcontext.Regim = REGIM.ERROR; } } } else { viewcontext.Regim = REGIM.ERROR; } } string volume = parms["volume"]; if (String.IsNullOrEmpty(volume)) { viewcontext.Regim = REGIM.ERROR; } else { float v = 0.0f; if (float.TryParse(volume, out v)) { viewcontext.Volume = (float?)v; } else { viewcontext.Regim = REGIM.ERROR; } } string temperature = parms["temperature"]; if (String.IsNullOrEmpty(temperature)) { viewcontext.Regim = REGIM.ERROR; } else { float t = 0.0f; if (float.TryParse(temperature, out t)) { viewcontext.Temperature = (float?)t; } else { viewcontext.Regim = REGIM.ERROR; } } if (viewcontext.Regim == REGIM.CHOICE) { viewcontext.Regim = REGIM.SET; } } else { viewcontext.Regim = REGIM.CHOICE; } return(viewcontext); }
public JsonResult CreateFromSoil(EGH01.Models.EGHMAP.MapPointView mp) { ViewBag.EGHLayout = "MAP"; RGEContext db = null; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; ActionResult view = View("EGHMAPsoil"); db = new RGEContext(); view = View("EGHMAPsoil", db); String Latitude = mp.Latitude; ViewData["Latitude"] = Latitude; String Lat_m = mp.Lat_m; ViewData["Lat_m"] = Lat_m; String Lat_s = mp.Lat_s; ViewData["Lat_s"] = Lat_s; String Lngitude = mp.Lngitude; ViewData["Lngitude"] = Lngitude; String Lng_m = mp.Lng_m; ViewData["Lng_m"] = Lng_m; String Lng_s = mp.Lng_s; ViewData["Lng_s"] = Lng_s; float coords = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Latitude), int.Parse(Lat_m), float.Parse(Lat_s)); float coordm = EGH01DB.Primitives.Coordinates.dms_to_d(int.Parse(Lngitude), int.Parse(Lng_m), float.Parse(Lng_s)); EGH01DB.Primitives.Coordinates mapPoint = new Coordinates(coordm, coords); EGH01DB.Types.District district = new District(); EGH01DB.Primitives.MapHelper.GetRegion(db, mapPoint, out district); ViewData["district"] = district.name; ViewData["region"] = district.region.name; float time_migration = 0.0f; EGH01DB.Primitives.MapHelper.GetTimeMigration(db, mapPoint, out time_migration); string aeration_power = ""; float average_aeration_power = 0.0f; float max_aeration_power = 0.0f; string litology = ""; EGH01DB.Primitives.MapHelper.GetAerationZone(db, mapPoint, out aeration_power, out average_aeration_power, out max_aeration_power, out litology); float height = 0.0f; EGH01DB.Primitives.MapHelper.GetHeight(db, mapPoint, out height); EGH01DB.Types.SoilType soilType = new SoilType(); EGH01DB.Primitives.MapHelper.GetSoil(db, mapPoint, out soilType); EGH01DB.Primitives.Climat climat = new Climat(db, mapPoint); EGH01DB.Primitives.MapHelper.GetMonthTemperature(db, mapPoint, out climat); float[] period = climat.temperature; EGH01DB.Types.GroundType ground_type = new GroundType(); EGH01DB.Primitives.MapHelper.GetGroundCoef(db, mapPoint, out ground_type); var heights = new { Soilname = soilType.name, Soilmehsost = soilType.mehsost, Soiltype = soilType.soil_type, Soilsubtype = soilType.soil_subtype, Humidity = soilType.humidity, Gumusdepth = soilType.gumus_depth, Capmoisturecapacity = soilType.watercapacity, Petrolfiltrationcoef = soilType.petrol_filtration_coef, Fueloilfiltrationcoef = soilType.fuel_oil_filtration_coef, Dieselfiltrationcoef = soilType.diesel_filtration_coef, Hydrolyticacidity = soilType.hydrolytic_acidity, Oilcapacity = soilType.oil_capacity, Density = soilType.density, Carboncontent = soilType.carbon_content, Filtercoefinterval = soilType.filter_coef_interval, Porosityinterval = soilType.porosity_interval, Glinainterval = soilType.glina_interval, Mginterval = soilType.mg_interval, Phinterval = soilType.ph_interval, Densityinterval = soilType.density, Maxmoisturecapacityinterval = soilType.max_moisture_capacity_interval, Gumuspercentageinterval = soilType.gumus_percentage_interval, Klass = soilType.klass, Soiltypecode = soilType.soil_class_code, Wrbcode = soilType.wrb_code, Wrbnewcode = soilType.wrb_new_code, Rgbcode = soilType.rgb_code, Shtrihovka = soilType.shtrihovka, Height = height, Aeration_power = aeration_power, Average_aeration_power = average_aeration_power, Max_aeration_power = max_aeration_power, Litology = litology, Time_migration = time_migration, District = district.name, Region = district.region.name, Watercapacity = ground_type.watercapacity, Porosity = ground_type.porosity, Waterfilter = ground_type.waterfilter, Period = period }; return(Json(heights)); }
// найти список точек в заданном радиусе public static AnchorPointList CreateNear(Coordinates center, float distance) { bool rc = false; RGEContext db = new RGEContext(); AnchorPointList anchor_point_list = new AnchorPointList(); using (SqlCommand cmd = new SqlCommand("EGH.GetListAnchorPointOnDistanceLessThanD", db.connection)) { cmd.CommandType = CommandType.StoredProcedure; { SqlParameter parm = new SqlParameter("@ШиротаГрад", SqlDbType.Real); parm.Value = center.latitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@ДолготаГрад", SqlDbType.Real); parm.Value = center.lngitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@Расстояние", SqlDbType.Real); parm.Value = distance; cmd.Parameters.Add(parm); } try { //cmd.ExecuteNonQuery(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = (int)reader["IdОпорнойГеологическойТочки"]; float x = (float)reader["ШиротаГрад"]; float y = (float)reader["ДолготаГрад"]; int ground_type_code = (int)reader["ТипГрунта"]; float waterdeep = (float)reader["ГлубинаГрунтовыхВод"]; float height = (float)reader["ВысотаУровнемМоря"]; GroundType ground_type = new GroundType(ground_type_code); Coordinates coordinates = new Coordinates((float)x, (float)y); int cadastre_type_code = (int)reader["КодНазначенияЗемель"]; string ground_type_name = (string)reader["НаименованиеНазначенияЗемель"]; float pdk_koef = (float)reader["ПДК"]; float water_pdk_koef = (float)reader["ПДКводы"]; string pdk_korf_doc = (string)reader["НормДокументЗемля"]; string water_pdk_korf_doc = (string)reader["НормДокументВода"]; CadastreType cadastre_type = new CadastreType(cadastre_type_code, ground_type_name, pdk_koef, water_pdk_koef, pdk_korf_doc, water_pdk_korf_doc); Point point = new Point(coordinates, ground_type, (float)waterdeep, (float)height); //delta = (float)reader["Расстояние"]; AnchorPoint anchor_point = new AnchorPoint(id, point, cadastre_type); anchor_point_list.Add(anchor_point); } rc = anchor_point_list.Count > 0; reader.Close(); } catch (Exception e) { rc = false; }; return(anchor_point_list); } }
public ActionResult IncidentType() { ViewBag.EGHLayout = "RGE.IncidentType"; RGEContext db = null; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); //ViewBag.msg = "Соединение с базой данных установлено"; // debug view = View("IncidentType", db); if (menuitem.Equals("IncidentType.Create")) { view = View("IncidentTypeCreate"); } else if (menuitem.Equals("IncidentType.Delete")) { string type_code_item = this.HttpContext.Request.Params["type_code"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { IncidentType it = new IncidentType(); if (EGH01DB.Types.IncidentType.GetByCode(db, c, out it)) { view = View("IncidentTypeDelete", it); } } } } else if (menuitem.Equals("IncidentType.Update")) { string type_code_item = this.HttpContext.Request.Params["type_code"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { IncidentType it = new IncidentType(); if (EGH01DB.Types.IncidentType.GetByCode(db, c, out it)) { view = View("IncidentTypeUpdate", it); } } } } else if (menuitem.Equals("IncidentType.Excel")) { EGH01DB.Types.IncidentTypeList list = new IncidentTypeList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/IncidentType.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/IncidentType.xml"), "text/plain", "Типы инцидентов.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EcoObjectCreate(EGH01.Models.EGHRGE.EcoObjectView eo) { RGEContext db = null; ViewBag.EGHLayout = "RGE.EcoObject"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); view = View("EcoObject", db); if (menuitem.Equals("EcoObjectCreateEco.Create")) { view = View("EcoObjectCreateEco"); return(view); } if (menuitem.Equals("EcoObject.Create.Create")) { int id = -1; if (EGH01DB.Objects.EcoObject.GetNextId(db, out id)) { String name = eo.name; CadastreType type_cadastre = new CadastreType(); if (EGH01DB.Types.CadastreType.GetByCode(db, eo.list_cadastre, out type_cadastre)) { EcoObjectType eco_type = new EcoObjectType(); if (EGH01DB.Types.EcoObjectType.GetByCode(db, eo.list_ecoType, out eco_type)) { bool iswaterobject = eo.iswaterobject; string strlat_s = this.HttpContext.Request.Params["lat_s"] ?? "Empty"; string strlng_s = this.HttpContext.Request.Params["lng_s"] ?? "Empty"; string strwaterdeep = this.HttpContext.Request.Params["waterdeep"] ?? "Empty"; string strheight = this.HttpContext.Request.Params["height"] ?? "Empty"; float lat_s = 0.0f; float lng_s = 0.0f; float waterdeep = 0.0f; float height = 0.0f; if (!Helper.FloatTryParse(strlat_s, out lat_s)) { lat_s = 0.0f; } if (!Helper.FloatTryParse(strlng_s, out lng_s)) { lng_s = 0.0f; } if (!Helper.FloatTryParse(strwaterdeep, out waterdeep)) { waterdeep = 0.0f; } if (!Helper.FloatTryParse(strheight, out height)) { height = 0.0f; } Coordinates coordinates = new Coordinates(eo.latitude, eo.lat_m, lat_s, eo.lngitude, eo.lng_m, lng_s); EGH01DB.Types.GroundType ground_type = new EGH01DB.Types.GroundType(); if (EGH01DB.Types.GroundType.GetByCode(db, eo.list_groundType, out ground_type)) { Point point = new Point(coordinates, ground_type, waterdeep, height); EGH01DB.Objects.EcoObject eco_object = new EGH01DB.Objects.EcoObject(id, point, eco_type, type_cadastre, name, iswaterobject); if (EGH01DB.Objects.EcoObject.Create(db, eco_object)) { view = View("EcoObject", db); } } } } else if (menuitem.Equals("EcoObject.Create.Cancel")) { view = View("EcoObject", db); } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public static bool Handler(RGEContext context, NameValueCollection parms) { bool rc = false; GroundTypeView viewcontext = null; string menuitem = parms["menuitem"] ?? "Empty"; if ((viewcontext = context.GetViewContext(VIEWNAME) as GroundTypeView) != null) { viewcontext.Regim = REGIM.INIT; string namec = parms["name"]; if (String.IsNullOrEmpty(namec)) { viewcontext.Regim = REGIM.ERROR; } else { viewcontext.name = namec; } string Diffusion = parms["diffusion"]; if (String.IsNullOrEmpty(Diffusion)) { viewcontext.Regim = REGIM.ERROR; } else { float d = 0.0f; if (Helper.FloatTryParse(Diffusion, out d)) { viewcontext.diffusion = d; } } string Porosity = parms["porosity"]; if (String.IsNullOrEmpty(Porosity)) { viewcontext.Regim = REGIM.ERROR; } else { float p = 0.0f; if (Helper.FloatTryParse(Porosity, out p)) { viewcontext.porosity = p; } } string Soilmoisture = parms["soilmoisture"]; if (String.IsNullOrEmpty(Soilmoisture)) { viewcontext.Regim = REGIM.ERROR; } else { float s = 0.0f; if (Helper.FloatTryParse(Soilmoisture, out s)) { viewcontext.soilmoisture = s; } } string Watercapacity = parms["watercapacity"]; if (String.IsNullOrEmpty(Watercapacity)) { viewcontext.Regim = REGIM.ERROR; } else { float w = 0.0f; if (Helper.FloatTryParse(Watercapacity, out w)) { viewcontext.watercapacity = w; } } string Holdmigration = parms["holdmigration"]; if (String.IsNullOrEmpty(Holdmigration)) { viewcontext.Regim = REGIM.ERROR; } else { float h = 0.0f; if (Helper.FloatTryParse(Holdmigration, out h)) { viewcontext.holdmigration = h; } } string Waterfilter = parms["waterfilter"]; if (String.IsNullOrEmpty(Waterfilter)) { viewcontext.Regim = REGIM.ERROR; } else { float wa = 0.0f; if (Helper.FloatTryParse(Waterfilter, out wa)) { viewcontext.waterfilter = wa; } } string Averyanovfactor = parms["аveryanovfactor"]; if (String.IsNullOrEmpty(Averyanovfactor)) { viewcontext.Regim = REGIM.ERROR; } else { float a = 0.0f; if (Helper.FloatTryParse(Averyanovfactor, out a)) { viewcontext.аveryanovfactor = a; } } string Density = parms["density"]; if (String.IsNullOrEmpty(Density)) { viewcontext.Regim = REGIM.ERROR; } else { float de = 0.0f; if (Helper.FloatTryParse(Density, out de)) { viewcontext.density = de; } } string Distribution = parms["distribution"]; if (String.IsNullOrEmpty(Distribution)) { viewcontext.Regim = REGIM.ERROR; } else { float di = 0.0f; if (Helper.FloatTryParse(Distribution, out di)) { viewcontext.distribution = di; } } string Sorption = parms["sorption"]; if (String.IsNullOrEmpty(Sorption)) { viewcontext.Regim = REGIM.ERROR; } else { float so = 0.0f; if (Helper.FloatTryParse(Sorption, out so)) { viewcontext.sorption = so; } } string Permeability = parms["permeability"]; if (String.IsNullOrEmpty(Permeability)) { viewcontext.Regim = REGIM.ERROR; } else { float pe = 0.0f; if (Helper.FloatTryParse(Permeability, out pe)) { viewcontext.permeability = pe; } } } return(rc); }
// GET: EGHRGEController_Report public ActionResult Report() { RGEContext db = null; ViewBag.EGHLayout = "RGE.Report"; ActionResult view = View("Index"); ViewBag.stage = "П"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("Report", db); if (menuitem.Equals("Report.Watch")) { string id = this.HttpContext.Request.Params["id"]; string comment = this.HttpContext.Request.Params["comment"]; if (id != null) { int c = 0; if (int.TryParse(id, out c)) { EGH01DB.Primitives.Report report = new EGH01DB.Primitives.Report(); if (EGH01DB.Primitives.Report.GetById(db, c, out report, out comment)) { EGH01.Models.EGHRGE.ReportView rv = new ReportView(); rv.rep = report.ToHTML(); ViewBag.msg = rv.rep; view = View("ReportWatch", report); } } } } else if (menuitem.Equals("Report.Delete")) { string id = this.HttpContext.Request.Params["id"]; string comment = this.HttpContext.Request.Params["comment"]; if (id != null) { int c = 0; if (int.TryParse(id, out c)) { EGH01DB.Primitives.Report report = new EGH01DB.Primitives.Report(); if (EGH01DB.Primitives.Report.GetById(db, c, out report, out comment)) { view = View("ReportDelete", report); } } } } else if (menuitem.Equals("Report.SaveComment")) { string id = this.HttpContext.Request.Params["id"]; string comment; if (id != null) { int c = 0; if (int.TryParse(id, out c)) { Report report = new Report(); if (EGH01DB.Primitives.Report.GetById(db, c, out report, out comment)) { comment = this.HttpContext.Request.Params["comment"]; EGH01DB.Primitives.Report.UpdateCommentById(db, c, comment); view = View("Report", db); } } } } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EcoObject() { RGEContext db = null; ViewBag.EGHLayout = "RGE.EcoObject"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new RGEContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("EcoObject", db); if (menuitem.Equals("EcoObject.Create")) { view = View("EcoObjectCreate"); } else if (menuitem.Equals("EcoObject.Delete")) { string id = this.HttpContext.Request.Params["type_code"]; if (id != null) { int c = 0; if (int.TryParse(id, out c)) { EGH01DB.Objects.EcoObject eo = new EGH01DB.Objects.EcoObject(); if (EGH01DB.Objects.EcoObject.GetById(db, c, ref eo)) { view = View("EcoObjectDelete", eo); } } } } else if (menuitem.Equals("EcoObject.Update")) { string id = this.HttpContext.Request.Params["type_code"]; if (id != null) { int c = 0; if (int.TryParse(id, out c)) { EGH01DB.Objects.EcoObject eo = new EGH01DB.Objects.EcoObject(); if (EGH01DB.Objects.EcoObject.GetById(db, c, ref eo)) { view = View("EcoObjectUpdate", eo); } } } } else if (menuitem.Equals("EcoObject.Excel")) { EGH01DB.Objects.EcoObjectsList list = new EGH01DB.Objects.EcoObjectsList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/EcoObject.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/EcoObject.xml"), "text/plain", "Природоохранные объекты.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }