コード例 #1
0
        public IEnumerable <ComboBoxList> GetProductHelpList(int Id, string term)
        {
            var SaleDispatchReturn = new SaleDispatchReturnHeaderService(_unitOfWork).Find(Id);

            //var settings = new SaleDispatchSettingService(_unitOfWork).GetSaleDispatchSettingForDocument(SaleDispatchReturn.DocTypeId, SaleDispatchReturn.DivisionId, SaleDispatchReturn.SiteId);

            //string[] ProductTypes = null;
            //if (!string.IsNullOrEmpty(settings.filterProductTypes)) { ProductTypes = settings.filterProductTypes.Split(",".ToCharArray()); }
            //else { ProductTypes = new string[] { "NA" }; }

            var list = (from p in db.Product
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : p.ProductName.ToLower().Contains(term.ToLower()))
                        //&& (string.IsNullOrEmpty(settings.filterProductTypes) ? 1 == 1 : ProductTypes.Contains(p.ProductGroup.ProductTypeId.ToString()))
                        group new { p } by p.ProductId into g
                        select new ComboBoxList
            {
                PropFirst = g.Max(m => m.p.ProductName),
                Id = g.Key,

                //    DocumentTypeName=g.Max(p=>p.p.DocumentTypeShortName)
            }
                        ).Take(20);

            return(list.ToList());
        }
コード例 #2
0
        public IEnumerable <SaleDispatchListViewModel> GetPendingReceipts(int id, int SaleGoodsReturnHeaderId)
        {
            var SaleGoodsReturn = new SaleDispatchReturnHeaderService(_unitOfWork).Find(SaleGoodsReturnHeaderId);

            var settings = new SaleDispatchSettingService(_unitOfWork).GetSaleDispatchSettingForDocument(SaleGoodsReturn.DocTypeId, SaleGoodsReturn.DivisionId, SaleGoodsReturn.SiteId);

            string[] contraDocTypes = null;
            if (!string.IsNullOrEmpty(settings.filterContraDocTypes))
            {
                contraDocTypes = settings.filterContraDocTypes.Split(",".ToCharArray());
            }
            else
            {
                contraDocTypes = new string[] { "NA" };
            }

            string[] contraSites = null;
            if (!string.IsNullOrEmpty(settings.filterContraSites))
            {
                contraSites = settings.filterContraSites.Split(",".ToCharArray());
            }
            else
            {
                contraSites = new string[] { "NA" };
            }

            string[] contraDivisions = null;
            if (!string.IsNullOrEmpty(settings.filterContraDivisions))
            {
                contraDivisions = settings.filterContraDivisions.Split(",".ToCharArray());
            }
            else
            {
                contraDivisions = new string[] { "NA" };
            }

            int CurrentSiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];


            return(from p in db.ViewSaleDispatchBalance
                   join t in db.SaleDispatchHeader on p.SaleDispatchHeaderId equals t.SaleDispatchHeaderId into table
                   from tab in table.DefaultIfEmpty()
                   join t1 in db.SaleOrderLine on p.SaleOrderLineId equals t1.SaleOrderLineId into table1
                   from tab1 in table1.DefaultIfEmpty()
                   where p.ProductId == id && tab.SaleToBuyerId == SaleGoodsReturn.BuyerId && p.BalanceQty > 0 &&
                   (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(p.DocTypeId.ToString())) &&
                   (string.IsNullOrEmpty(settings.filterContraSites) ? p.SiteId == CurrentSiteId : contraSites.Contains(p.SiteId.ToString())) &&
                   (string.IsNullOrEmpty(settings.filterContraDivisions) ? p.DivisionId == CurrentDivisionId : contraDivisions.Contains(p.DivisionId.ToString()))
                   select new SaleDispatchListViewModel
            {
                SaleDispatchLineId = p.SaleDispatchLineId,
                SaleDispatchHeaderId = p.SaleDispatchHeaderId,
                DocNo = tab.DocNo,
                Dimension1Name = tab1.Dimension1.Dimension1Name,
                Dimension2Name = tab1.Dimension2.Dimension2Name,
            }
                   );
        }
コード例 #3
0
        public IEnumerable <SaleOrderLineListViewModel> GetPendingSaleOrderHelpList(int Id, string term)//SaleOrderHeaderId
        {
            var SaleInvoice = new SaleDispatchReturnHeaderService(_unitOfWork).Find(Id);

            // var settings = new SaleDispatchSettingService(_unitOfWork).GetSaleDispatchSettingForDocument(SaleInvoice.DocTypeId, SaleInvoice.DivisionId, SaleInvoice.SiteId);

            //string[] contraDocTypes = null;
            //if (!string.IsNullOrEmpty(settings.filterContraDocTypes)) { contraDocTypes = settings.filterContraDocTypes.Split(",".ToCharArray()); }
            //else { contraDocTypes = new string[] { "NA" }; }

            //string[] contraSites = null;
            //if (!string.IsNullOrEmpty(settings.filterContraSites)) { contraSites = settings.filterContraSites.Split(",".ToCharArray()); }
            //else { contraSites = new string[] { "NA" }; }

            //string[] contraDivisions = null;
            //if (!string.IsNullOrEmpty(settings.filterContraDivisions)) { contraDivisions = settings.filterContraDivisions.Split(",".ToCharArray()); }
            //else { contraDivisions = new string[] { "NA" }; }

            int CurrentSiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];

            var list = (from p in db.ViewSaleDispatchBalance
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : p.SaleOrderNo.ToLower().Contains(term.ToLower())) && p.BalanceQty > 0 && p.BuyerId == SaleInvoice.BuyerId && p.SaleOrderLineId != null
                        //&& (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(p.DocTypeId.ToString()))
                        // && (string.IsNullOrEmpty(settings.filterContraSites) ? p.SiteId == CurrentSiteId : contraSites.Contains(p.SiteId.ToString()))
                        // && (string.IsNullOrEmpty(settings.filterContraDivisions) ? p.DivisionId == CurrentDivisionId : contraDivisions.Contains(p.DivisionId.ToString()))
                        group new { p } by p.SaleOrderHeaderId == null ? -1 : p.SaleOrderHeaderId into g
                        select new SaleOrderLineListViewModel
            {
                DocNo = g.Max(m => m.p.SaleOrderNo),
                SaleOrderHeaderId = g.Key,
            }
                        ).Take(20);

            return(list.ToList());
        }