Esempio n. 1
0
        /// <summary>
        /// Zwraca fajerwerk polecany klientowi.
        /// </summary>
        /// <returns>fajerwerk polecany klientowi</returns>
        public Firework GetRecommended()
        {
            // jeœli promowany jest konkretny fajerwerk, nale¿y do zwróciæ
            try
            {
                String        s            = FileFinder.GetFileName("config", "strategy.xml");
                StreamReader  r            = new StreamReader(s);
                XmlSerializer xs           = new XmlSerializer(typeof(String));
                String        promotedName = (String)xs.Deserialize(r);
                r.Close();

                Firework f = Firework.Lookup(promotedName);
                if (f != null)
                {
                    return(f);
                }
            }
            catch {}

            // jeœli klient jest zarejestrowany, trzeba go porównaæ z innymi
            if (IsRegistered())
            {
                return((Firework)Rel8.Advise(this));
            }
            // sprawdzenie wydatków z ubieg³ego roku
            if (SpendingSince(DateTime.Now.AddYears(-1)) > 1000)
            {
                return((Firework)LikeMyStuff.Suggest(this));
            }
            // trudno - bêdzie losowy
            return(Firework.GetRandom());
        }
Esempio n. 2
0
        /// <summary>
        /// Return a firework to recommend to this customer.
        /// </summary>
        /// <returns>a firework to recommend to this customer</returns>
        public Firework GetRecommended()
        {
            // if we're promoting a particular firework, return it
            try
            {
                String        s            = FileFinder.GetFileName("config", "strategy.xml");
                StreamReader  r            = new StreamReader(s);
                XmlSerializer xs           = new XmlSerializer(typeof(String));
                String        promotedName = (String)xs.Deserialize(r);
                r.Close();

                Firework f = Firework.Lookup(promotedName);
                if (f != null)
                {
                    return(f);
                }
            }
            catch {}

            // if registered, compare to other customers
            if (IsRegistered())
            {
                return((Firework)Rel8.Advise(this));
            }
            // check spending over the last year
            if (SpendingSince(DateTime.Now.AddYears(-1)) > 1000)
            {
                return((Firework)LikeMyStuff.Suggest(this));
            }
            // oh well!
            return(Firework.GetRandom());
        }
Esempio n. 3
0
 /// <summary>
 /// Polecenie klientowi odpowiedniego produktu, wybranego na podstawie
 /// modelu ostatnich wydatków klienta w Oozinoz.
 /// </summary>
 /// <param name="c">profilowany klient</param>
 /// <returns>odpowiedni produkt dla tego klienta</returns>
 public Firework Recommend(Customer c)
 {
     return((Firework)LikeMyStuff.Suggest(c));
 }