Exemple #1
0
        public ActionResult AddDicType(RequestData data)
        {
            PostResult      result = new PostResult();
            BASDICTYPEModel model  = new BASDICTYPEModel();

            model.TITLE  = data.Get("Title");
            model.CODE   = data.Get("Code");
            model.SORTNO = data.Get("SortNo").ToInt32();
            model.REMARK = data.Get("Remark");
            bool ret = model.Insert();

            result.Success = ret;
            return(Json(result));
        }
Exemple #2
0
        public ActionResult DelDicType(RequestData data)
        {
            PostResult result = new PostResult();
            string     Id     = data.Get("Id");
            object     obj    = SqlModel.Select(BASDIC.ID).From(DB.BASDIC).Where(BASDIC.TYPEID == Id).ExecuteScalar();

            if (obj != null && obj.ToString() != "")
            {
                result.Success = false;
                result.Message = "该字典类型下有字典数据,不能删除!";
            }
            else
            {
                BASDICTYPEModel model = new BASDICTYPEModel();
                bool            ret   = model.Delete(BASDICTYPE.ID == Id);
                result.Success = ret;
            }
            return(Json(result));
        }
Exemple #3
0
        public ActionResult EditDicType(RequestData data)
        {
            PostResult result = new PostResult();

            using (TranModel tran = new DBTranModel())
            {
                BASDICTYPEModel model = new BASDICTYPEModel();
                model.TITLE  = data.Get("Title");
                model.CODE   = data.Get("Code");
                model.SORTNO = data.Get("SortNo").ToInt32();
                model.REMARK = data.Get("Remark");

                model.Updating(tran, BASDICTYPE.ID == data.Get("Id"));

                BASDICModel dmodel = new BASDICModel();
                dmodel.TYPECODE = data.Get("Code");
                dmodel.Updating(tran, BASDIC.TYPEID == data.Get("Id"));
                result.Success = tran.Execute();
            }
            //result.Success = tran.Execute();
            return(Json(result));
        }