コード例 #1
0
        public ActionResult GetMediaAndSpecifications(ContentPortalFilter filter)
        {
            MergeSession(filter, ContentPortalFilter.SessionKey);
            using (var unit = GetUnitOfWork())
            {
                var serviceResult = ((IContentService)unit.Service <Content>()).GetMissing(filter.Connectors, filter.Vendors, filter.BeforeDate, filter.AfterDate, filter.OnDate, filter.IsActive, filter.ProductGroups, filter.Brands, filter.LowerStockCount, filter.GreaterStockCount, filter.EqualStockCount, filter.Statuses);

                if (serviceResult.Key > 0)
                {
                    MediaAndSpecificationsModel model = new MediaAndSpecificationsModel();
                    var content = serviceResult.Value;

                    model.ProductWithoutMediaUrlAndVideo = content.Where(c => !c.YouTube).Count();
                    model.ProductsWithoutImage           = content.Where(c => !c.Image).Count();
                    model.ProductsWithoutMedia           = content.Where(c => !c.Image && !c.YouTube).Count();
                    model.ProductsWithoutSpecs           = content.Where(c => !c.Specifications).Count();
                    model.ProductsWithoutMediaAndSpecs   = content.Where(c => !c.Image && !c.YouTube && !c.Specifications).Count();

                    model.TotalProducts = serviceResult.Key;

                    return(View("MediaAndspecifications", model));
                }
                else
                {
                    return(HtmlError());
                }
            }
        }
コード例 #2
0
        public ActionResult GetEdiOrdersForToday(ContentPortalFilter filter)
        {
            using (var unit = GetUnitOfWork())
            {
                var processed = unit.Service <EdiOrderListener>().GetAll(x => x.Processed == true);

                var unprocessed = unit.Service <EdiOrderListener>().GetAll(x => x.Processed == false);

                if (filter.OnDate != null || filter.BeforeDate != null || filter.AfterDate != null)
                {
                    processed = processed.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                            filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    unprocessed = unprocessed.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                    filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);
                }

                var callbackUI = "edi-order-listener-item";

                var serie = new Serie(new List <Concentrator.ui.Management.Models.Anychart.Point>()
                {
                    new PieChartPoint("Processed Orders", processed.Count(), action: new AnychartAction(callbackUI, new { ProcessedOrder = true })),
                    new PieChartPoint("Unprocessed Orders", unprocessed.Count(), action: new AnychartAction(callbackUI, new { UnprocessedOrder = true }))
                }, "Statistics", "Default");

                var model = new AnychartComponentModel(new List <Serie>()
                {
                    serie
                });

                return(View("Anychart/DefaultPieChart", model));
            }
        }
コード例 #3
0
        public ActionResult GetUrgentProducts(ContentPortalFilter filter, int?connectorID)
        {
            MergeSession(filter, ContentPortalFilter.SessionKey);

            if (!connectorID.HasValue)
            {
                connectorID = Client.User.ConnectorID;
            }

            int ReadyForWehkampAttributeID = int.Parse(ConfigurationManager.AppSettings["ReadyForWehkampAttributeID"]);
            int SentToWehkampAttributeID   = int.Parse(ConfigurationManager.AppSettings["SentToWehkampAsDummyAttributeID"]);

            using (var ppdb = new PetaPoco.Database(Environments.Current.Connection, "System.Data.SqlClient"))
            {
                string baseQuery = string.Format(@"
					select count(mc.ProductID)
          from content mc 
          left join productattributevalue pav2 on pav2.productid = mc.ProductID and pav2.attributeid = {1} --ReadyForWehkamp
          left join productattributevalue pav3 on pav3.productid = mc.ProductID and pav3.attributeid = {2} --SentToWehkampAsDummy
          where mc.connectorid = {0} 
          and pav3.Value = 'true'
         and ((pav2.Value is null or pav2.Value = 'false') or ((select top 1 productid from productmedia where productid = mc.productid) is null))"
                                                 , connectorID.Value, ReadyForWehkampAttributeID, SentToWehkampAttributeID);

                int countUrgentProducts = ppdb.ExecuteScalar <int>(baseQuery);

                ViewBag.CountUrgentProducts = countUrgentProducts;

                return(View("UrgentProducts"));
            }
        }
