Esempio n. 1
0
        public ActionResult btnCreate_Click()
        {
            if (ModelState.IsValid)
            {
                try
                {
                    sys_dictItems dict = new sys_dictItems();
                    dict.FDictID      = Convert.ToInt32(Request["hidDictID"]);
                    dict.FName        = Request["tbxFName"];
                    dict.FValue       = Request["tbxFValue"];
                    dict.FParentValue = Request["tbxFParentValue"];
                    dict.FDescription = Request["tbxFDescription"];
                    db.sys_dictItems.Add(dict);
                    db.SaveChanges();

                    ShowNotify("添加成功!");
                    // 关闭本窗体(触发窗体的关闭事件)
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                catch
                {
                    ShowNotify("添加失败!");
                }
            }

            return(UIHelper.Result());
        }
Esempio n. 2
0
        public ActionResult Grid2_Delete(JArray selectedRows, JArray Grid2_fields, int gridIndex, int gridPageSize, string Grid1_selectedRows)
        {
            foreach (string rowId in selectedRows)
            {
                sys_dictItems item = db.sys_dictItems.Find(Convert.ToInt32(rowId));
                db.sys_dictItems.Remove(item);
            }
            db.SaveChanges();

            UpdateGrid(Grid2_fields, gridIndex, gridPageSize, Grid1_selectedRows);

            return(UIHelper.Result());
        }