INF003

来源:互联网 发布:淘宝信用支付什么意思 编辑:程序博客网 时间:2024/06/04 18:15
 public static List<vwINF003> GetList(INF003 b, int size, int pageIndex, string orderBy, Common.TabelSortTypeEnum asc_desc, SYS100 s)
        {
            using (ERPCon con = new ERPCon())
            {
                var list = from m in con.vwINF003
                           select m;
                #region order by
                //資料排序(小->大) + 經銷商代號(小->大)+據點(小->大)+員工代號(小->大)
                if (!String.IsNullOrEmpty(orderBy))
                    list = list.AsQueryable().ERPOrderBy<vwINF003>(orderBy, asc_desc).ThenBy(p => p.sort_no).ThenBy(p => p.vend_no).ThenBy(p => p.branch_no).ThenBy(p => p.sale_no);
                else
                    list = list.OrderBy(p => p.sort_no).ThenBy(p => p.vend_no).ThenBy(p => p.branch_no).ThenBy(p => p.sale_no);
                #endregion
                if (!String.IsNullOrEmpty(b.vend_no))
                {
                    list = list.Where(p => p.vend_no.Contains(b.vend_no));
                }
                if (!String.IsNullOrEmpty(b.branch_no))
                {
                    list = list.Where(p => p.branch_no.Contains(b.branch_no));
                }
                if (!String.IsNullOrEmpty(b.sale_name))
                {
                    list = list.Where(p => p.sale_name.Contains(b.sale_name));
                }
                if (!string.IsNullOrEmpty(b._S_indateS))
                {
                    list = list.Where(p => p.in_date.CompareTo(b._S_indateS.Replace("/", "")) >= 0);
                }
                if (!string.IsNullOrEmpty(b._S_indateE))
                {
                    list = list.Where(p => p.in_date.CompareTo(b._S_indateE.Replace("/", "")) <= 0);
                }
                if (!string.IsNullOrEmpty(b._S_outdateS))
                {
                    list = list.Where(p => p.out_date.CompareTo(b._S_outdateS.Replace("/", "")) >= 0);
                }
                if (!string.IsNullOrEmpty(b._S_outdateE))
                {
                    list = list.Where(p => p.out_date.CompareTo(b._S_outdateE.Replace("/", "")) <= 0);
                }
                //查詢資料等級的過濾
                list = CommonFunc.GetListFiltersByClass(list, s, "vwINF003");

                return list.Skip((pageIndex - 1) * size).Take(size).ToList();
            }
        }


0 0