コード例 #4
0
        public ActionResult GetEdiOrdersSendBack(ContentPortalFilter filter)
        {
            using (var unit = GetUnitOfWork())
            {
                //var Acknowledgement = unit.Service<EdiOrderResponse>().GetAll(x => x.ReceiveDate == DateTime.Today && x.ResponseType == 100).Count();
                //var CancelNotification = unit.Service<EdiOrderResponse>().GetAll(x => x.ReceiveDate == DateTime.Today && x.ResponseType == 110).Count();
                //var ShipmentNotification = unit.Service<EdiOrderResponse>().GetAll(x => x.ReceiveDate == DateTime.Today && x.ResponseType == 200).Count();
                //var InvoiceNotification = unit.Service<EdiOrderResponse>().GetAll(x => x.ReceiveDate == DateTime.Today && x.ResponseType == 300).Count();
                //var PurchaseAcknowledgement = unit.Service<EdiOrderResponse>().GetAll(x => x.ReceiveDate == DateTime.Today && x.ResponseType == 400).Count();

                var Acknowledgement         = unit.Service <EdiOrderResponse>().GetAll(x => x.ResponseType == 100);
                var CancelNotification      = unit.Service <EdiOrderResponse>().GetAll(x => x.ResponseType == 110);
                var ShipmentNotification    = unit.Service <EdiOrderResponse>().GetAll(x => x.ResponseType == 200);
                var InvoiceNotification     = unit.Service <EdiOrderResponse>().GetAll(x => x.ResponseType == 300);
                var PurchaseAcknowledgement = unit.Service <EdiOrderResponse>().GetAll(x => x.ResponseType == 400);

                if (filter.OnDate != null || filter.BeforeDate != null || filter.AfterDate != null)
                {
                    Acknowledgement = Acknowledgement.Where(x => filter.OnDate != null ? x.ReceiveDate == filter.OnDate : true ||
                                                            filter.BeforeDate != null ? x.ReceiveDate <filter.BeforeDate : true ||
                                                                                                       filter.AfterDate != null?x.ReceiveDate> filter.AfterDate : true);

                    CancelNotification = CancelNotification.Where(x => filter.OnDate != null ? x.ReceiveDate == filter.OnDate : true ||
                                                                  filter.BeforeDate != null ? x.ReceiveDate <filter.BeforeDate : true ||
                                                                                                             filter.AfterDate != null?x.ReceiveDate> filter.AfterDate : true);

                    ShipmentNotification = ShipmentNotification.Where(x => filter.OnDate != null ? x.ReceiveDate == filter.OnDate : true ||
                                                                      filter.BeforeDate != null ? x.ReceiveDate <filter.BeforeDate : true ||
                                                                                                                 filter.AfterDate != null?x.ReceiveDate> filter.AfterDate : true);

                    InvoiceNotification = InvoiceNotification.Where(x => filter.OnDate != null ? x.ReceiveDate == filter.OnDate : true ||
                                                                    filter.BeforeDate != null ? x.ReceiveDate <filter.BeforeDate : true ||
                                                                                                               filter.AfterDate != null?x.ReceiveDate> filter.AfterDate : true);

                    PurchaseAcknowledgement = PurchaseAcknowledgement.Where(x => filter.OnDate != null ? x.ReceiveDate == filter.OnDate : true ||
                                                                            filter.BeforeDate != null ? x.ReceiveDate <filter.BeforeDate : true ||
                                                                                                                       filter.AfterDate != null?x.ReceiveDate> filter.AfterDate : true);
                }

                var callbackUI = "edi-order-item";

                var serie = new Serie(new List <Point>()
                {
                    new PieChartPoint("Acknowledgement", Acknowledgement.Count(), action: new AnychartAction(callbackUI, new { ResponseType = 100 })),
                    new PieChartPoint("Cancel Notification", CancelNotification.Count(), action: new AnychartAction(callbackUI, new { ResponseType = 110 })),
                    new PieChartPoint("Shipment Notification", ShipmentNotification.Count(), action: new AnychartAction(callbackUI, new { ResponseType = 200 })),
                    new PieChartPoint("Invoice Notification", InvoiceNotification.Count(), action: new AnychartAction(callbackUI, new { ResponseType = 300 })),
                    new PieChartPoint("Purchase Acknowledgement", PurchaseAcknowledgement.Count(), action: new AnychartAction(callbackUI, new { ResponseType = 400 })),
                }, "Statistics", "Default");

                var model = new AnychartComponentModel(new List <Serie>()
                {
                    serie
                });
                //return View("Anychart/DefaultAccumulationChart", model);
                return(View("Anychart/DefaultPieChart", model));
            }
        }
