public ActionResult ChoiceClassificationResult() { ViewBag.EGHLayout = "ORT"; ORTContext db = null; ActionResult view = View("Index", db); try { db = new ORTContext(this); view = View(db); ORTContextView context = ORTContextView.HandlerChoice(db, this.Request.Params); switch (context.Regim) { case ORTContextView.REGIM.INIT: view = View(db); break; case ORTContextView.REGIM.CHOICE: view = View("Index", db); context.Regim = ORTContextView.REGIM.INIT; break; case ORTContextView.REGIM.CANCEL: view = View("Index", db); context.Regim = ORTContextView.REGIM.INIT; break; default: view = View(db); break; } } catch (RGEContext.Exception e) //ORTContext.Exception { ViewBag.msg = e.Message; } finally { //if (db != null) db.Disconnect(); } return(view); }
public ActionResult WaterProtectionAreaDelete(int type_code) { ORTContext db = null; ViewBag.EGHLayout = "ORT.WaterProtectionArea"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); if (menuitem.Equals("WaterProtectionArea.Delete.Delete")) { if (EGH01DB.Types.WaterProtectionArea.DeleteByCode(db, type_code)) view = View("WaterProtectionArea", db); } else if (menuitem.Equals("WaterProtectionArea.Delete.Cancel")) view = View("WaterProtectionArea", db); } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return view; }
public ActionResult Rehabilitation() { ViewBag.EGHLayout = "ORT"; ORTContext db = null; ActionResult view = View("Index", db); try { db = new ORTContext(this); ORTContextView context = ORTContextView.HandlerRehabilitation(db, this.Request.Params); switch (context.Regim) { case ORTContextView.REGIM.REPORT: view = View(db); break; case ORTContextView.REGIM.SAVE: ORTContext.ECORehabilitation.Create(db, context.ecorehabilitation); view = View("Index", db); break; case ORTContextView.REGIM.CANCEL: view = View("Index", db); break; default: view = View(db); break; } } catch (RGEContext.Exception e) //ORTContext.Exception { ViewBag.msg = e.Message; } finally { //if (db != null) db.Disconnect(); } return(view); }
public ActionResult WaterProtectionAreaUpdate(WaterProtectionAreaView pcv) { ORTContext db = null; ViewBag.EGHLayout = "ORT.WaterProtectionArea"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); if (menuitem.Equals("WaterProtectionArea.Update.Update")) { int type_code = pcv.type_code; string name = pcv.name; WaterProtectionArea pc = new WaterProtectionArea(type_code, name); if (EGH01DB.Types.WaterProtectionArea.Update(db, pc)) view = View("WaterProtectionArea", db); } else if (menuitem.Equals("WaterProtectionArea.Update.Cancel")) view = View("WaterProtectionArea", db); } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return view; }
public ActionResult EmergencyClassDelete(int type_code) { ORTContext db = null; ViewBag.EGHLayout = "ORT.EmergencyClass"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); if (menuitem.Equals("EmergencyClass.Delete.Delete")) { if (EGH01DB.Types.EmergencyClass.DeleteByCode(db, type_code)) { view = View("EmergencyClass", db); } } else if (menuitem.Equals("EmergencyClass.Delete.Cancel")) { view = View("EmergencyClass", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult PenetrationDepthUpdate(PenetrationDepthView sp) { ORTContext db = null; ViewBag.EGHLayout = "ORT.PenetrationDepth"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); view = View("PenetrationDepth", db); if (menuitem.Equals("PenetrationDepth.Update.Update")) { int code = sp.code; String name = sp.name; string strmindepth = this.HttpContext.Request.Params["mindepth"] ?? "Empty"; string strmaxdepth = this.HttpContext.Request.Params["maxdepth"] ?? "Empty"; float mindepth = 0.0f; float maxdepth = 0.0f; if (!Helper.FloatTryParse(strmindepth, out mindepth)) { mindepth = 0.0f; } if (!Helper.FloatTryParse(strmaxdepth, out maxdepth)) { maxdepth = 0.0f; } EGH01DB.Types.PenetrationDepth penetration = new EGH01DB.Types.PenetrationDepth(code, name, mindepth, maxdepth); if (EGH01DB.Types.PenetrationDepth.Update(db, penetration)) { view = View("PenetrationDepth", db); } } else if (menuitem.Equals("PenetrationDepth.Update.Cancel")) { view = View("PenetrationDepth", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public static bool Handler(ORTContext context, NameValueCollection parms) { bool rc = false; PenetrationDepthView viewcontext = null; string menuitem = parms["menuitem"] ?? "Empty"; if ((viewcontext = context.GetViewContext("PenetrationDepthCreate") as PenetrationDepthView) != null) { viewcontext.Regim = REGIM.INIT; string Name = parms["name"]; if (String.IsNullOrEmpty(Name)) { viewcontext.Regim = REGIM.ERROR; } else { viewcontext.name = Name; } string Min = parms["mindepth"]; if (String.IsNullOrEmpty(Min)) { viewcontext.Regim = REGIM.ERROR; } else { float m = 0.0f; if (Helper.FloatTryParse(Min, out m)) { viewcontext.mindepth = m; } } string Max = parms["maxdepth"]; if (String.IsNullOrEmpty(Max)) { viewcontext.Regim = REGIM.ERROR; } else { float mx = 0.0f; if (Helper.FloatTryParse(Max, out mx)) { viewcontext.maxdepth = mx; } } } return(rc); }
public ActionResult SoilCleaningMethodCreate(SoilCleaningMethodView scmv) { ORTContext db = null; ViewBag.EGHLayout = "ORT.SoilCleaningMethod"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); view = View("SoilCleaningMethod", db); if (menuitem.Equals("SoilCleaningMethod.Create.Create")) { int id = -1; if (EGH01DB.Types.SoilCleaningMethod.GetNextCode(db, out id)) { int type_code = scmv.type_code; string method_description = scmv.method_description; SoilCleaningMethod scm = new SoilCleaningMethod(type_code, method_description); if (EGH01DB.Types.SoilCleaningMethod.Create(db, scm)) { view = View("SoilCleaningMethod", db); } else if (menuitem.Equals("SoilCleaningMethod.Create.Cancel")) { view = View("SoilCleaningMethod", db); } } } else if (menuitem.Equals("SoilCleaningMethod.Create.Cancel")) { view = View("SoilCleaningMethod", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EmergencyClassUpdate(EmergencyClassView ecv) { ORTContext db = null; ViewBag.EGHLayout = "ORT.EmergencyClass"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); if (menuitem.Equals("EmergencyClass.Update.Update")) { int type_code = ecv.type_code; string name = ecv.name; string strminmass = this.HttpContext.Request.Params["minmass"] ?? "Empty"; float minmass; Helper.FloatTryParse(strminmass, out minmass); string strmaxmass = this.HttpContext.Request.Params["maxmass"] ?? "Empty"; float maxmass; Helper.FloatTryParse(strmaxmass, out maxmass); EmergencyClass scm = new EGH01DB.Types.EmergencyClass(type_code, name, minmass, maxmass); if (EGH01DB.Types.EmergencyClass.Update(db, scm)) { view = View("EmergencyClass", db); } } else if (menuitem.Equals("EmergencyClass.Update.Cancel")) { view = View("EmergencyClass", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult Index() { ViewBag.EGHLayout = "ORT"; ORTContext db = null; try { db = new ORTContext(this); } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } finally { //if (db != null) db.Disconnect(); } return(View("Index", db)); }
public static ORTContextView HandlerChoice(ORTContext db, NameValueCollection parms) { ORTContextView rc = db.GetViewContext(VIEWNAME) as ORTContextView; if (rc == null) { db.SaveViewContext(ORTContextView.VIEWNAME, rc = new ORTContextView()); } string menuitem = parms["menuitem"]; if (menuitem != null) { if (menuitem.Equals("ChoiceClassification.Choice")) { rc.Regim = REGIM.CHOICE; if (!string.IsNullOrEmpty(parms["ChoiceClassification.id"])) { int id = 0; if (int.TryParse(parms["ChoiceClassification.id"], out id)) { rc.ecoclassifiation = GEAContext.ECOClassification.GetById(db, (int)(rc.idclassification = id)); } else { rc.ecoclassifiation = null; } } } else if (menuitem.Equals("ChoiceClassification.Cancel")) { rc.Regim = REGIM.CANCEL; } } else { rc.Regim = REGIM.INIT; } return(rc); }
public ActionResult ReportDelete(int id) { ORTContext db = null; ViewBag.EGHLayout = "ORT.Report"; ActionResult view = View("Index"); ViewBag.stage = "Т"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); 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 static ORTContextView HandlerRehabilitation(ORTContext db, NameValueCollection parms) { ORTContextView rc = db.GetViewContext(VIEWNAME) as ORTContextView; if (rc == null) { db.SaveViewContext(ORTContextView.VIEWNAME, rc = new ORTContextView()); } string menuitem = parms["menuitem"]; if (menuitem != null) { if (menuitem.Equals("Report.Save")) { rc.Regim = REGIM.SAVE; } } else if (rc.ecoclassifiation != null) { rc.Regim = REGIM.REPORT; rc.ecorehabilitation = new ORTContext.ECORehabilitation(rc.ecoclassifiation); } return(rc); }
public ActionResult PenetrationDepth() { ORTContext db = null; ViewBag.EGHLayout = "ORT.PenetrationDepth"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); PenetrationDepthView viewcontext = db.GetViewContext(PenetrationDepthView.VIEWNAME) as PenetrationDepthView; ViewBag.msg = "Соединение с базой данных установлено"; view = View("PenetrationDepth", db); if (menuitem.Equals("PenetrationDepth.Create")) { view = View("PenetrationDepthCreate"); //viewcontext.mindepth = null; //viewcontext.maxdepth = null; //viewcontext.name = ""; } else if (menuitem.Equals("PenetrationDepth.Delete")) { string type_code_item = this.HttpContext.Request.Params["id"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { EGH01DB.Types.PenetrationDepth pd = new EGH01DB.Types.PenetrationDepth(); if (EGH01DB.Types.PenetrationDepth.GetByCode(db, c, out pd)) { view = View("PenetrationDepthDelete", pd); } } } } else if (menuitem.Equals("PenetrationDepth.Update")) { string type_code_item = this.HttpContext.Request.Params["id"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { EGH01DB.Types.PenetrationDepth pd = new EGH01DB.Types.PenetrationDepth(); if (EGH01DB.Types.PenetrationDepth.GetByCode(db, c, out pd)) { view = View("PenetrationDepthUpdate", pd); } } } } else if (menuitem.Equals("PenetrationDepth.Excel")) { EGH01DB.Types.PenetrationDepthList pdlist = new EGH01DB.Types.PenetrationDepthList(db); XmlNode node = pdlist.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/PenetrationDepth.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/PenetrationDepth.xml"), "text/plain", "Категории проникновения нефтепродукт.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EmergencyClass() { ORTContext db = null; ActionResult view = View("Index"); ViewBag.EGHLayout = "ORT.EmergencyClass"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("EmergencyClass", db); if (menuitem.Equals("EmergencyClass.Create")) { view = View("EmergencyClassCreate"); } else if (menuitem.Equals("EmergencyClass.Delete")) { string type_code = this.HttpContext.Request.Params["type_code"]; if (type_code != null) { int c = 0; if (int.TryParse(type_code, out c)) { EGH01DB.Types.EmergencyClass scm = new EGH01DB.Types.EmergencyClass(); if (EGH01DB.Types.EmergencyClass.GetByCode(db, c, out scm)) { view = View("EmergencyClassDelete", scm); } } } } else if (menuitem.Equals("EmergencyClass.Update")) { string type_code = this.HttpContext.Request.Params["type_code"]; if (type_code != null) { int c = 0; if (int.TryParse(type_code, out c)) { EmergencyClass scm = new EGH01DB.Types.EmergencyClass(); if (EGH01DB.Types.EmergencyClass.GetByCode(db, c, out scm)) { view = View("EmergencyClassUpdate", scm); } } } } else if (menuitem.Equals("EmergencyClass.Excel")) { EGH01DB.Types.EmergencyClassList list = new EGH01DB.Types.EmergencyClassList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/EmergencyClass.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/EmergencyClass.xml"), "text/plain", "Классификация аварий.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult SoilCleaningMethod() { ORTContext db = null; ActionResult view = View("Index"); ViewBag.EGHLayout = "ORT.SoilCleaningMethod"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("SoilCleaningMethod", db); if (menuitem.Equals("SoilCleaningMethod.Create")) { view = View("SoilCleaningMethodCreate"); } else if (menuitem.Equals("SoilCleaningMethod.Delete")) { string type_code = this.HttpContext.Request.Params["type_code"]; if (type_code != null) { int c = 0; if (int.TryParse(type_code, out c)) { EGH01DB.Types.SoilCleaningMethod scm = new EGH01DB.Types.SoilCleaningMethod(); if (EGH01DB.Types.SoilCleaningMethod.GetByCode(db, c, out scm)) { view = View("SoilCleaningMethodDelete", scm); } } } } else if (menuitem.Equals("SoilCleaningMethod.Update")) { string type_code = this.HttpContext.Request.Params["type_code"]; if (type_code != null) { int c = 0; if (int.TryParse(type_code, out c)) { SoilCleaningMethod scm = new EGH01DB.Types.SoilCleaningMethod(); if (EGH01DB.Types.SoilCleaningMethod.GetByCode(db, c, out scm)) { view = View("SoilCleaningMethodUpdate", scm); } } } } else if (menuitem.Equals("SoilCleaningMethod.Excel")) { EGH01DB.Types.SoilCleaningMethodList list = new EGH01DB.Types.SoilCleaningMethodList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/SoilCleaningMethod.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/SoilCleaningMethod.xml"), "text/plain", "Методы ликвидации загрязнения почвогрунтов.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
// GET: EGHORTController_Report public ActionResult Report() { ORTContext db = null; ViewBag.EGHLayout = "ORT.Report"; ActionResult view = View("Index"); ViewBag.stage = "Т"; string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); 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 Models.EGHRGE.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 PenetrationDepthCreate(PenetrationDepthView pd) { ORTContext db = null; ViewBag.EGHLayout = "ORT.PenetrationDepth"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); if (!PenetrationDepthView.Handler(db, this.HttpContext.Request.Params)) { } view = View("PenetrationDepth", db); if (menuitem.Equals("PenetrationDepth.Create.Create")) { int code = -1; if (EGH01DB.Types.PenetrationDepth.GetNextCode(db, out code)) { float mindepth; string strmindepth = this.HttpContext.Request.Params["mindepth"] ?? "Empty"; if (!Helper.FloatTryParse(strmindepth, out mindepth)) { mindepth = 0.0f; } float maxdepth; string strmaxdepth = this.HttpContext.Request.Params["maxdepth"] ?? "Empty"; if (!Helper.FloatTryParse(strmaxdepth, out maxdepth)) { maxdepth = 0.0f; } String name = pd.name; if (mindepth < maxdepth) { EGH01DB.Types.PenetrationDepth penetration = new EGH01DB.Types.PenetrationDepth(code, name, mindepth, maxdepth); if (EGH01DB.Types.PenetrationDepth.Create(db, penetration)) { view = View("PenetrationDepth", db); } } else { ViewBag.Error = "Проверьте введенные данные"; view = View("PenetrationDepthCreate", db); return(view); } } } else if (menuitem.Equals("PenetrationDepth.Create.Cancel")) { view = View("PenetrationDepth", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult RehabilitationMethodsCreate(RehabilitationMethodsView rm) { ORTContext db = null; ViewBag.EGHLayout = "ORT.RehabilitationMethods"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); view = View("RehabilitationMethods", db); if (menuitem.Equals("RehabilitationMethods.Create.Create")) { int type_code = 2; if (EGH01DB.Types.RehabilitationMethod.GetNextCode(db, out type_code)) { EGH01DB.Types.CadastreType list_cadastre = new EGH01DB.Types.CadastreType(); if (EGH01DB.Types.CadastreType.GetByCode(db, rm.list_cadastre, out list_cadastre)) { EGH01DB.Types.RiskObjectType list_risk = new EGH01DB.Types.RiskObjectType(); if (EGH01DB.Types.RiskObjectType.GetByCode(db, rm.list_type, out list_risk)) { EGH01DB.Types.PetrochemicalCategories list_petrochemical = new EGH01DB.Types.PetrochemicalCategories(); if (EGH01DB.Types.PetrochemicalCategories.GetByCode(db, rm.list_petrochemical, out list_petrochemical)) { EGH01DB.Types.EmergencyClass list_emergency = new EGH01DB.Types.EmergencyClass(); if (EGH01DB.Types.EmergencyClass.GetByCode(db, rm.list_emergency, out list_emergency)) { EGH01DB.Types.PenetrationDepth list_penetration = new EGH01DB.Types.PenetrationDepth(); if (EGH01DB.Types.PenetrationDepth.GetByCode(db, rm.list_penetration, out list_penetration)) { EGH01DB.Types.SoilPollutionCategories list_soil = new EGH01DB.Types.SoilPollutionCategories(); if (EGH01DB.Types.SoilPollutionCategories.GetByCode(db, rm.list_soil, out list_soil)) { bool waterachieved = rm.waterachieved; EGH01DB.Types.WaterPollutionCategories list_water = new EGH01DB.Types.WaterPollutionCategories(); if (EGH01DB.Types.WaterPollutionCategories.GetByCode(db, rm.list_water, out list_water)) { EGH01DB.Types.WaterProtectionArea list_waterArea = new EGH01DB.Types.WaterProtectionArea(); if (EGH01DB.Types.WaterProtectionArea.GetByCode(db, rm.list_waterArea, out list_waterArea)) { EGH01DB.Types.SoilCleaningMethod list_soilCleaning = new EGH01DB.Types.SoilCleaningMethod(); if (EGH01DB.Types.SoilCleaningMethod.GetByCode(db, rm.list_soilCleaning, out list_soilCleaning)) { EGH01DB.Types.WaterCleaningMethod list_waterCleaning = new EGH01DB.Types.WaterCleaningMethod(); if (EGH01DB.Types.WaterCleaningMethod.GetByCode(db, rm.list_waterCleaning, out list_waterCleaning)) { EGH01DB.Types.RehabilitationMethod rehabilitationMethod = new EGH01DB.Types.RehabilitationMethod(type_code, list_risk, list_cadastre, list_petrochemical, list_emergency, list_penetration, list_soil, waterachieved, list_water, list_waterArea, list_soilCleaning, list_waterCleaning); if (EGH01DB.Types.RehabilitationMethod.Create(db, rehabilitationMethod)) { view = View("RehabilitationMethods", db); } } } } } } } } } } } } } else if (menuitem.Equals("RehabilitationMethods.Create.Cancel")) { view = View("RehabilitationMethods", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult RehabilitationMethods() { ORTContext db = null; ViewBag.EGHLayout = "ORT.RehabilitationMethods"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(this); ViewBag.msg = "Соединение с базой данных установлено"; view = View("RehabilitationMethods", db); if (menuitem.Equals("RehabilitationMethods.Create")) { view = View("RehabilitationMethodsCreate"); } else if (menuitem.Equals("RehabilitationMethods.Delete")) { string type_code_item = this.HttpContext.Request.Params["id"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { EGH01DB.Types.RehabilitationMethod cd = new EGH01DB.Types.RehabilitationMethod(); if (EGH01DB.Types.RehabilitationMethod.GetByCode(db, c, out cd)) { view = View("RehabilitationMethodsDelete", cd); } } } } else if (menuitem.Equals("RehabilitationMethods.Update")) { string type_code_item = this.HttpContext.Request.Params["id"]; if (type_code_item != null) { int c = 0; if (int.TryParse(type_code_item, out c)) { EGH01DB.Types.RehabilitationMethod cd = new EGH01DB.Types.RehabilitationMethod(); if (EGH01DB.Types.RehabilitationMethod.GetByCode(db, c, out cd)) { view = View("RehabilitationMethodsUpdate", cd); } } } } else if (menuitem.Equals("RehabilitationMethods.Excel")) { EGH01DB.Types.RehabilitationMethodList list = new EGH01DB.Types.RehabilitationMethodList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/RehabilitationMethod.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/RehabilitationMethod.xml"), "text/plain", "Классификатор методов реабилитации.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult EmergencyClassCreate(EmergencyClassView ecv) { ORTContext db = null; ViewBag.EGHLayout = "ORT.EmergencyClass"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); view = View("EmergencyClass", db); if (menuitem.Equals("EmergencyClass.Create.Create")) { int id = -1; if (EGH01DB.Types.EmergencyClass.GetNextCode(db, out id)) { int type_code = ecv.type_code; string name = ecv.name; string strminmass = this.HttpContext.Request.Params["minmass"] ?? "Empty"; float minmass; Helper.FloatTryParse(strminmass, out minmass); string strmaxmass = this.HttpContext.Request.Params["maxmass"] ?? "Empty"; float maxmass; Helper.FloatTryParse(strmaxmass, out maxmass); if (minmass < maxmass && name.Length > 0) { EmergencyClass scm = new EmergencyClass(type_code, name, minmass, maxmass); if (EGH01DB.Types.EmergencyClass.Create(db, scm)) { view = View("EmergencyClass", db); } else if (menuitem.Equals("EmergencyClass.Create.Cancel")) { view = View("EmergencyClass", db); } } else if (maxmass < minmass) { ViewBag.Error = "Минимальное значение не должно быть больше максимального"; view = View("EmergencyClassCreate", db); return(view); } else if (strminmass.Length.Equals(0) || strmaxmass.Length.Equals(0) || name.Length.Equals(0)) { ViewBag.Error = "Все поля должны быть заполнены"; view = View("EmergencyClassCreate", db); return(view); } } } else if (menuitem.Equals("EmergencyClass.Create.Cancel")) { view = View("EmergencyClass", db); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return(view); }
public ActionResult WaterProtectionArea() { ORTContext db = null; ViewBag.EGHLayout = "ORT.WaterProtectionArea"; ActionResult view = View("Index"); string menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty"; try { db = new ORTContext(); ViewBag.msg = "Соединение с базой данных установлено"; view = View("WaterProtectionArea", db); if (menuitem.Equals("WaterProtectionArea.Create")) { view = View("WaterProtectionAreaCreate"); } else if (menuitem.Equals("WaterProtectionArea.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)) { EGH01DB.Types.WaterProtectionArea pt = new WaterProtectionArea(); if (EGH01DB.Types.WaterProtectionArea.GetByCode(db, c, out pt)) { view = View("WaterProtectionAreaDelete", pt); } } } } else if (menuitem.Equals("WaterProtectionArea.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)) { WaterProtectionArea pt = new WaterProtectionArea(); if (EGH01DB.Types.WaterProtectionArea.GetByCode(db, c, out pt)) { view = View("WaterProtectionAreaUpdate", pt); } } } } else if (menuitem.Equals("WaterProtectionArea.Excel")) { EGH01DB.Types.WaterProtectionAreaList list = new WaterProtectionAreaList(db); XmlNode node = list.toXmlNode(); XmlDocument doc = new XmlDocument(); XmlNode nnode = doc.ImportNode(node, true); doc.AppendChild(nnode); doc.Save(Server.MapPath("~/App_Data/WaterProtectionArea.xml")); view = View("Index"); view = File(Server.MapPath("~/App_Data/WaterProtectionArea.xml"), "text/plain", "Категории водоохранной территории.xml"); } } catch (RGEContext.Exception e) { ViewBag.msg = e.message; } catch (Exception e) { ViewBag.msg = e.Message; } return view; }