public string GetSys_DicTypeJson()
        {
            Sys_DicTypeBiz     DDBiz   = new Sys_DicTypeBiz();
            var                sql     = Sys_DicTypeSet.SelectAll().Where(Sys_DicTypeSet.isDeleted.Equal(0).And(Sys_DicTypeSet.isValid.Equal(1)));
            List <Sys_DicType> listAll = DDBiz.GetOwnList <Sys_DicType>(sql);

            return(JsonHelper.ToJson(listAll, true));
        }
Ejemplo n.º 2
0
        public JsonResult GetInfo(string ID)
        {
            var         mql2   = Sys_DicTypeSet.SelectAll().Where(Sys_DicTypeSet.DicTypeId.Equal(ID));
            Sys_DicType Rmodel = OPBiz.GetEntity(mql2);

            //  groupsBiz.Add(rol);
            return(Json(Rmodel, JsonRequestBehavior.AllowGet));
        }
        public string GetSys_DicTypeDataGrid()
        {
            Sys_DicTypeBiz              DDBiz   = new Sys_DicTypeBiz();
            var                         sql     = Sys_DicTypeSet.SelectAll().Where(Sys_DicTypeSet.isDeleted.Equal(0).And(Sys_DicTypeSet.isValid.Equal(1)));
            List <Sys_DicType>          listAll = DDBiz.GetOwnList <Sys_DicType>(sql);
            Dictionary <string, object> dic     = new Dictionary <string, object>();

            // var mql = RMS_RoleSet.ControlId.NotEqual("");
            dic.Add("rows", listAll);
            dic.Add("total", listAll.Count);

            return(JsonHelper.ToJson(dic, true));
        }
Ejemplo n.º 4
0
        public JsonResult EditInfo(Sys_DicType EidModle)
        {
            HttpReSultMode ReSultMode = new HttpReSultMode();

            var         mql2   = Sys_DicTypeSet.SelectAll().Where(Sys_DicTypeSet.DicTypeNum.Equal(EidModle.DicTypeNum));
            Sys_DicType Rmodel = OPBiz.GetEntity(mql2);

            if (Rmodel != null && Rmodel.DicTypeId != EidModle.DicTypeId)
            {
                ReSultMode.Code = -13;
                ReSultMode.Data = "";
                ReSultMode.Msg  = "已经存在相同的编号";
                return(Json(ReSultMode, JsonRequestBehavior.AllowGet));
            }

            bool IsAdd = false;

            if (EidModle.DicTypeId == 0) //id为空,是添加
            {
                IsAdd = true;

                EidModle.CreateTime = DateTime.Now;

                EidModle.isValid   = true;
                EidModle.isDeleted = false;
            }
            if (IsAdd)
            {
                try
                {
                    OPBiz.Add(EidModle);
                    ReSultMode.Code = 11;
                    ReSultMode.Data = EidModle.DicTypeId.ToString();
                    ReSultMode.Msg  = "添加成功";
                }
                catch (Exception e) {
                    ReSultMode.Code = -11;
                    ReSultMode.Data = e.ToString();
                    ReSultMode.Msg  = "添加失败";
                }
            }
            else
            {
                EidModle.WhereExpression = Sys_DicTypeSet.DicTypeId.Equal(EidModle.DicTypeId);
                string idfilec = "DicTypeId";
                EidModle.ChangedMap.Remove(idfilec.ToLower());//移除主键值
                if (OPBiz.Update(EidModle) > 0)
                {
                    ReSultMode.Code = 11;
                    ReSultMode.Data = "";
                    ReSultMode.Msg  = "修改成功";
                }
                else
                {
                    ReSultMode.Code = -13;
                    ReSultMode.Data = "";
                    ReSultMode.Msg  = "修改失败";
                }
            }

            return(Json(ReSultMode, JsonRequestBehavior.AllowGet));
        }