コード例 #5
0
        public ActionResult GetMissingLongDescriptionsCount(ContentPortalFilter filter)
        {
            MergeSession(filter, ContentPortalFilter.SessionKey);

            try
            {
                int?vendorid = null;

                if (ConfigurationManager.AppSettings["CheckForDescriptionVendorID"] != null)
                {
                    vendorid = int.Parse(ConfigurationManager.AppSettings["CheckForDescriptionVendorID"]);
                }


                using (var unit = GetUnitOfWork())
                {
                    var callbackUI = "content-item";
                    var points     = (from langCount in ((IProductService)unit.Service <Product>()).GetMissingLongDescriptionsCount(filter.Connectors, filter.Vendors, filter.BeforeDate, filter.AfterDate, filter.OnDate, filter.IsActive, filter.ProductGroups, filter.Brands, filter.LowerStockCount, filter.GreaterStockCount, filter.EqualStockCount, filter.Statuses, descriptionVendorID: vendorid)
                                      select new PieChartPoint(langCount.Key.Name, langCount.Value, action: new AnychartAction(callbackUI, new
                    {
                        LanguageID = langCount.Key.LanguageID,
                        hasLongContentDescription = false
                    }))
                                      ).ToList();

                    Serie serie = new Serie(new List <Point>(points), "Missing content", "Default");

                    return(View("Anychart/DefaultPieChart", new AnychartComponentModel(new List <Serie>()
                    {
                        serie
                    })));
                }
            }
            catch (Exception ex)
            {
                return(Failure("Unable to retrieve the missing content", ex));
            }
        }
