Esempio n. 1
0
        public long GetPricebyDrinkID(int id)
        {
            DataTable data = DataProvider.Instance.ExecuteQuery(string.Format("SELECT * FROM Drink where ID = {0}", id));

            DataRow dr = data.Rows[0];

            DTO.Drink item = new DTO.Drink(dr);

            return(item.Price);
        }
Esempio n. 2
0
        public DTO.Drink GetDrinkDetails()
        {
            var rawDrink = JObject.Parse(this.Response);

            DTO.Drink drink = new DTO.Drink();
            drink.DrinkId     = rawDrink["id"].ToString();
            drink.Name        = rawDrink["name"].ToString();
            drink.Description = rawDrink["description"].ToString();
            drink.Recipe      = rawDrink["recipe"].ToString();

            return(drink);
        }
Esempio n. 3
0
        public Drink GetDrinkByName(string name)
        {
            Drink     drink = null;
            string    query = "SELECT * FROM Drink WHERE nameDrink = N'" + name + "'";
            DataTable data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow row in data.Rows)
            {
                drink = new DTO.Drink(row);
                break;
            }
            return(drink);
        }
Esempio n. 4
0
        DTO.Drink IDrinkService.GetDrink(string drinkId)
        {
            if (drinkId == "")
            {
                return(new DTO.Drink());
            }

            DTO.Drink drink = this.Drinks.FirstOrDefault(x => x.DrinkId == drinkId);

            if (drink.Description == string.Empty)
            {
                this._RequestDrinkDetails(drinkId);
            }
            return(drink);
        }
Esempio n. 5
0
        public List <DTO.Drink> GetDrinks()
        {
            List <DTO.Drink> drinkList = new List <DTO.Drink>();


            var rawDrinks = JObject.Parse(this.Response);

            foreach (var drink in rawDrinks["drinks"])
            {
                DTO.Drink d = new DTO.Drink();
                d.DrinkId = drink["id"].ToString();
                d.Name    = drink["name"].ToString();
                drinkList.Add(d);
            }
            return(drinkList);
        }
Esempio n. 6
0
        void drinkDetails_OnRequestCompleted(object sender, RequestNS.RequestCompletedEventArgs e)
        {
            RequestNS.RequestDrinkDetails request = e.Request as RequestNS.RequestDrinkDetails;

            if (request.SuccessfulExecuted != true)
            {
                return;
            }

            DTO.Drink drink = this._Drinks.First(x => x.DrinkId == request.DrinkId);
            DTO.Drink other = request.GetDrinkDetails();
            drink.Description = other.Description;
            drink.Recipe      = other.Recipe;

            this._NotifyDrinkChanged();
        }