public void GetLiveBusinessPartners()
        {
            var criteria = new SearchCriteria <BusinessPartnerDTO>();

            BusinessPartnerList = _businessPartnerService.GetAll(criteria).OrderBy(i => i.Id).ToList();

            BusinessPartners = new ObservableCollection <BusinessPartnerDTO>(BusinessPartnerList);
        }
        public void GetLiveBusinessPartners()
        {
            var criteria = new SearchCriteria <BusinessPartnerDTO>();

            criteria.FiList.Add(b => b.BusinessPartnerType == BusinessPartnerType);

            BusinessPartnerList = _businessPartnerService.GetAll(criteria)
                                  .OrderBy(i => i.Id)
                                  .Skip(1)
                                  .ToList();

            BusinessPartners = new ObservableCollection <BusinessPartnerDTO>(BusinessPartnerList);
        }
Esempio n. 3
0
 public async Task <ActionResponse <List <BusinessPartnerDto> > > GetAll()
 {
     return(await businessPartnerService.GetAll());
 }
        public ActionResult Index(string type, string searchText, int?page, int?pageSize, int?ptype, string creditStatus, string warehouseId)
        {
            try
            {
                FilterByCredit();
                var bpType = (BusinessPartnerTypes)Convert.ToInt32(type);
                ViewData["BussinessPartnerType"] = bpType.ToString();
                ViewData["BPType"] = type;

                var criteria = new SearchCriteria <BusinessPartnerDTO>();

                criteria.FiList.Add(b => b.BusinessPartnerType == bpType);

                #region Search Text
                if (!string.IsNullOrEmpty(searchText))
                {
                    ViewData["BusinessPartnerSearch"] = "search results for '" + searchText + "'";
                    ViewData["SearchText"]            = searchText;
                }
                else
                {
                    ViewData["BusinessPartnerSearch"] = string.Empty;
                    ViewData["SearchText"]            = string.Empty;
                }

                if (!string.IsNullOrEmpty(searchText))
                {
                    criteria.FiList.Add(bp => bp.Code.Contains(searchText) || bp.DisplayName.Contains(searchText));
                }
                #endregion

                #region Filter By Credit Status
                int credStatus;
                if (int.TryParse(creditStatus, out credStatus) && credStatus != 0 && credStatus != -1)
                {
                    ViewData["CreditStat"]   = creditStatus;
                    criteria.PaymentListType = credStatus;
                }
                else
                {
                    ViewData["CreditStat"] = "-1";
                }
                #endregion

                #region Paging
                if (page != null && ptype != null && pageSize != null)
                {
                    criteria.Page     = (int)(page + ptype);
                    criteria.PageSize = (int)pageSize;

                    if (criteria.Page < 1)
                    {
                        criteria.Page = 1;
                    }
                }
                else
                {
                    criteria.Page     = 1;
                    criteria.PageSize = 25;
                }
                if (criteria.Page == 1)
                {
                    ViewData["prevDisabled"] = "none";
                }
                ViewData["Page"]     = criteria.Page;
                ViewData["PageSize"] = criteria.PageSize;

                #endregion

                int totalCount;
                var bps = _businessPartnerService.GetAll(criteria, out totalCount);
                @ViewData["totalNumber"] = totalCount;


                #region Paging
                var pages = HelperUtility.GetPages(totalCount, criteria.PageSize);
                ViewData["totalPages"] = pages;

                if (pages == 0)
                {
                    criteria.Page    = 0;
                    ViewData["Page"] = 0;
                }

                if (criteria.Page == pages)
                {
                    ViewData["nextDisabled"] = "none";
                }
                #endregion

                #region For Serial Number
                var sNo = (criteria.Page - 1) * criteria.PageSize + 1;
                foreach (var businessPartnerDTO in bps)
                {
                    businessPartnerDTO.SerialNumber = sNo;
                    sNo++;
                }
                #endregion

                if (Request.IsAjaxRequest())
                {
                    //Thread.Sleep(3000);
                    return(PartialView("_businessPartner", bps));
                }
                return(View(bps));
            }
            catch
            {
                return(HttpNotFound("Problem getting transactions list"));
            }
        }