コード例 #6
0
        public ActionResult GetList(int?connectorID, ContentFilter filter, ContentPortalFilter filterPortal, bool?hasLongContentDescription)
        {
            string readyForWehKampAndSendToWehkampQuery = "";

            int?vendorIDForDescriptions = null;

            if (!connectorID.HasValue)
            {
                connectorID = Client.User.ConnectorID;
            }

            if (ConfigurationManager.AppSettings["CheckForDescriptionVendorID"] != null)
            {
                vendorIDForDescriptions = int.Parse(ConfigurationManager.AppSettings["CheckForDescriptionVendorID"]);
            }

            if (Session[ContentPortalFilter.SessionKey] != null)
            {
                filterPortal = (ContentPortalFilter)Session[ContentPortalFilter.SessionKey];
            }

            int ReadyForWehkampAttributeID      = int.Parse(ConfigurationManager.AppSettings["ReadyForWehkampAttributeID"]);
            int SentToWehkampAttributeID        = int.Parse(ConfigurationManager.AppSettings["SentToWehkampAttributeID"]);
            int SentToWehkampAsDummyAttributeID = int.Parse(ConfigurationManager.AppSettings["SentToWehkampAsDummyAttributeID"]);
            int WehkampProductNumberAttributeID = int.Parse(ConfigurationManager.AppSettings["WehkampProductNumberAttributeID"]);

            using (var pp = new PetaPoco.Database(Environments.Current.Connection, "System.Data.SqlClient"))
            {
                string baseQuery = string.Format(@"
        
					select 
          mc.ConcentratorProductID,
          mc.IsActive as Active,
          VendorItemNumber,
          CustomItemNumber,
          BrandName,
          ShortDescription,
          Image,
          0 as YouTube,
          Specifications,
          mc.CreationTime,
          mc.LastModificationTime,
          IsConfigurable,
					case when (select count(*) from productdescription where productid = mc.concentratorproductid and vendorid = 48) > 0 then 1 else 0 end HasDescription,
		      case when (select count(*) from productdescription where productid = mc.concentratorproductid and vendorid = 48 and LanguageID = 3) > 0 then 1 else 0 end HasFrDescription,
          QuantityOnHand,
          isnull(pav.Value, '') as ShopWeek, 
          case when pav2.Value is null then 'false' else pav2.Value end as ReadyForWehkamp, 
          case when pav3.Value is null then 'false' else pav3.Value end as SentToWehkamp, 
          case when pav4.Value is null then 'false' else pav4.Value end as SentToWehkampAsDummy,
          case when pavWehkamp.Value is null then '' else pavWehkamp.Value end as WehkampProductNumber,
          case when pavBtF.Value is null then 'false' else pavBtF.Value end as BtF           

          from missingcontent mc
          left join productattributevalue pav on pav.productid = mc.ConcentratorProductID and pav.attributeid = 75 
          
          left join productattributevalue pav2 on pav2.productid = mc.ConcentratorProductID and pav2.attributeid = {1} 
          left join productattributevalue pav3 on pav3.productid = mc.ConcentratorProductID and pav3.attributeid = {2} 
          left join productattributevalue pav4 on pav4.productid = mc.ConcentratorProductID and pav4.attributeid = {3} 
          left join productattributevalue pavBtF on pavBtF.productid = mc.ConcentratorProductID and pavBtF.attributeid in (select attributeid from productattributemetadata where attributecode = 'Btf')
          
          left join productattributevalue pavWehkamp on pavWehkamp.productid = mc.ConcentratorProductID and pavWehkamp.attributeid = {4}
          
          where mc.connectorid = {0} 
          order by VendorItemNumber
          "
                                                 , connectorID.Value, ReadyForWehkampAttributeID, SentToWehkampAttributeID, SentToWehkampAsDummyAttributeID, WehkampProductNumberAttributeID);

                var content = pp.Query <MissingContentViewModel>(baseQuery);

                if (filter.hasImage.HasValue && !filter.hasImage.Value)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + "and [Image] = 0");
                }

                if (filter.Media.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and YouTube = {0} and [Image] = {0}", filter.Media.Value ? 1 : 0));
                }

                if (filter.Images.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and [Image] = {0}", filter.Images.Value ? 1 : 0));
                }


                if (filter.Images.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and [Image] = {0}", filter.Images.Value ? 1 : 0));
                }

                if (filter.MediaAndSpecs.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and YouTube = {0} and [Image] = {0} and Specifications = {0}", filter.MediaAndSpecs.Value ? 1 : 0));
                }

                if (filter.Specs.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and Specifications = {0}", filter.Specs.Value ? 1 : 0));
                }

                if (filter.Video.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + string.Format(@"and YouTube = {0}", filter.Video.Value ? 1 : 0));
                }

                if (filter.VendorOverlay.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + @"and Contentvendor = 'Overlay'");
                }

                if (filter.VendorBase.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + @"and Contentvendor = 'Base'");
                }

                if (filter.PreferredContent.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + @"and ContentVendorID != null");
                }

                if (filter.UnpreferredContent.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + @"and ContentVendorID = null");
                }


                if (filter.ReadyForWehkamp.HasValue)
                {
                    if (filter.ReadyForWehkamp == false)
                    {
                        readyForWehKampAndSendToWehkampQuery += "and ((pav2.value != 'True' or pav2.value is null) or Image = 0) ";
                    }
                    else
                    {
                        readyForWehKampAndSendToWehkampQuery += "and pav2.value = 'True' ";
                    }
                }

                if (filter.SentToWehkamp.HasValue)
                {
                    if (filter.SentToWehkamp == false)
                    {
                        readyForWehKampAndSendToWehkampQuery += "and (pav3.value != 'True' or pav3.value is null)";
                    }
                    else
                    {
                        readyForWehKampAndSendToWehkampQuery += "and pav3.value = 'True'";
                    }
                }

                if (filter.SentToWehkampAsDummy.HasValue)
                {
                    if (filter.SentToWehkampAsDummy == false)
                    {
                        readyForWehKampAndSendToWehkampQuery += "and (pav4.value != 'True' or pav4.value is null)";
                    }
                    else
                    {
                        readyForWehKampAndSendToWehkampQuery += "and pav4.value = 'True'";
                    }
                }

                if (filter.BtF.HasValue)
                {
                    if (!filter.BtF.Value)
                    {
                        readyForWehKampAndSendToWehkampQuery += "and (pavBtF.value != 'True' or pavBtF.value is null)";
                    }
                    else
                    {
                        readyForWehKampAndSendToWehkampQuery += "and pavBtF.value = 'True'";
                    }
                }

                if (filter.SentToWehkamp.HasValue || filter.ReadyForWehkamp.HasValue || filter.BtF.HasValue)
                {
                    content = pp.Query <MissingContentViewModel>(baseQuery + readyForWehKampAndSendToWehkampQuery);
                }

                PagingParameters pagingParams = GetPagingParams();

                var q     = content.AsQueryable().Distinct().Where(x => hasLongContentDescription.HasValue ? !x.HasDescription : true);
                int total = 0;

                var result = GetPagedResultWithCount(q, out total);

                return(Json(new
                {
                    total,
                    results = result.ToList()
                }));
            }
        }
