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 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);
        }