示例#1
0
        public ComboBoxPagedResult GetProductHelpList(string searchTerm, int pageSize, int pageNum)
        {
            var ProductTypeId = new ProductTypeService(_unitOfWork).Find(ProductTypeConstants.Rug).ProductTypeId;

            var Query = (from p in db.Product
                         join t in db.ProductGroups on p.ProductGroupId equals t.ProductGroupId
                         where t.ProductTypeId == ProductTypeId
                         orderby p.ProductName
                         select new ComboBoxResult
            {
                id = p.ProductId.ToString(),
                text = p.ProductName,
            });

            if (!string.IsNullOrEmpty(searchTerm))
            {
                Query = Query.Where(m => m.text.ToLower().Contains(searchTerm.ToLower()));
            }

            var temp = Query.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList();

            var count = Query.Count();

            ComboBoxPagedResult Data = new ComboBoxPagedResult();

            Data.Results = temp;
            Data.Total   = count;

            return(Data);
        }
        public IQueryable <ProductDesign> GetProductDesignListForColourWays()
        {
            int pid = new ProductTypeService(_unitOfWork).GetProductTypeByName(ProductTypeConstants.Rug).ProductTypeId;
            var pt  = _unitOfWork.Repository <ProductDesign>().Query().Get().Where(m => m.ProductTypeId == pid).OrderBy(m => m.ProductDesignName);

            return(pt);
        }
示例#3
0
        public IQueryable <RateListViewModel> GetWeavingRateListForIndex()
        {
            var ProcessId     = new ProcessService(_unitOfWork).Find(ProcessConstants.Weaving).ProcessId.ToString();
            int ProductTypeId = new ProductTypeService(_unitOfWork).Find(ProductTypeConstants.Rug).ProductTypeId;

            //var temp=(from p in db.ProductGroups
            //         join t in db.PersonRateGroup
            //         join t2 in db.RateList.Where(m=>m.DocTypeId==643) on new { x=p.ProductGroupId,y=t.PersonRateGroupId} equals new {x=t2.DocId ,y=t2.PersonRateGroupId } into table
            //         from tab in table.DefaultIfEmpty()
            //         select p)

            //var temp = (from p in db.ProductGroups
            //            from t in db.PersonRateGroup
            //            select new { p, t }).ToList();


            //(from p in db.ProductGroups
            // from t in db.PersonRateGroup.Where(m => m.ProcessId == 43)
            // join t2 in db.RateList on new { x= p.ProductGroupId, y=t.PersonRateGroupId } equals new { x=t2.DocId.Value ,y=t2.PersonRateGroupId.Value} into table from tab in table.DefaultIfEmpty()
            // where p.ProductTypeId == 1
            // select new { p.ProductGroupName, t.PersonRateGroupName }).ToList();



            var temp = (from p in db.ProductGroups
                        from t in db.PersonRateGroup.Where(m => m.Processes.IndexOf(ProcessId) != -1)
                        join t2 in db.RateList on new { x = p.ProductGroupId, y = t.PersonRateGroupId } equals new { x = t2.DocId.Value, y = t2.PersonRateGroupId.Value } into table from tab in table.DefaultIfEmpty()
                        where p.ProductTypeId == ProductTypeId
                        orderby p.ProductGroupName
                        select new RateListViewModel {
                Design = p.ProductGroupName, ProductGroupId = p.ProductGroupId, PersonRateGroupName = t.PersonRateGroupName, PersonRateGroupId = t.PersonRateGroupId, Rate = tab.Rate, WEF = tab.WEF, RateListId = tab.RateListId
            });

            return(temp);
        }
        public IEnumerable <ProductType> GetProductTypeList()
        {
            int id    = new ProductTypeService(_unitOfWork).GetProductTypeByName(ProductTypeConstants.Rug).ProductTypeId;
            int finid = new ProductNatureService(_unitOfWork).GetProductNatureByName(ProductTypeConstants.FinishedMaterial).ProductNatureId;

            return(from p in db.ProductTypes
                   where p.ProductTypeId != id && p.ProductNatureId == finid
                   select p
                   );
        }
