Example #1
0
        private void SetMasterDataSource(int pageIndex, int pageSize)
        {
            Expression <Func <TB_BILL, dynamic> > select =
                c =>
                new
            {
                c.UID,
                单据编号  = c.BillNum,
                单据类型  = c.BillType,
                子单据类型 = c.SubBillType,
//                        单据子类型 = c.SubBillType,
//                        采购订单编号 = c.SourceBillNum,
//                        发货单编号 = c.SourceBillNum2,
//                        开始时间 = c.StartTime,
//                        结束时间 = c.FinishTime,
//                        供应商编号 = c.SplyId,
//                        客户编号 = c.CustId,
                单据时间 = c.BillTime,
                操作员  = c.OperName,
                状态   = ((BillState)c.State).ToString(),
                备注   = c.Remark,
            };

            Expression <Func <TB_BILL, bool> > where;
            if (string.IsNullOrEmpty(GlobalVar.Oper.DeptCode))
            {
                where = c => c.BillType == (int)_billType;
            }
            else
            {
                where = c => c.BillType == (int)_billType && c.Factory == GlobalVar.Oper.DeptCode;
            }
            Expression <Func <TB_BILL, long> > order = c => c.UID;

            int total;

            grid.MasterDataSource = EniitiesHelper.GetPagedDataDesc(_db,
                                                                    select,
                                                                    where,
                                                                    order,
                                                                    pageIndex,
                                                                    pageSize,
                                                                    out total);
            if (grid.Total != total)
            {
                grid.Total = total;
            }
            if (grid.PageIndex != pageIndex)
            {
                grid.PageIndex = pageIndex;
            }
            if (grid.PageSize != pageSize)
            {
                grid.PageSize = pageSize;
            }
        }
Example #2
0
        private void SetMasterDataSource(int pageIndex, int pageSize)
        {
            Expression <Func <TB_BILL, dynamic> > select =
                c =>
                new
            {
                c.UID,
                单据编号  = c.BillNum,
                单据类型  = c.BillType,
                单据子类型 = c.SubBillType,
                源单编号  = c.SourceBillNum,
                供应商编号 = c.SplyId,
                单据时间  = c.BillTime,
                操作员   = c.OperName,
                状态    = ((BillState)c.State).ToString(),
                备注    = c.Remark,
            };
            Expression <Func <TB_BILL, long> > order = c => c.UID;

            int total;

            grid.MasterDataSource = EniitiesHelper.GetPagedDataDesc(_db,
                                                                    select,
                                                                    _where,
                                                                    order,
                                                                    grid.PageIndex,
                                                                    grid.PageSize,
                                                                    out total);
            if (grid.Total != total)
            {
                grid.Total = total;
            }
            if (grid.PageIndex != pageIndex)
            {
                grid.PageIndex = pageIndex;
            }
            if (grid.PageSize != pageSize)
            {
                grid.PageSize = pageSize;
            }
        }