Ejemplo n.º 1
0
        protected void btn_search_Click(object sender, EventArgs e)
        {
            int pageSize = 20;

            string keyword   = this.txt_paymentItemSetting_filter_keyword.Text.Trim();
            string cashApply = this.ddl_paymentItemSetting_filter_cashApply.SelectedValue.Trim();


            AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter param = new AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter();

            param.cashApplyTypeKey  = cashApply;
            param.includeDeleteItem = false;
            param.orderField        = "dateCreated";
            param.pageSize          = pageSize;
            param.pageIndex         = 1;
            param.desc    = true;
            param.keyword = keyword;

            AccountItemViewModel.AccountItemTaxRateSettingListResult listResult = this.accountItemSvc.getAccountItemTaxRateSettingListResult(param);

            if (listResult.success)
            {
                this.rpt_paymentItemSetting.DataSource = listResult.list;
                this.rpt_paymentItemSetting.DataBind();

                this.component_pager.queryString  = "pg";
                this.component_pager.pageSize     = pageSize;
                this.component_pager.showPageItem = 5;
                this.component_pager.currentPage  = 1;
                this.component_pager.count        = listResult.count;
                this.component_pager.load();
                this.component_pager.DataBind();
            }
            else
            {
            }
        }
Ejemplo n.º 2
0
        public Tuple <int, List <AccountItemTaxRateSetting> > getAccountItemTaxRateSettingList(AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter param)
        {
            List <AccountItemTaxRateSetting> list = new List <AccountItemTaxRateSetting>();
            int count = 0;
            Tuple <int, List <AccountItemTaxRateSetting> > ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <AccountItemTaxRateSetting>();

                if (!string.IsNullOrEmpty(param.cashApplyTypeKey))
                {
                    predicate = predicate.And(x => x.applyTypeKey == param.cashApplyTypeKey);
                }
                if (!param.includeDeleteItem)
                {
                    predicate = predicate.And(x => !x.deleted);
                }

                //用關鍵字搜尋
                if (!string.IsNullOrEmpty(param.keyword))
                {
                    predicate = predicate.And(x =>
                                              x.code.Contains(param.keyword) ||
                                              x.itemName.Contains(param.keyword) ||
                                              x.memo.Contains(param.keyword));
                }

                if (string.IsNullOrEmpty(param.orderField))
                {
                    param.orderField = "dataCreated";
                }



                list = db.AccountItemTaxRateSetting.AsExpandable()
                       .Where(predicate)
                       .OrderBy(param.orderField, param.desc)
                       .Skip((param.pageIndex - 1) * param.pageSize)
                       .Take(param.pageSize)
                       .ToList();

                count = db.AccountItemTaxRateSetting.AsExpandable()
                        .Where(predicate).Count();

                ret = Tuple.Create(count, list);
            }


            return(ret);
        }
Ejemplo n.º 3
0
        protected void reloadAccountList()
        {
            string pg_str = Request.QueryString["pg"] as string;

            pg_str = string.IsNullOrEmpty(pg_str) ? "1" : pg_str;
            int pg_int = 1;

            int.TryParse(pg_str, out pg_int);

            int pageSize = 20;

            string keyword   = Request.QueryString["keyword"] as string;
            string cashApply = Request.QueryString["cashApply"] as string;

            if (string.IsNullOrWhiteSpace(keyword))
            {
                keyword = "";
            }
            else
            {
                keyword = HttpUtility.UrlDecode(keyword);
            }

            if (string.IsNullOrWhiteSpace(cashApply))
            {
                cashApply = "";
            }
            else
            {
                cashApply = HttpUtility.UrlDecode(cashApply);
            }



            AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter param = new AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter();

            param.cashApplyTypeKey  = cashApply;
            param.includeDeleteItem = false;
            param.orderField        = "dateCreated";
            param.pageSize          = pageSize;
            param.pageIndex         = pg_int;
            param.desc    = true;
            param.keyword = keyword;

            AccountItemViewModel.AccountItemTaxRateSettingListResult listResult = this.accountItemSvc.getAccountItemTaxRateSettingListResult(param);

            if (listResult.success)
            {
                this.rpt_paymentItemSetting.DataSource = listResult.list;
                this.rpt_paymentItemSetting.DataBind();

                this.component_pager.queryString  = "pg";
                this.component_pager.pageSize     = pageSize;
                this.component_pager.showPageItem = 5;
                this.component_pager.currentPage  = pg_int;
                this.component_pager.count        = listResult.count;
                this.component_pager.load();
                this.component_pager.DataBind();
            }
            else
            {
            }
        }