コード例 #1
0
 public IResult Item()
 {
     try
     {
         MDownChannel entity = new MDownChannel();
         entity.SetData(Request.Form);
         entity.TrimEmptyProperty();
         string id = Request.Form["__id"];
         entity.Status = CommFun.ToInt(Request["StatusN"], 1);
         IResult result = DownChannelSerivce.Instance.Save(id, entity);
         if (result.Status)
         {
             result.SetSuccessMessage("保存成功");
         }
         else
         {
             result.SetErrorMessage("保存失败");
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(new Result(false, ex.Message));
     }
 }
コード例 #2
0
        public DownChannelListModel Query(NameValueCollection nvc)
        {
            DownChannelListModel model  = new DownChannelListModel();
            MDownChannel         entity = new MDownChannel();

            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["ChannelName"]))
            {
                entity.AddData(":ChannelName", " t.Channel_Name like '%" + nvc["ChannelName"] + "%'");
            }
            model.TotalCount = CommFun.ToInt(handler.GetScalarByXmlTemplate("getCount", entity), 0).GetValueOrDefault();
            if (model.TotalCount > 0)
            {
                model.List = handler.GetDataListByTemplate("getList", entity);
            }
            return(model);
        }