コード例 #1
0
        public IQueryable <ComboBoxResult> GetProductHelpList(int Id, string term)
        {
            var SaleDeliveryOrderCancel = new SaleDeliveryOrderCancelHeaderService(_unitOfWork).Find(Id);

            var settings = new SaleDeliveryOrderSettingsService(_unitOfWork).GetSaleDeliveryOrderSettingsForDocument(SaleDeliveryOrderCancel.DocTypeId, SaleDeliveryOrderCancel.DivisionId, SaleDeliveryOrderCancel.SiteId);

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

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

            var list = (from p in db.ViewSaleDeliveryOrderBalance
                        join sol in db.SaleOrderLine on p.SaleOrderLineId equals sol.SaleOrderLineId
                        join prod in db.Product on sol.ProductId equals prod.ProductId
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : prod.ProductName.ToLower().Contains(term.ToLower())) &&
                        p.BuyerId == SaleDeliveryOrderCancel.BuyerId && p.SiteId == CurrentSiteId && p.DivisionId == CurrentDivisionId
                        //&& (string.IsNullOrEmpty(settings.filterProductTypes) ? 1 == 1 : ProductTypes.Contains(p.ProductGroup.ProductTypeId.ToString()))
                        group prod by prod.ProductId into g
                        orderby g.Max(m => m.ProductName)
                        select new ComboBoxResult
            {
                text = g.Max(m => m.ProductName),
                id = g.Max(m => m.ProductId.ToString()),
            });

            return(list);
        }
コード例 #2
0
        public IQueryable <ComboBoxResult> GetPendingSaleDeliveryOrderHelpList(int Id, string term)
        {
            var SaleDeliveryOrderCancel = new SaleDeliveryOrderCancelHeaderService(_unitOfWork).Find(Id);

            var settings = new SaleDeliveryOrderSettingsService(_unitOfWork).GetSaleDeliveryOrderSettingsForDocument(SaleDeliveryOrderCancel.DocTypeId, SaleDeliveryOrderCancel.DivisionId, SaleDeliveryOrderCancel.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.ViewSaleDeliveryOrderBalance
                        where (string.IsNullOrEmpty(term) ? 1 == 1 : p.SaleDeliveryOrderNo.ToLower().Contains(term.ToLower())) && p.BuyerId == SaleDeliveryOrderCancel.BuyerId && p.BalanceQty > 0
                        //&& (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(p.DocTypeId.ToString()))
                        && p.SiteId == CurrentSiteId && p.DivisionId == CurrentDivisionId
                        group new { p } by p.SaleDeliveryOrderHeaderId into g
                        orderby g.Max(m => m.p.SaleDeliveryOrderNo)
                        select new ComboBoxResult
            {
                text = g.Max(m => m.p.SaleDeliveryOrderNo),
                id = g.Key.ToString(),
            });

            return(list);
        }
コード例 #3
0
        public IQueryable <ComboBoxResult> GetCustomPerson(int Id, string term)
        {
            int DocTypeId  = Id;
            int SiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];
            int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];

            var settings = new SaleDeliveryOrderSettingsService(_unitOfWork).GetSaleDeliveryOrderSettingsForDocument(DocTypeId, DivisionId, SiteId);

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

            string DivIdStr  = "|" + DivisionId.ToString() + "|";
            string SiteIdStr = "|" + SiteId.ToString() + "|";

            var list = (from p in db.Persons
                        join bus in db.BusinessEntity on p.PersonID equals bus.PersonID into BusinessEntityTable
                        from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty()
                        join pp in db.PersonProcess on p.PersonID equals pp.PersonId into PersonProcessTable
                        from PersonProcessTab in PersonProcessTable.DefaultIfEmpty()
                        join pr in db.PersonRole on p.PersonID equals pr.PersonId into PersonRoleTable
                        from PersonRoleTab in PersonRoleTable.DefaultIfEmpty()
                        where PersonProcessTab.ProcessId == settings.ProcessId &&
                        (string.IsNullOrEmpty(term) ? 1 == 1 : (p.Name.ToLower().Contains(term.ToLower()) || p.Code.ToLower().Contains(term.ToLower()))) &&
                        (string.IsNullOrEmpty(settings.filterPersonRoles) ? 1 == 1 : PersonRoles.Contains(PersonRoleTab.RoleDocTypeId.ToString())) &&
                        BusinessEntityTab.DivisionIds.IndexOf(DivIdStr) != -1 &&
                        BusinessEntityTab.SiteIds.IndexOf(SiteIdStr) != -1 &&
                        (p.IsActive == null ? 1 == 1 : p.IsActive == true)
                        group new { p } by new { p.PersonID } into Result
                        orderby Result.Max(m => m.p.Name)
                        select new ComboBoxResult
            {
                id = Result.Key.PersonID.ToString(),
                text = Result.Max(m => m.p.Name + ", " + m.p.Suffix + " [" + m.p.Code + "]"),
            }
                        );

            return(list);
        }
コード例 #4
0
        public IEnumerable <SaleDeliveryOrderLineListViewModel> GetPendingSaleDeliveryOrdersForOrderCancel(int ProductId, int SaleDeliveryOrderCancelHeaderId)//Product Id
        {
            var SaleDeliveryOrderCancel = new SaleDeliveryOrderCancelHeaderService(_unitOfWork).Find(SaleDeliveryOrderCancelHeaderId);

            var settings = new SaleDeliveryOrderSettingsService(_unitOfWork).GetSaleDeliveryOrderSettingsForDocument(SaleDeliveryOrderCancel.DocTypeId, SaleDeliveryOrderCancel.DivisionId, SaleDeliveryOrderCancel.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 tem = from p in db.ViewSaleDeliveryOrderBalance
                      join t in db.SaleDeliveryOrderLine on p.SaleDeliveryOrderLineId equals t.SaleDeliveryOrderLineId into table
                      from tab in table.DefaultIfEmpty()
                      join sol in db.SaleOrderLine on tab.SaleOrderLineId equals sol.SaleOrderLineId
                      where sol.ProductId == ProductId && p.BalanceQty > 0 && p.BuyerId == SaleDeliveryOrderCancel.BuyerId
                      //&& (string.IsNullOrEmpty(settings.filterContraDocTypes) ? 1 == 1 : contraDocTypes.Contains(p.DocTypeId.ToString()))
                      && p.SiteId == CurrentSiteId &&
                      p.DivisionId == CurrentDivisionId
                      orderby p.SaleDeliveryOrderNo
                      select new SaleDeliveryOrderLineListViewModel
            {
                DocNo = p.SaleDeliveryOrderNo,
                SaleDeliveryOrderLineId = p.SaleDeliveryOrderLineId,
                Dimension1Name          = sol.Dimension1.Dimension1Name,
                Dimension2Name          = sol.Dimension2.Dimension2Name,
            };

            return(tem);
        }