Esempio n. 1
0
        public static void ClearAll()
        {
            var db = new SalonContext();

            db.specialty.RemoveRange(db.specialty);
            db.SaveChanges();
        }
Esempio n. 2
0
        public void CutHair(int id)
        {
            var     db         = new SalonContext();
            Client  theClient  = db.client.Find(id);
            Stylist theStylist = db.stylist.Find(this.id);

            theClient.GrowHair();
            int damage = this.GetDamage();

            if (theClient.hair < damage)
            {
                //Client Dies
                theStylist.hair += theClient.hair;
                theClient.hair   = 0;
            }
            else
            {
                //Client Lives
                theStylist.hair += damage;
                theClient.hair  -= damage;
            }
            if (hair > this.GetNextLevel())
            {
                theStylist.hair = 0;
                theStylist.level++;
            }
            db.SaveChanges();
        }
Esempio n. 3
0
        public List <Stylist> GetRemainingStylists()
        {
            List <int> found        = new List <int> {
            };
            var            db       = new SalonContext();
            List <Stylist> allItems = new List <Stylist>();
            List <Join>    joiner   = db.join.ToList();

            foreach (var item in joiner)
            {
                if (item.specialty_id == id && item.stylist_id > 0)
                {
                    found.Add(item.stylist_id);
                }
            }

            foreach (Stylist spec in Stylist.GetAll())
            {
                if (found.Contains(spec.id) == false)
                {
                    allItems.Add(spec);
                }
            }
            return(allItems);
        }
Esempio n. 4
0
        public List <Client> GetClients()
        {
            var           db       = new SalonContext();
            List <Client> allItems = db.client.Where(c => c.stylist == id).ToList();

            return(allItems);
        }
Esempio n. 5
0
        public static void ClearAll()
        {
            var db = new SalonContext();

            db.stylist.RemoveRange(db.stylist);
            db.SaveChanges();
        }
Esempio n. 6
0
        public void GetDrop()
        {
            var      db       = new SalonContext();
            Random   rnd      = new Random();
            int      rolls    = this.GetLuck();
            Scissors scissors = new Scissors {
                prefix_1 = 0, prefix_2 = 0, suffix_1 = 0, suffix_2 = 0
            };

            for (int i = 0; i < rolls; i++)
            {
                int drop = (rnd.Next(0, 10000)) % (16);
                if (scissors.prefix_1 == 0 && drop % 2 == 0)
                {
                    var themod = db.prefix.Find(drop);
                    if (themod != null)
                    {
                        scissors.prefix_1       = themod.id;
                        scissors.prefix_1_value = rnd.Next(themod.min_value, themod.max_value);
                    }
                }
                else if (scissors.prefix_2 == 0 && drop % 2 == 0)
                {
                    var themod = db.prefix.Find(drop);
                    if (themod != null && drop != scissors.prefix_1)
                    {
                        scissors.prefix_2       = themod.id;
                        scissors.prefix_2_value = rnd.Next(themod.min_value, themod.max_value);
                    }
                }
                else if (scissors.suffix_1 == 0 && drop % 2 == 1)
                {
                    var themod = db.suffix.Find(drop);
                    if (themod != null)
                    {
                        scissors.suffix_1       = themod.id;
                        scissors.suffix_1_value = rnd.Next(themod.min_value, themod.max_value);
                    }
                }
                else if (scissors.prefix_2 == 0 && drop % 2 == 1)
                {
                    var themod = db.suffix.Find(drop);
                    if (themod != null && drop != scissors.suffix_1)
                    {
                        scissors.suffix_2       = themod.id;
                        scissors.suffix_2_value = rnd.Next(themod.min_value, themod.max_value);
                    }
                }
                scissors.name = scissors.GetScissorsName();
            }
            db.scissors.Add(scissors);
            db.SaveChanges();
            this.drop = scissors.id;
            db.SaveChanges();
        }
Esempio n. 7
0
        public List <Stylist> GetStylists()
        {
            var            db       = new SalonContext();
            List <Stylist> allItems = new List <Stylist> {
            };
            List <Join> joiner      = db.join.ToList();

            foreach (var item in joiner)
            {
                if (item.specialty_id == id && item.stylist_id > 0)
                {
                    allItems.Add(db.stylist.Find(item.stylist_id));
                }
            }
            return(allItems);
        }
Esempio n. 8
0
        public int GetLuck()
        {
            var      db       = new SalonContext();
            Random   rnd      = new Random();
            int      luck     = rnd.Next(2, 6);
            Scissors scissors = db.scissors.Find(this.scissors);

            if (scissors.suffix_1 > 7 && scissors.suffix_1 < 11)
            {
                luck += scissors.suffix_1_value;
            }
            if (scissors.suffix_2 > 7 && scissors.suffix_2 < 11)
            {
                luck += scissors.suffix_1_value;
            }

            return(luck);
        }
Esempio n. 9
0
        public int GetDamage()
        {
            var      db       = new SalonContext();
            Scissors scissors = db.scissors.Find(this.scissors);
            float    damage   = level;

            if (scissors.suffix_1 > 0 && scissors.suffix_1 < 7)
            {
                if (scissors.suffix_1 % 2 == 1)
                {
                    damage -= scissors.suffix_1_value;
                }
                else
                {
                    damage += scissors.suffix_1_value;
                }
            }
            if (scissors.suffix_2 > 7 && scissors.suffix_2 < 11)
            {
                if (scissors.suffix_2 % 2 == 1)
                {
                    damage -= scissors.suffix_1_value;
                }
                else
                {
                    damage += scissors.suffix_1_value;
                }
            }
            if (scissors.prefix_1_value > 0)
            {
                damage += scissors.prefix_1_value;
            }

            if (scissors.prefix_2_value > 0)
            {
                damage += scissors.prefix_2_value;
            }
            if (damage < 1)
            {
                damage = 1;
            }
            return((int)damage);
        }
Esempio n. 10
0
        public string GetScissorsName()
        {
            string theScis = "";
            var    db      = new SalonContext();

            if (prefix_1 > 0)
            {
                theScis += db.prefix.Find(prefix_1).name;
            }
            if (prefix_2 > 0)
            {
                theScis += ", " + db.prefix.Find(prefix_2).name;
            }
            theScis += " Scissors";
            if (suffix_1 > 0)
            {
                theScis += " Of " + db.suffix.Find(suffix_1).name;
            }
            if (suffix_2 > 0)
            {
                theScis += " and " + db.suffix.Find(suffix_2).name;
            }
            return(theScis);
        }