コード例 #7
0
        public ActionResult GetSizeGroups(ContentPortalFilter filter, bool?mb, bool?kb)
        {
            MergeSession(filter, ContentPortalFilter.SessionKey);

            var sizeFilter = GetNumericFilter();

            if (!sizeFilter.BiggerThan.HasValue && !sizeFilter.SmallerThan.HasValue && !sizeFilter.EqualTo.HasValue)
            {
                sizeFilter.BiggerThan = 600;
            }

            var isMb       = mb.HasValue && mb.Value;
            var unitOfData = isMb ? "megabytes" : "kilobytes";

            using (var unit = GetUnitOfWork())
            {
                var missingContentResult = ((IContentService)unit.Service <Content>()).GetMissing(filter.Connectors, filter.Vendors, filter.BeforeDate, filter.AfterDate, filter.OnDate, filter.IsActive, filter.ProductGroups, filter.Brands, filter.LowerStockCount, filter.GreaterStockCount, filter.EqualStockCount, filter.Statuses);

                var content = missingContentResult.Value;
                var sizes   = unit.Service <ProductMedia>().GetAll(c => content.Any(m => m.ConcentratorProductID == c.ProductID) && c.MediaType.Type == "Image").Select(c => c.Size);

                var validGroup        = 0;
                var invalidGroup      = 0;
                var noSize            = 0;
                var validGroupLabel   = string.Empty;
                var invalidGroupLabel = string.Empty;
                var validSize         = new ImageSize();
                var invalidSize       = new ImageSize();

                if (sizeFilter.BiggerThan.HasValue && sizeFilter.SmallerThan.HasValue)
                {
                    validSize.minImageSize   = sizeFilter.BiggerThan.Value;
                    validSize.maxImageSize   = sizeFilter.SmallerThan.Value;
                    invalidSize.minImageSize = sizeFilter.SmallerThan.Value + 1;
                    invalidSize.maxImageSize = int.MaxValue;
                }
                else if (sizeFilter.BiggerThan.HasValue)
                {
                    validSize.minImageSize   = sizeFilter.BiggerThan.Value;
                    validSize.maxImageSize   = int.MaxValue;
                    invalidSize.minImageSize = 0;
                    invalidSize.maxImageSize = sizeFilter.BiggerThan.Value - 1;
                }

                else if (sizeFilter.SmallerThan.HasValue)
                {
                    validSize.minImageSize   = 0;
                    validSize.maxImageSize   = sizeFilter.SmallerThan.Value;
                    invalidSize.minImageSize = sizeFilter.SmallerThan.Value + 1;
                    invalidSize.maxImageSize = int.MaxValue;
                }
                else if (sizeFilter.EqualTo.HasValue)
                {
                    validSize.minImageSize   = sizeFilter.EqualTo.Value;
                    validSize.maxImageSize   = sizeFilter.EqualTo.Value;
                    invalidSize.minImageSize = sizeFilter.EqualTo.Value + 1;
                    invalidSize.maxImageSize = int.MaxValue;
                }

                sizes.ForEach((size, id) =>
                {
                    if (!size.HasValue)
                    {
                        noSize++;
                    }
                    else
                    {
                        if (isMb)
                        {
                            size = size / 1024;
                        }

                        //range
                        if (sizeFilter.BiggerThan.HasValue && sizeFilter.SmallerThan.HasValue)
                        {
                            validGroupLabel   = string.Format("Smaller than {0} {1} and bigger than {2} {3}", sizeFilter.SmallerThan, unitOfData, sizeFilter.BiggerThan, unitOfData);
                            invalidGroupLabel = string.Format("Out of specified range");

                            if (size > sizeFilter.BiggerThan.Value && size < sizeFilter.SmallerThan)
                            {
                                validGroup++;
                            }
                            else
                            {
                                invalidGroup++;
                            }
                        }
                        else if (sizeFilter.BiggerThan.HasValue)
                        {
                            validGroupLabel   = string.Format("Bigger than {0} {1}", sizeFilter.BiggerThan, unitOfData);
                            invalidGroupLabel = string.Format("Smaller than {0} {1}", sizeFilter.BiggerThan, unitOfData);
                            if (size > sizeFilter.BiggerThan.Value)
                            {
                                validGroup++;
                            }
                            else
                            {
                                invalidGroup++;
                            }
                        }
                        else if (sizeFilter.SmallerThan.HasValue)
                        {
                            invalidGroupLabel = string.Format("Bigger than {0} {1}", sizeFilter.SmallerThan, unitOfData);
                            validGroupLabel   = string.Format("Smaller than {0} {1}", sizeFilter.SmallerThan, unitOfData);
                            if (size < sizeFilter.SmallerThan.Value)
                            {
                                validGroup++;
                            }
                            else
                            {
                                invalidGroup++;
                            }
                        }
                        else if (sizeFilter.EqualTo.HasValue)
                        {
                            validGroupLabel   = string.Format("Equal to {0} {1}", sizeFilter.EqualTo, unitOfData);
                            invalidGroupLabel = string.Format("Not Equal to {0} {1}", sizeFilter.EqualTo, unitOfData);
                            if (size == sizeFilter.EqualTo.Value)
                            {
                                validGroup++;
                            }
                            else
                            {
                                invalidGroup++;
                            }
                        }
                    }
                });

                var callbackUI = "content-item";

                var serie = new Serie(new List <Concentrator.ui.Management.Models.Anychart.Point>()
                {
                    new PieChartPoint(validGroupLabel, validGroup, action: new AnychartAction(callbackUI, new { minImageSize = validSize.minImageSize, maxImageSize = validSize.maxImageSize })),

                    new PieChartPoint(invalidGroupLabel, invalidGroup, action: new AnychartAction(callbackUI, new { minImageSize = invalidSize.minImageSize, maxImageSize = invalidSize.maxImageSize })),

                    new PieChartPoint("No size set", noSize, action: new AnychartAction(callbackUI, new { hasImage = false }))
                }, "Size", "Default");
                var model = new AnychartComponentModel(new List <Serie>()
                {
                    serie
                });

                return(View("Anychart/DefaultPieChart", model));
            }
        }
