コード例 #1
0
 private void LoadReport()
 {
     StackedStoreList.Clear();
     StoreZipList.Clear();
     foreach (var store in StoresWithCheckList.Where(s => s.Check))
     {
         var stackedStore = new StackedStoreInfo();
         stackedStore.Store          = store.Store;
         stackedStore.EquipmentSum   = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)) && se.ZipName != "Ремонт").Sum(se => se.ZipQuantity == 0 ? se.ZipPrice : se.ZipPrice * se.ZipQuantity.Value);
         stackedStore.RepairSum      = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)) && se.ZipName == "Ремонт").Sum(se => se.ZipPrice);
         stackedStore.ServiceZipList = ServiceZipList.Where(se => se.StoreNumber == store.Store.StoreNumber && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) >= new DateTime(StartDate.Year, StartDate.Month, 1)) && (new DateTime(se.ServiceYear.Value, ReturnNumberMonth(se.ServiceMonth), 1) < new DateTime(EndDate.Year, EndDate.Month, 1)));
         StackedStoreList.Add(stackedStore);
     }
 }
コード例 #2
0
        private void LoadSelectedStorezip()
        {
            StoreZipList.Clear();
            var query = from s in SelectedStackedStore.ServiceZipList
                        group s by s.ZipSet.MainZipName into zip
                        select new StoreZip {
                ZipName = zip.Key, Summ = zip.Sum(z => z.ZipQuantity == 0 ? z.ZipPrice : z.ZipPrice * z.ZipQuantity.Value), ZipList = new ObservableCollection <ZipPrice> (zip.Select(z => new ZipPrice {
                    Price = z.ZipPrice, Quantity = z.ZipQuantity.Value, Zip = z.ZipName
                }).ToList())
            };

            foreach (var item in query)
            {
                StoreZipList.Add(item);
            }
        }
コード例 #3
0
 private void LoadAllSelectedStorezip()
 {
     StoreZipList.Clear();
     foreach (var store in StackedStoreList)
     {
         var query = from s in store.ServiceZipList
                     group s by s.ZipSet.MainZipName into zip
                     select new StoreZip {
             ZipName = zip.Key, Summ = zip.Sum(z => z.ZipQuantity == 0 ? z.ZipPrice : z.ZipPrice * z.ZipQuantity.Value), ZipList = new ObservableCollection <ZipPrice>(zip.Select(z => new ZipPrice {
                 Price = z.ZipPrice, Quantity = z.ZipQuantity.Value, Zip = z.ZipName
             }).ToList())
         };
         foreach (var item in query)
         {
             if (StoreZipList.Count == 0)
             {
                 StoreZipList.Add(item);
                 continue;
             }
             int temp = 0;
             foreach (var stZip in StoreZipList)
             {
                 if (stZip.ZipName == item.ZipName)
                 {
                     temp        = 1;
                     stZip.Summ += item.Summ;
                     stZip.ZipList.AddRange(item.ZipList);
                 }
             }
             if (temp == 0)
             {
                 StoreZipList.Add(item);
             }
         }
     }
 }