コード例 #1
0
        // GET: MessageStrategy
        public ActionResult Index(string Type = "", string IsEnable = "", string IsConfirm = "", int pageIndex = 1, int pageSize = 10)
        {
            ViewBag.Type      = Type;
            ViewBag.pageIndex = pageIndex;
            //下拉框
            ViewBag.Type = Enum <MessageType> .AsEnumerable().ToDictionary(i => i.ToString(), j => j.GetText()).ToList().ToSelectList("Value", "Key", true, Type);

            ViewBag.IsConfirm = HelperExt.GetConfirmList(true, IsConfirm);
            ViewBag.IsEnable  = HelperExt.GetEnableList(true, IsEnable);
            ConditionExpression ce = null;
            QueryCondition      qc = new QueryCondition();

            ce = new ConditionExpression();
            if (Type != "")
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "Name";
                ce.ExpValue    = Type;
                ce.ExpOperater = eConditionOperator.Equal;
                ce.ExpLogical  = eLogicalOperator.Or;
                qc.ConditionList.Add(ce);
            }
            if (IsEnable != "")
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "IsEnable";
                ce.ExpValue    = IsEnable == EnumState.Enable.ToString();
                ce.ExpOperater = eConditionOperator.Equal;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            if (IsConfirm != "")
            {
                ce             = new ConditionExpression();
                ce.ExpName     = "IsConfirm";
                ce.ExpValue    = IsConfirm == EnumState.Confirmed.ToString();
                ce.ExpOperater = eConditionOperator.Equal;
                ce.ExpLogical  = eLogicalOperator.And;
                qc.ConditionList.Add(ce);
            }
            qc.PageInfo = GetPageInfo(pageIndex, pageSize);
            Result <List <Msg_MessageStrategy> > result = new Result <List <Msg_MessageStrategy> >();

            using (MessageClientProxy proxy = new MessageClientProxy(ProxyEx(Request)))
            {
                result        = proxy.GetStrategyList(qc);
                ViewBag.Total = result.AllRowsCount;
            }

            return(View(result.Data));
        }