コード例 #8
0
        public ActionResult GetEdiOrdersInError(ContentPortalFilter filter)
        {
            using (var unit = GetUnitOfWork())
            {
                //var Received = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 0).Count();
                //var Validate = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 100).Count();
                //var ProcessOrder = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 200).Count();
                //var WaitForOrderResponse = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 300).Count();
                //var WaitForAcknowledgement = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 310).Count();
                //var ReceiveAcknowledgement = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 315).Count();
                //var WaitForShipmentNotification = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 320).Count();
                //var ReceiveShipmentNotification = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 325).Count();
                //var WaitForInvoiceNotification = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 330).Count();
                //var ReceivedInvoiceNotification = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 335).Count();
                //var OrderComplete = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 500).Count();
                //var Error = unit.Service<EdiOrder>().GetAll(x => x.ReceivedDate == DateTime.Today && x.Status == 999).Count();

                var Received                    = unit.Service <EdiOrder>().GetAll(x => x.Status == 0);
                var Validate                    = unit.Service <EdiOrder>().GetAll(x => x.Status == 100);
                var ProcessOrder                = unit.Service <EdiOrder>().GetAll(x => x.Status == 200);
                var WaitForOrderResponse        = unit.Service <EdiOrder>().GetAll(x => x.Status == 300);
                var WaitForAcknowledgement      = unit.Service <EdiOrder>().GetAll(x => x.Status == 310);
                var ReceiveAcknowledgement      = unit.Service <EdiOrder>().GetAll(x => x.Status == 315);
                var WaitForShipmentNotification = unit.Service <EdiOrder>().GetAll(x => x.Status == 320);
                var ReceiveShipmentNotification = unit.Service <EdiOrder>().GetAll(x => x.Status == 325);
                var WaitForInvoiceNotification  = unit.Service <EdiOrder>().GetAll(x => x.Status == 330);
                var ReceivedInvoiceNotification = unit.Service <EdiOrder>().GetAll(x => x.Status == 335);
                var OrderComplete               = unit.Service <EdiOrder>().GetAll(x => x.Status == 500);
                var Error = unit.Service <EdiOrder>().GetAll(x => x.Status == 999);

                if (filter.OnDate != null || filter.BeforeDate != null || filter.AfterDate != null)
                {
                    Received = Received.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                              filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                          filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    Validate = Validate.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                              filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                          filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    ProcessOrder = ProcessOrder.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                      filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                  filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    WaitForOrderResponse = WaitForOrderResponse.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                      filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                  filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    WaitForAcknowledgement = WaitForAcknowledgement.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                          filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                      filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    ReceiveAcknowledgement = ReceiveAcknowledgement.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                          filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                      filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    WaitForShipmentNotification = WaitForShipmentNotification.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                                    filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                                filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    ReceiveShipmentNotification = ReceiveShipmentNotification.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                                    filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                                filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    WaitForInvoiceNotification = WaitForInvoiceNotification.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                                  filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                              filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    ReceivedInvoiceNotification = ReceivedInvoiceNotification.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                                                    filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                                                filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    OrderComplete = OrderComplete.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                                        filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                                    filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);

                    Error = Error.Where(x => filter.OnDate != null ? x.ReceivedDate == filter.OnDate : true ||
                                        filter.BeforeDate != null ? x.ReceivedDate <filter.BeforeDate : true ||
                                                                                    filter.AfterDate != null?x.ReceivedDate> filter.AfterDate : true);
                }

                var callbackUI = "edi-order-item";

                var serie = new Serie(new List <Point>()
                {
                    new PieChartPoint("Received", Received.Count(), action: new AnychartAction(callbackUI, new { Status = 0 })),
                    new PieChartPoint("Validate", Validate.Count(), action: new AnychartAction(callbackUI, new { Status = 100 })),
                    new PieChartPoint("Process Order", ProcessOrder.Count(), action: new AnychartAction(callbackUI, new { Status = 200 })),
                    new PieChartPoint("Wait For Order Response", WaitForOrderResponse.Count(), action: new AnychartAction(callbackUI, new { Status = 300 })),
                    new PieChartPoint("Wait For Acknowledgement", WaitForAcknowledgement.Count(), action: new AnychartAction(callbackUI, new { Status = 310 })),
                    new PieChartPoint("Receive Acknowledgement", ReceiveAcknowledgement.Count(), action: new AnychartAction(callbackUI, new { Status = 315 })),
                    new PieChartPoint("Wait For Shipment Notification", WaitForShipmentNotification.Count(), action: new AnychartAction(callbackUI, new { Status = 320 })),
                    new PieChartPoint("Receive Shipment Notification", ReceiveShipmentNotification.Count(), action: new AnychartAction(callbackUI, new { Status = 325 })),
                    new PieChartPoint("Wait For Invoice Notification", WaitForInvoiceNotification.Count(), action: new AnychartAction(callbackUI, new { Status = 330 })),
                    new PieChartPoint("Received Invoice Notification", ReceivedInvoiceNotification.Count(), action: new AnychartAction(callbackUI, new { Status = 335 })),
                    new PieChartPoint("Order Complete", OrderComplete.Count(), action: new AnychartAction(callbackUI, new { Status = 500 })),
                    new PieChartPoint("Error", Error.Count(), action: new AnychartAction(callbackUI, new { Error = true })),
                }, "Statistics", "Default");

                var model = new AnychartComponentModel(new List <Serie>()
                {
                    serie
                });

                return(View("Anychart/DefaultAccumulationChart", model));
            }
        }
