Пример #1
0
 public override void SetDictionary(IDictionary <string, object> target)
 {
     target["q"]           = _query;
     target["geocode"]     = GeoCode;
     target["lang"]        = Lang;
     target["locale"]      = Locale;
     target["result_type"] = ResultType.ToString().ToLower();
     target["count"]       = Count;
     target["until"]       = UntilDate?.ToString("yyyy-MM-dd");
     target["since_id"]    = SinceId;
     target["max_id"]      = MaxId;
 }
Пример #2
0
        //Method Zoeken
        private void ZoekOpdracht()
        {
            //Lijst Ophalen
            string      Resultaat = "";
            List <Sale> lijst     = Resultaten;

            if (FromDate != null)
            {
                lijst      = lijst.FindAll(s => s.Timestamp >= FromDate);
                Resultaat += "Vanaf " + FromDate.ToString() + " ";
            }
            if (UntilDate != null)
            {
                lijst      = lijst.FindAll(s => s.Timestamp <= UntilDate);
                Resultaat += "Tot " + UntilDate.ToString() + " ";
            }
            if (SelectedKassa != null)
            {
                lijst      = lijst.FindAll(s => s.RegisterID.RegisterID == SelectedKassa.RegisterID);
                Resultaat += "Voor kassa " + SelectedKassa.RegisterName + " ";
            }
            if (SelectedProduct != null)
            {
                lijst      = lijst.FindAll(s => s.ProductID.ID == selectedproduct.ID);
                Resultaat += "Voor product " + SelectedProduct.ProductName + " ";
            }
            EindResultaat = lijst;
            if (EindResultaat.Count() >= 1)
            {
                int    amount = 0;
                double total  = 0;
                foreach (Sale sal in EindResultaat)
                {
                    amount += sal.Amount;
                    total  += sal.Totalprice;
                }
                if (FromDate == null && UntilDate == null && SelectedKassa == null && SelectedProduct == null)
                {
                    Resultaat += "Er zijn " + amount.ToString() + " aantallen verkocht voor een totaalprijs van " + total.ToString() + ".";
                }
                else
                {
                    Resultaat += "zijn er " + amount.ToString() + " aantallen verkocht voor een totaalprijs van " + total.ToString() + ".";
                }
            }
            else
            {
                Resultaat = "Er zijn geen zoekresultaten gevonden";
            }
            PerProduct = Resultaat;
        }
        private void UpdateSales()
        {
            //alle sales ophalen die tussen de geselecteerde van en tot datum ligt
            //met group by unieke productnamen selecteren
            //per productnaam een nieuwe sale aanmaken die je selecteert: deze bevat 2 namen
            //- de som van alle verkopen ophalen die bij een bepaalde productnaam horen
            //- die bepaalde productnaam ophalen
            //bij deze code hulp gehad van klasgenoot

            SalesPerProduct = new ObservableCollection <Sale>(Sales
                                                              .Where(s => s.Timestamp >= FromDate.ToUnixTimestamp() && s.Timestamp <= UntilDate.ToUnixTimestamp())
                                                              .GroupBy(p => p.Product.ProductName)
                                                              .Select(Group => new Sale {
                TotalPrice = Group.Sum(total => total.TotalPrice),
                Product    = new Product()
                {
                    ProductName = Group.Key
                }
            }));

            SalesPerRegister = new ObservableCollection <Sale>(Sales
                                                               .Where(s => s.Timestamp >= FromDate.ToUnixTimestamp() && s.Timestamp <= UntilDate.ToUnixTimestamp())
                                                               .GroupBy(p => p.Register.RegisterName)
                                                               .Select(Group => new Sale {
                TotalPrice = Group.Sum(total => total.TotalPrice),
                Register   = new Register()
                {
                    RegisterName = Group.Key
                }
            }));
        }
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     UntilDate.ToStream(output);
 }