예제 #1
0
        private void UpdateGrid()
        {
            var totalRow = 0;
            var page     = _grid.Pager;
            var sort     = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "Subject" : page.Sidx, page.Sord == "asc");
            IEnumerable <CRMPriceQuotation> customers = priceQuotationService.GetAll(priceSearch, sort, out totalRow, page.CurrentPage, page.PageSize, CurrenUser);

            _grid.Pager.Init(totalRow);
            if (totalRow == 0)
            {
                _grid.Data           = new List <CRMPriceQuotation>();
                ViewBag.TotalDisplay = string.Empty;
                return;
            }
            var crmPriceQuotations = customers as IList <CRMPriceQuotation> ?? customers.ToList();

            _grid.Data = crmPriceQuotations;

            var    cusFollow    = crmPriceQuotations.Count(x => x.CRMPriceStatus.Code == (byte)CRMPriceStaus.Following && x.CreatedById == CurrenUser.Id);
            var    cancle       = crmPriceQuotations.Count(x => x.CRMPriceStatus.Code == (byte)CRMPriceStaus.Cancel && x.CreatedById == CurrenUser.Id);
            var    cusFinish    = crmPriceQuotations.Count(x => x.CRMPriceStatus.Code == (byte)CRMPriceStaus.Finished && x.CreatedById == CurrenUser.Id);
            string totalDisplay =
                string.Format(Resources.Resource.CRM_PRICE_LIST_TOTAL,
                              totalRow, cusFollow, cusFinish, cancle);

            ViewBag.TotalDisplay = totalDisplay;
        }
예제 #2
0
        private List <ReportCustomerViewModel> ListCustomersHashPrice(PlanFilter filter)
        {
            var list =
                priceQuotationService.GetAll(
                    x =>
                    (filter.Month == 0 || x.LastDateSend.Value.Month == filter.Month) && x.LastDateSend.Value.Year == filter.Year &&
                    x.CreatedById == filter.Id && x.CountSendMail == 1).Select(x => new ReportCustomerViewModel
            {
                DateTime    = x.LastDateSend.Value,
                CompanyName = x.CRMCustomer.CompanyShortName,
                ContactName = x.CRMCustomer.CRMContacts.Aggregate("", (current, u) => current + (u.FullName + "/" + u.Phone + "<br/>"))
            });

            return(list.ToList());
        }