コード例 #1
0
        public List <DebtorCreditorDTO> GetDebtorsCreditors(DCCommand cmd, ref int pagesCount)
        {
            var query = from c in db.DebtorCreditors
                        select new DebtorCreditorDTO()
            {
                Id          = c.Id,
                ClientId    = c.ClientId,
                Client      = c.Client,
                CreatedDate = c.CreatedDate,
                UpdatedDate = c.UpdatedDate,
                Amount      = c.Amount,
                IsDebtor    = c.isDebtor
            };

            if (cmd.ClientId != null)
            {
                query = from c in query where c.ClientId == cmd.ClientId select c;
            }

            if (!string.IsNullOrEmpty(cmd.ClientName))
            {
                query = from c in query where c.Client.Name.Contains(cmd.ClientName) select c;
            }

            if (cmd.IsDebtor != null)
            {
                query = from c in query where c.IsDebtor == cmd.IsDebtor select c;
            }

            if (cmd.UpdatedDate != null)
            {
                query = from c in query where c.UpdatedDate.Date >= cmd.UpdatedDate.Value.Date &&
                        c.UpdatedDate.Date <= cmd.UpdatedDate.Value.Date
                        select c;
            }

            if (cmd.FromUpdatedDate != null && cmd.ToUpdatedDate != null)
            {
                query = from p in query
                        where p.UpdatedDate.Date >= cmd.FromUpdatedDate.Value.Date &&
                        p.UpdatedDate.Date <= cmd.ToUpdatedDate.Value.Date
                        select p;
            }

            query = query.Page(cmd.PageSize, cmd.Page);
            return(query.ToList());
        }
コード例 #2
0
 public List <DebtorCreditorDTO> Get(DCCommand cmd, ref int pagesCount)
 {
     return(new DebtorCreditorsDalFacade().GetDebtorsCreditors(cmd, ref pagesCount));
 }