Beispiel #1
0
        /// <summary>
        /// 查询列表数据
        /// </summary>
        /// <param name="nvc">参数集合</param>
        /// <returns></returns>
        public SysDictionaryListModel Query(NameValueCollection nvc)
        {
            SysDictionaryListModel model  = new SysDictionaryListModel();
            MSysDictionary         entity = new MSysDictionary();

            model.PageSize = CommFun.ToInt(nvc["ps"],
                                           SettingHelper.Instance.GetInt("PageSize", 10)).Value;
            model.PageIndex = CommFun.ToInt(nvc["pi"],
                                            SettingHelper.Instance.GetInt("PageIndex", 0)).Value + 1;
            entity.SetData(nvc, false);
            entity.TrimEmptyProperty();
            entity.AddData(":PS", model.PageSize);
            entity.AddData(":PI", model.PageIndex);
            if (!string.IsNullOrEmpty(nvc["name"]))
            {
                entity.AddData(":Name", " t.name like '%" + nvc["name"] + "%'");
            }
            if (!string.IsNullOrEmpty(nvc["type"]))
            {
                entity.AddData(":Type", " t.type like '%" + nvc["type"] + "%'");
            }
            model.TotalCount = CommFun.ToInt(handler.GetScalarByXmlTemplate("getCount", entity), 0).GetValueOrDefault();
            if (model.TotalCount > 0)
            {
                model.List = handler.GetDataListByTemplate("getList", entity);
            }
            return(model);
        }
Beispiel #2
0
 public IResult Item()
 {
     try
     {
         MSysDictionary entity = new MSysDictionary();
         entity.SetData(Request.Form);
         entity.TrimEmptyProperty();
         string  id     = Request.Form["__id"];
         IResult result = SysDictionaryService.Instance.Save(id, entity);
         if (result.Status)
         {
             result.SetSuccessMessage("保存成功");
         }
         else
         {
             result.SetErrorMessage("保存失败");
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(new Result(false, ex.Message));
     }
 }