コード例 #1
0
        public ActionResult CadastreTypeUpdate(CadastreTypeView cd)
        {
            CEQContext db = null;

            ViewBag.EGHLayout = "CEQ";
            ActionResult view     = View("Index");
            string       menuitem = this.HttpContext.Request.Params["menuitem"] ?? "Empty";

            try
            {
                db   = new CEQContext(this);
                view = View("CadastreType", db);
                if (menuitem.Equals("CadastreType.Update.Update"))
                {
                    int    id          = cd.type_code;
                    String name        = cd.name;
                    float  pdk_coef    = cd.pdk_coef;
                    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 strwater_pdk_coef = this.HttpContext.Request.Params["water_pdk_coef"] ?? "Empty";;
                    if (!Helper.FloatTryParse(strwater_pdk_coef, out water_pdk_coef))
                    {
                        water_pdk_coef = 0.0f;
                    }
                    String water_doc_coef = cd.water_doc_name;
                    String pdk_doc_coef   = cd.ground_doc_name;
                    EGH01DB.Types.CadastreType cadastre_type = new EGH01DB.Types.CadastreType(id, name, pdk_coef, water_pdk_coef, pdk_doc_coef, water_doc_coef);
                    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);
        }
コード例 #2
0
        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);
        }