示例#1
0
        public async Task <JqDataTableResponse <SalesTaxListItemDto> > GetPagedResultAsync(SalexTaxJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filterKey = model.Search.Value;
            var linqstmt  = (from st in _dataContext.SalesTaxes
                             where st.Status != Constants.RecordStatus.Deleted &&
                             (model.FilterKey == null ||
                              EF.Functions.Like(st.Code, "%" + model.FilterKey + "%") ||
                              EF.Functions.Like(st.Description, "%" + model.FilterKey + "%"))
                             select new SalesTaxListItemDto
            {
                Id = st.Id,
                Code = st.Code,
                Description = st.Description ?? "",
                TaxPercentage = st.TaxPercentage,
                Status = st.Status,
                BankAccountId = st.BankAccountId
            })
                            .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <SalesTaxListItemDto>
            {
                RecordsTotal    = await _dataContext.SalesTaxes.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#2
0
        public async Task <JqDataTableResponse <ActivityNoteDto> > GetPagedResultAsyncNotes(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filerKey = model.Search.Value;

            var linqstmt = (from an in _dataContext.ActivityNotes
                            where (filerKey == null || EF.Functions.Like(an.NoteDescription, "%" + filerKey + "%"))
                            select new ActivityNoteDto
            {
                Id = an.Id,
                NoteDescription = an.NoteDescription,
                DescriptionHtml = an.DescriptionHtml,
                EntityId = an.EntityId,
                EntityMasterId = an.EntityMasterId
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <ActivityNoteDto>
            {
                RecordsTotal    = await _dataContext.ActivityMeeting.CountAsync(),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#3
0
        public async Task <IActionResult> PagedResult(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var filterKey = model.Search.Value;

            var linqStmt = (from u in _userManager.Users
                            where u.Status != Constants.RecordStatus.Deleted && (filterKey == null || EF.Functions.Like(u.FirstName, "%" + filterKey + "%"))
                            select new UserListItemDto
            {
                Id = u.Id,
                FirstName = u.FirstName,
                LastName = u.LastName,
                Email = u.Email,
                PhoneNumber = u.PhoneNumber,
                Status = u.Status
            })
                           .AsNoTracking();
            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <UserListItemDto>
            {
                RecordsTotal    = await _userManager.Users.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqStmt.CountAsync(),
                Data            = await linqStmt.OrderBy(sortExpression).Skip(model.Start)
                                  .Take(model.Length)
                                  .ToListAsync()
            };

            return(Ok(pagedResult));
        }
示例#4
0
        public async Task <JqDataTableResponse <QualifyQuestionDetailDto> > GetPagedResultAsync(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var filterKey = model.Search.Value;

            var linqStmt = (from s in _dataContext.QualifyQuestion
                            where s.Status != Constants.RecordStatus.Deleted && (filterKey == null || EF.Functions.Like(s.QuestionName, "%" + filterKey + "%"))
                            select new QualifyQuestionDetailDto
            {
                Id = s.Id,
                QuestionName = s.QuestionName,
                QuestionCode = s.QuestionCode,
                FieldTypeId = s.FieldTypeId,
                Options = s.Options
            })
                           .AsNoTracking();

            var sortExpresstion = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <QualifyQuestionDetailDto>
            {
                RecordsTotal    = await _dataContext.LeadSource.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqStmt.CountAsync(),
                Data            = await linqStmt.OrderBy(sortExpresstion).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
        public async Task <JqDataTableResponse <CreditCardListItemDto> > GetPagedResultAsync(CreditCardJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filterKey = model.Search.Value;
            var linqstmt  = (from cc in _dataContext.CreditCards
                             where cc.Status != Constants.RecordStatus.Deleted && (model.FilterKey == null || EF.Functions.Like(cc.Number, "%" + model.FilterKey + "%") || EF.Functions.Like(cc.CardHolderName, "%" + model.FilterKey + "%") ||
                                                                                   EF.Functions.Like(cc.BankName, "%" + model.FilterKey + "%"))
                             select new CreditCardListItemDto
            {
                Id = cc.Id,
                CreditCardNumber = cc.Number,
                BankName = cc.BankName,
                CardHolderName = cc.CardHolderName,
                Status = cc.Status
            })
                            .AsNoTracking();

            var sortExpression = model.GetSortExpression();
            var pagedResult    = new JqDataTableResponse <CreditCardListItemDto>
            {
                RecordsTotal    = await _dataContext.CreditCards.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression)
                                  .Skip(model.Start)
                                  .Take(model.Length)
                                  .ToListAsync()
            };

            return(pagedResult);
        }
示例#6
0
        public async Task <JqDataTableResponse <QuotationListItemDto> > GetPagedResultAsync(QuotationJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var linqstmt = (from i in _dataContext.Quotations
                            join c in _dataContext.Customers
                            on i.CustomerId equals c.Id
                            where (model.CustomerId == null ||
                                   i.CustomerId == model.CustomerId.Value) &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(c.FirstName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.LastName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.MiddleName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(i.QuotationNumber, "%" + model.FilterKey + "%")) &&
                            i.Status != Constants.InvoiceStatus.Deleted
                            select new QuotationListItemDto
            {
                Id = i.Id,
                CustomerId = i.CustomerId,
                CustomerName = (c.FirstName ?? "") + " " + (c.MiddleName ?? "") + " " + (c.LastName ?? ""),
                Description = i.Remark,
                Amount = i.Services.Sum(x => x.Rate),
                Discount = i.Discount,
                Tax = i.Tax,
                TotalAmount = i.TotalAmount,
                CreatedOn = i.CreatedOn,
                Status = i.Status,
                QuotationDate = i.QuotationDate,
                StrQuotationDate = i.StrQuotationDate,
                ExpiryDate = i.ExpireDate,
                StrExpiryDate = i.StrExpireDate,
                QuotationNumber = i.QuotationNumber,
                SubTotal = i.SubTotal
            })
                           .AsNoTracking();

            var sortExpresstion = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <QuotationListItemDto>
            {
                RecordsTotal    = await _dataContext.Quotations.CountAsync(x => x.Status != Constants.InvoiceStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpresstion).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            foreach (var quotationListItemDto in pagedResult.Data)
            {
                quotationListItemDto.CreatedOn = Utility.GetDateTime(quotationListItemDto.CreatedOn, null);
            }

            return(pagedResult);
        }
示例#7
0
        public async Task <JqDataTableResponse <BillListItemDto> > getTopFiveBillsAsync(BillJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filterKey = model.Search.Value;

            model.Order[0].Dir    = "desc";
            model.Order[0].Column = 4;

            var linqstmt = (from b in _dataContext.Bills
                            join v in _dataContext.Vendors
                            on b.VendorId equals v.Id
                            where b.Status != Constants.BillStatus.Deleted &&
                            (model.VendorId == null || b.VendorId == model.VendorId.Value) &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(b.Id.ToString(), "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(v.Name, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(b.BillNumber, "%" + model.FilterKey + "%"))
                            select new BillListItemDto
            {
                Id = b.Id,
                VendorId = b.VendorId,
                VendorName = v.Name,
                Description = b.Remark,
                Amount = b.Items.Sum(x => x.Rate),
                Discount = b.Discount,
                Tax = b.Tax,
                TotalAmount = b.TotalAmount,
                Status = b.Status,
                CreatedOn = b.CreatedOn,
                BillDate = b.BillDate,
                DueDate = b.DueDate.Value,
                StrBillDate = b.StrBillDate,
                StrDueDate = b.StrDueDate,
                Notes = b.Notes,
                BillNumber = b.BillNumber,
                SubTotal = b.SubTotal,
                RefrenceNumber = b.RefrenceNumber
            })
                           .AsNoTracking().Take(5);

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <BillListItemDto>
            {
                RecordsTotal = await _dataContext.Bills.CountAsync(x => (model.VendorId == null || x.VendorId == model.VendorId.Value) &&
                                                                   x.Status != Constants.BillStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#8
0
        public async Task <JqDataTableResponse <LeadDto> > GetPagedResultAsyncByid(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filerKey = model.Search.Value;

            var linqstmt = (from l in _dataContext.Lead
                            where l.UserId == model.filterKeyId && l.Status != Constants.RecordStatus.Deleted && (model.filterKey == null || EF.Functions.Like(l.FirstName, "%" + model.filterKey + "%") ||
                                                                                                                  EF.Functions.Like(l.LastName, "%" + model.filterKey + "%") ||
                                                                                                                  EF.Functions.Like(l.CompanyName, "%" + model.filterKey + "%") ||
                                                                                                                  EF.Functions.Like(l.Phone, "%" + model.filterKey + "%") ||
                                                                                                                  EF.Functions.Like(l.Email, "%" + model.filterKey + "%"))

                            select new LeadDto
            {
                Id = l.Id,
                FirstName = l.FirstName,
                LastName = l.LastName,
                Email = l.Email,
                Website = l.Website,
                Mobile = l.Mobile,
                LeadSourceId = l.LeadSourceId ?? 0,
                LeadStatusId = l.LeadStatusId ?? 0,
                Status = l.Status,
                Phone = l.Phone,
                CallStatus = l.CallStatus,
                CreatedOn = l.CreatedOn,
                CompanyName = l.CompanyName,
                Address = new AddressDto
                {
                    Id = l.Address.Id,
                    CountryName = l.Address.Country.CountryName,
                    StateName = l.Address.State.StateName,
                    CityName = l.Address.City.CityName,
                    StreetName = l.Address.StreetName,
                    PostalCode = l.Address.PostalCode
                }
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <LeadDto>
            {
                RecordsTotal    = await _dataContext.Lead.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
        public async Task <JqDataTableResponse <InvoicePaymentListItemDto> > GetPagedResultAsync(InvoiceJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var linqstmt = (from ip in _dataContext.InvoicePayments
                            join i in _dataContext.Invoices
                            on ip.InvoiceId equals i.Id
                            join c in _dataContext.Customers
                            on i.CustomerId equals c.Id
                            where (model.CustomerId == null ||
                                   i.CustomerId == model.CustomerId.Value) &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(i.Id.ToString(), "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.FirstName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.LastName, "%" + model.FilterKey + "%")) &&
                            i.Status != Constants.InvoiceStatus.Deleted
                            select new InvoicePaymentListItemDto
            {
                Id = ip.Id,
                InvoiceNumber = ip.Invoice.Id.ToString(),
                FirstName = c.FirstName,
                MiddleName = c.MiddleName,
                LastName = c.LastName,
                DepositFrom = ip.DepositFrom,
                DepositTo = ip.BankAccount.AccountNumber,
                PaymentMode = ip.PaymentMode,
                Amount = ip.Amount,
                CreatedOn = ip.CreatedOn
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pageResult = new JqDataTableResponse <InvoicePaymentListItemDto>
            {
                RecordsTotal    = await _dataContext.InvoicePayments.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).ToListAsync()
            };

            return(pageResult);
        }
示例#10
0
        private async Task <JqDataTableResponse <PostSegment> > GetJqDataTableResponse(PostStatus status, DataTableRequest model)
        {
            var searchBy = model.Search?.Value;
            var take     = model.Length;
            var offset   = model.Start;

            var posts = await _postService.ListSegment(status, offset, take, searchBy);

            var jqdtResponse = new JqDataTableResponse <PostSegment>
            {
                Draw            = model.Draw,
                RecordsFiltered = posts.TotalRows,
                RecordsTotal    = posts.TotalRows,
                Data            = posts.Posts
            };

            return(jqdtResponse);
        }
示例#11
0
        public async Task <IActionResult> List(DataTableRequest model)
        {
            var searchBy = model.Search?.Value;
            var take     = model.Length;
            var offset   = model.Start;

            var links = await _linkForwarderService.GetPagedLinksAsync(offset, take, searchBy);

            var jqdtResponse = new JqDataTableResponse <Link>
            {
                Draw            = model.Draw,
                RecordsFiltered = links.TotalRows,
                RecordsTotal    = links.TotalRows,
                Data            = links.Links
            };

            return(Json(jqdtResponse));
        }
示例#12
0
        public async Task <IActionResult> ListPublished(DataTableRequest model)
        {
            var searchBy = model.Search?.Value;
            var take     = model.Length;
            var offset   = model.Start;

            var posts = await _postService.ListSegment(PostStatus.Published, offset, take, searchBy);

            var jqdtResponse = new JqDataTableResponse <PostSegment>
            {
                Draw            = model.Draw,
                RecordsFiltered = posts.TotalRows,
                RecordsTotal    = posts.TotalRows,
                Data            = posts.Posts
            };

            return(Json(jqdtResponse));
        }
示例#13
0
        public async Task <JqDataTableResponse <BankAccountListItemDto> > GetPagedResultAsync(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var filterKey = model.Search.Value;

            var linqStmt = (from ba in _dataContext.BankAccounts
                            where ba.Status != Constants.RecordStatus.Deleted && (filterKey == null || EF.Functions.Like(ba.AccountHolderName, "%" + filterKey + "%") ||
                                                                                  EF.Functions.Like(ba.AccountNumber, "%" + filterKey + "%") ||
                                                                                  EF.Functions.Like(ba.BranchName, "%" + filterKey + "%"))
                            select new BankAccountListItemDto
            {
                Id = ba.Id,
                AccountHolderName = ba.AccountHolderName,
                AccountNumber = ba.AccountNumber,
                BankName = ba.BankName,
                BranchName = ba.BranchName,
                Ifsc = ba.Ifsc,
                Status = ba.Status,
                LedgerType = ba.LedgerType,
                AccountName = ba.AccountName,
                AccountId = ba.AccountId,
                AccountCode = ba.AccountCode,
                COA_AccountTypeId = ba.COA_AccountTypeId
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <BankAccountListItemDto>
            {
                RecordsTotal    = await _dataContext.BankAccounts.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqStmt.CountAsync(),
                Data            = await linqStmt.OrderBy(sortExpression).Skip(model.Start)
                                  .Take(model.Length)
                                  .ToListAsync()
            };

            return(pagedResult);
        }
示例#14
0
        public async Task <JqDataTableResponse <BillPaymentListItemDto> > GetPagedResultAsync(ExpensePaymentJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var linqstmt = (from bp in _dataContext.BillPayments
                            join b in _dataContext.Bills
                            on bp.BillId equals b.Id
                            join v in _dataContext.Vendors
                            on b.VendorId equals v.Id
                            where (model.VendorId == null ||
                                   b.VendorId == model.VendorId.Value) &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(b.Id.ToString(), "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(v.Name, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(v.HSTNumber, "%" + model.FilterKey + "%"))
                            select new BillPaymentListItemDto
            {
                Id = bp.Id,
                ReferenceNumber = bp.BillId.ToString(),
                VendorName = bp.Bill.Vendor.Name,
                PaymentMode = bp.PaymentMode,
                PaymentAmount = bp.Amount,
                DepositFrom = bp.BankAccount.AccountNumber,
                DepositTo = bp.DepositTo,
                CreatedOn = bp.CreatedOn
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <BillPaymentListItemDto>
            {
                RecordsTotal    = await _dataContext.BillPayments.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#15
0
        public async Task <IActionResult> List(DataTableRequest model)
        {
            var searchBy = model.Search?.Value;
            var take     = model.Length;
            var offset   = model.Start;

            var response = await _linkForwarderService.GetPagedLinksAsync(offset, take, searchBy);

            if (response.IsSuccess)
            {
                var jqdtResponse = new JqDataTableResponse <Link>
                {
                    Draw            = model.Draw,
                    RecordsFiltered = response.Item.TotalRows,
                    RecordsTotal    = response.Item.TotalRows,
                    Data            = response.Item.Links
                };
                return(Json(jqdtResponse));
            }
            return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
        }
示例#16
0
        //with online status
        public async Task <JqDataTableResponse <UserDetailDto> > GetOnlineAgentPagedResultAsync(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var filterKey = model.Search.Value;

            var linqStmt = (from s in _dataContext.User
                            join l in _dataContext.LoginModule on s.Id equals l.UserId into sl
                            from l in sl.DefaultIfEmpty()
                            where s.Role.RoleName == "Agent" && s.Status != Constants.RecordStatus.Deleted && (model.filterKey == null || EF.Functions.Like(s.FirstName, "%" + model.filterKey + "%") ||
                                                                                                               EF.Functions.Like(s.LastName, "%" + model.filterKey + "%"))
                            select new UserDetailDto
            {
                Id = s.Id,
                FirstName = s.FirstName,
                LastName = s.LastName,
                UserName = s.UserName,
                Password = s.Password,
                Mobile = s.Mobile,
                Email = s.Email,
                RoleId = s.RoleId,
                RoleName = s.Role.RoleName,
                CallStatus = l.status ?? false
            })
                           .AsNoTracking();

            var sortExpresstion = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <UserDetailDto>
            {
                RecordsTotal    = await _dataContext.User.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqStmt.CountAsync(),
                Data            = await linqStmt.OrderBy(sortExpresstion).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#17
0
        public async Task <JqDataTableResponse <VendorListItemDto> > GetPagedResultAsync(VendorJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var filterKey = model.Search.Value;

            var linqStmt = (from v in _dataContext.Vendors
                            where v.Status != Constants.RecordStatus.Deleted &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(v.Name, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(v.Email, "%" + model.FilterKey + "%"))
                            select new VendorListItemDto
            {
                Id = v.Id,
                HSTNumber = v.HSTNumber,
                Name = v.Name,
                Email = v.Email,
                Phone = v.Phone,
                Fax = v.Fax,
                Website = v.Website,
                Status = v.Status
            })
                           .AsNoTracking();
            var sortExpression = model.GetSortExpression();
            var pagedResult    = new JqDataTableResponse <VendorListItemDto>
            {
                RecordsTotal    = await _dataContext.Vendors.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqStmt.CountAsync(),
                Data            = await linqStmt.OrderBy(sortExpression).Skip(model.Start)
                                  .Take(model.Length)
                                  .ToListAsync()
            };

            return(pagedResult);
        }
示例#18
0
        public async Task <JqDataTableResponse <ActivityCallDetailDto> > GetPagedResultAsync(JqDataTableRequest model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filerKey = model.Search.Value;

            var linqstmt = (from ac in _dataContext.ActivityCall
                            where (filerKey == null || EF.Functions.Like(ac.CallSubject, "%" + filerKey + "%") ||
                                   EF.Functions.Like(ac.CallDescription, "%" + filerKey + "%"))
                            select new ActivityCallDetailDto
            {
                Id = ac.Id,
                CallSubject = ac.CallSubject,
                CallDescription = ac.CallDescription,
                CallPurpose = ac.CallPurpose,
                CallDate = ac.CallDate,
                CallTime = ac.CallTime,
                UserId = ac.UserId,
                DescriptionHtml = ac.DescriptionHtml,
                EntityId = ac.EntityId,
                EntityMasterId = ac.EntityMasterId
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <ActivityCallDetailDto>
            {
                RecordsTotal    = await _dataContext.ActivityCall.CountAsync(),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#19
0
        public async Task <JqDataTableResponse <CustomerListItemDto> > GetPagedResultAsync(CustomerJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }
            var filerKey = model.Search.Value;

            var linqstmt = (from c in _dataContext.Customers
                            where c.Status != Constants.RecordStatus.Deleted && (model.FilterKey == null || EF.Functions.Like(c.FirstName, "%" + model.FilterKey + "%") ||
                                                                                 EF.Functions.Like(c.LastName, "%" + model.FilterKey + "%") || EF.Functions.Like(c.Email, "%" + model.FilterKey + "%"))
                            select new CustomerListItemDto
            {
                Id = c.Id,
                FirstName = c.FirstName,
                MiddleName = c.MiddleName,
                LastName = c.LastName,
                Phone = c.Phone,
                Email = c.Email,
                AccountNumber = c.AccountNumber,
                BankBranch = c.BankBranch,
                Discount = (c.Discount ?? 0),
                Status = c.Status
            })
                           .AsNoTracking();

            var sortExpression = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <CustomerListItemDto>
            {
                RecordsTotal    = await _dataContext.Customers.CountAsync(x => x.Status != Constants.RecordStatus.Deleted),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpression).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            return(pagedResult);
        }
示例#20
0
        public async Task <JqDataTableResponse <TransactionListItemDto> > GetPagedResultAsync(TransactionJqDataTableRequestModel model)
        {
            if (model.Length == 0)
            {
                model.Length = Constants.DefaultPageSize;
            }

            var linqstmt = (from i in _dataContext.Transaction
                            join b in _dataContext.BankAccounts
                            on i.BankAccountId equals b.Id
                            join c in _dataContext.Customers
                            on i.ContactId equals c.Id into cust
                            from c in cust.DefaultIfEmpty()
                            join v in _dataContext.Vendors
                            on i.ContactId equals v.Id into vend
                            from v in vend.DefaultIfEmpty()
                            where i.isForTransEntry == true &&
                            (model.FilterKey == null ||
                             EF.Functions.Like(v.Name, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.FirstName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.LastName, "%" + model.FilterKey + "%") ||
                             EF.Functions.Like(c.MiddleName, "%" + model.FilterKey + "%"))


                            select new TransactionListItemDto
            {
                Id = i.Id,
                TransactionId = i.TransactionId,
                BankAccountName = b.AccountName,
                Description = i.Description,
                TransactionDate = i.TransactionDate,
                DebitAmount = i.DebitAmount,
                CreditAmount = i.CreditAmount,
                Status = i.Status,
                TransactionType = i.TransactionTypeId,
                ContactName = (Constants.ContactType)i.ContactType == 0 ? (c.FirstName ?? "") + " " + (c.MiddleName ?? "") + " " + (c.LastName ?? "") : (v.Name ?? ""),
                isForTransEntry = i.isForTransEntry,
                amount = (int)i.TransactionTypeId == 0 && (int)i.TransactionTypeId == 1 && (int)i.TransactionTypeId == 4 ? i.DebitAmount:i.CreditAmount,
                //ContactType = (Constants.ContactType)i.ContactType,
                //ContactId= (int)i.ContactId,
            })
                           .AsNoTracking();


            var sortExpresstion = model.GetSortExpression();

            var pagedResult = new JqDataTableResponse <TransactionListItemDto>
            {
                RecordsTotal    = await _dataContext.Transaction.CountAsync(),
                RecordsFiltered = await linqstmt.CountAsync(),
                Data            = await linqstmt.OrderBy(sortExpresstion).Skip(model.Start).Take(model.Length).ToListAsync()
            };

            foreach (var transactionListItemDto in pagedResult.Data)
            {
                transactionListItemDto.TransactionDate = Utility.GetDateTime(transactionListItemDto.TransactionDate, null);
                transactionListItemDto.ModifyDate      = Utility.GetDateTime(transactionListItemDto.ModifyDate, null);
            }


            return(pagedResult);
        }