示例#5
0
        public RateListViewModel GetNewRateListForWeaving(int ProductGroupId, int PersonRateGroupId)
        {
            var ProcessId     = new ProcessService(_unitOfWork).Find(ProcessConstants.Weaving).ProcessId.ToString();
            int ProductTypeId = new ProductTypeService(_unitOfWork).Find(ProductTypeConstants.Rug).ProductTypeId;

            var temp = (from p in db.ProductGroups
                        from t in db.PersonRateGroup.Where(m => m.Processes.IndexOf(ProcessId) != -1)
                        join t2 in db.RateList on new { x = p.ProductGroupId, y = t.PersonRateGroupId } equals new { x = t2.DocId.Value, y = t2.PersonRateGroupId.Value } into table
                        from tab in table.DefaultIfEmpty()
                        where p.ProductTypeId == ProductTypeId && p.ProductGroupId == ProductGroupId && t.PersonRateGroupId == PersonRateGroupId
                        orderby p.ProductGroupName
                        select new RateListViewModel {
                Design = p.ProductGroupName, ProductGroupId = p.ProductGroupId, PersonRateGroupName = t.PersonRateGroupName, PersonRateGroupId = t.PersonRateGroupId, Rate = tab.Rate, WEF = DateTime.Now, RateListId = tab.RateListId, Loss = tab.Loss, UnCountedQty = tab.UnCountedQty
            }).FirstOrDefault();

            return(temp);
        }
        public IQueryable <CarpetIndexViewModel> GetCarpetListForIndex(bool sample)
        {
            //return (from p in db.Products
            //        join t in db.ProductCategory on p.ProductCategoryId equals t.ProductCategoryId into table
            //        from tab in table.DefaultIfEmpty()
            //        join t1 in db.ProductTypes on tab.ProductTypeId equals t1.ProductTypeId into table1
            //        from tab1 in table1.DefaultIfEmpty()
            //        where tab1.IsCustomUI != null
            //        orderby p.ProductName, p.ProductGroup.ProductGroupName
            //        select new CarpetIndexViewModel
            //        {
            //            ProductId = p.ProductId,
            //            ProductName = p.ProductName,
            //            ProductGroupName = p.ProductGroup.ProductGroupName,
            //            ProductCategoryId = tab.ProductCategoryId,
            //            ProductCategoryName = tab.ProductCategoryName,
            //            ProductGroupId = p.ProductGroupId,
            //            ProductDesignName=p.ProductDesign.ProductDesignName,
            //        }
            //            );



            //return (from p in db.ProductGroups
            //        join t in db.FinishedProduct on p.ProductGroupId equals t.ProductGroupId into FinishedProductTable
            //        from FinishedProductTab in FinishedProductTable
            //        join t1 in db.ProductCategory on FinishedProductTable.FirstOrDefault().ProductCategoryId equals t1.ProductCategoryId into table1
            //        from tab1 in table1
            //        join t2 in db.ProductTypes on tab1.ProductTypeId equals t2.ProductTypeId into table2
            //        from tab2 in table2
            //        where tab2.ProductTypeName==ProductTypeConstants.Rug
            //        orderby p.ProductGroupName
            //        select new CarpetIndexViewModel
            //        {
            //            ProductId = FinishedProductTab.ProductId,
            //            ProductName = FinishedProductTab.ProductName,
            //            ProductGroupName = p.ProductGroupName,
            //            ProductCategoryId = tab1.ProductCategoryId,
            //            ProductCategoryName = tab1.ProductCategoryName,
            //            ProductGroupId = p.ProductGroupId,
            //            ProductDesignName = FinishedProductTab.ProductDesign.ProductDesignName,
            //        }
            //          );



            int typeid = new ProductTypeService(_unitOfWork).GetProductTypeByName(ProductTypeConstants.Rug).ProductTypeId;



            //return (from p in db.ProductGroups
            //        join t in db.FinishedProduct on p.ProductGroupId equals t.ProductGroupId
            //        where p.ProductTypeId == typeid
            //        group t by new { t.ProductGroupId, t.ProductGroup.ProductGroupName } into table
            //        orderby table.Key.ProductGroupName
            //        select new CarpetIndexViewModel
            //        {
            //            ProductGroupId = table.Key.ProductGroupId ?? 0,
            //            ProductGroupName = table.Key.ProductGroupName,
            //            ProductCategoryName = table.FirstOrDefault().ProductCategory.ProductCategoryName,
            //            ProductDesignName = table.FirstOrDefault().ProductDesign.ProductDesignName,
            //            ProductCollectionName = table.FirstOrDefault().ProductCollection.ProductCollectionName
            //        }

            //     );

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

            var temp = from Pg in db.ProductGroups
                       join Fp in db.FinishedProduct on Pg.ProductGroupId equals Fp.ProductGroupId into FinishedProductTable
                       from FinishedProductTab in FinishedProductTable.DefaultIfEmpty()
                       join Pc in db.ProductCategory on FinishedProductTab.ProductCategoryId equals Pc.ProductCategoryId into ProductCategoryTable
                       from ProductCategoryTab in ProductCategoryTable.DefaultIfEmpty()
                       join Pd in db.ProductDesigns on FinishedProductTab.ProductDesignId equals Pd.ProductDesignId into ProductDesignTable
                       from ProductDesignTab in ProductDesignTable.DefaultIfEmpty()
                       join PCol in db.ProductCollections on FinishedProductTab.ProductCollectionId equals PCol.ProductCollectionId into ProductCollectionTable
                       from ProductCollectionTab in ProductCollectionTable.DefaultIfEmpty()
                       where Pg.ProductTypeId == typeid && (FinishedProductTab.IsSample == sample || FinishedProductTab == null) && (FinishedProductTab == null || FinishedProductTab.DivisionId == DivisionId)
                       group new { Pg, ProductCategoryTab, ProductDesignTab, ProductCollectionTab } by new { Pg.ProductGroupId, Pg.ProductGroupName } into table
            orderby table.Key.ProductGroupName
                select new CarpetIndexViewModel
            {
                ProductGroupId        = table.Key.ProductGroupId,
                ProductGroupName      = table.Key.ProductGroupName,
                ProductCategoryName   = table.Max(m => m.ProductCategoryTab.ProductCategoryName),
                ProductDesignName     = table.Max(m => m.ProductDesignTab.ProductDesignName),
                ProductCollectionName = table.Max(m => m.ProductCollectionTab.ProductCollectionName)
            };

            return(temp);
        }