コード例 #9
0
        public ActionResult GetMappedBrandVendors(ContentPortalFilter filter)
        {
            using (var unit = GetUnitOfWork())
            {
                var filteredBrandVendors = (unit.Service <BrandVendor>().GetAll(v => v.BrandID > 0));

                var unmappedBrandVendors = (from v in unit.Service <BrandVendor>().GetAll(v => v.BrandID < 0)
                                            select v.BrandID).Count();

                var mappedBrandVendors = (from v in unit.Service <BrandVendor>().GetAll(v => v.BrandID > 0)
                                          select v.BrandID).Count();

                if (filter.Connectors != null && filter.Connectors.Count() > 0)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => x.Vendor.ContentProducts.Any(v => filter.Connectors.Contains(v.ConnectorID)));
                    mappedBrandVendors   = filteredBrandVendors.Count();
                }
                if (filter.Vendors != null && filter.Vendors.Count() > 0)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => x.Vendor.ContentProducts.Any(v => filter.Connectors.Contains(v.ConnectorID)));
                }
                //if (filter.AfterDate != null)
                //{
                //  filteredBrandVendors = filteredBrandVendors.Where(x => x.
                //}
                if (filter.IsActive != null && filter.IsActive == true)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => x.Vendor.VendorAssortments.Any(v => v.IsActive == true));
                }
                if (filter.IsActive != null && filter.IsActive == false)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => x.Vendor.VendorAssortments.Any(v => v.IsActive == false));
                }
                if (filter.ProductGroups != null && filter.ProductGroups.Count() > 0)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => x.Vendor.ProductGroupVendors.Any(v => filter.ProductGroups.Contains(v.ProductGroupID)));
                }
                if (filter.Brands != null && filter.Brands.Count() > 0)
                {
                    filteredBrandVendors = filteredBrandVendors.Where(x => filter.Brands.Contains(x.BrandID));
                }
                if (filter.EqualStockCount != null)
                {
                }

                var callbackUI = "vendor-brands-item";

                var serie = new Serie(new List <Concentrator.ui.Management.Models.Anychart.Point>()
                {
                    new PieChartPoint("Unmapped Brand Vendors", unmappedBrandVendors, action: new AnychartAction(callbackUI, new { UnmappedBrandVendor = true })),
                    new PieChartPoint("Mapped Brand Vendors", mappedBrandVendors, action: new AnychartAction(callbackUI, new { MappedBrandVendor = true }))
                }, "Statistics", "Default");

                var model = new AnychartComponentModel(new List <Serie>()
                {
                    serie
                });

                return(View("Anychart/DefaultAccumulationChart", model));
            }
        }