示例#1
0
        protected void ddlIngredientType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string s = ddlIngredientType.SelectedValue.ToString();

            SqlConnection btekconnect = new SqlConnection(ConfigurationManager.ConnectionStrings["BoozeTEKconnection"].ConnectionString);
            SqlCommand    btek        = new SqlCommand("Ingredients_GetByType", btekconnect);

            btek.CommandType = CommandType.StoredProcedure;
            SqlParameter Ingredient_Type = new SqlParameter("@Ingredient_Type", SqlDbType.VarChar);

            Ingredient_Type.Value = s;
            btek.Parameters.Add(Ingredient_Type);
            btekconnect.Open();
            btek.ExecuteNonQuery();

            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = btek;
            DataSet ds = new DataSet();

            da.Fill(ds, "Ingredient_Type");

            IngredientName.DataTextField  = "Ingredient_Name";
            IngredientName.DataValueField = "Ingredient_Name";
            IngredientName.DataSource     = ds;
            IngredientName.DataBind();
        }
示例#2
0
        public Dictionary <string, int> AddNewIngredients(Dictionary <string, int> newIngredient)
        {
            CollectionIngredients    collectionIngredients = new CollectionIngredients();
            JsonIngredientRepository ingredientRepository  = new JsonIngredientRepository();
            Ingredients ingredients = new Ingredients();

            collectionIngredients = ingredientRepository.Read(path);


            //GetLastIdIngredients()
            Id  id    = new Id();
            int bufId = id.id + 1;

            int  dictionaryId = 0, dictionaryValue = 0;
            var  dishIngredients = new Dictionary <string, int>();
            bool flag;

            foreach (var IngredientName in newIngredient.Keys)
            {
                // сравнение
                //не нашел, как сделать производительние(
                flag = true;
                for (int i = 0; i < collectionIngredients.ListIngredients.Count; i++)
                {
                    if (collectionIngredients.ListIngredients[i].Name.ToString() == IngredientName.ToString())
                    {
                        dictionaryId    = collectionIngredients.ListIngredients[i].Id;
                        dictionaryValue = newIngredient[IngredientName];

                        dishIngredients.Add(dictionaryId.ToString(), dictionaryValue);

                        flag = false;
                    }
                }
                if (flag == false)
                {
                    continue;
                }
                else
                {
                    ingredients.Name = IngredientName;
                    ingredients.Id   = bufId;
                    collectionIngredients.ListIngredients.Add(ingredients);

                    dictionaryId    = bufId;
                    dictionaryValue = newIngredient[IngredientName];

                    dishIngredients.Add(dictionaryId.ToString(), dictionaryValue);

                    bufId++;
                }
            }
            ingredientRepository.Update(path, collectionIngredients);

            return(dishIngredients);
        }
示例#3
0
        public Genorator()
        {
            IngredientsFound = new Dictionary <IngredientName, Ingredient>();

            for (int i = 0; i < Enum.GetValues(typeof(IngredientName)).Length; i++)
            {
                IngredientName t = (IngredientName)i;
                IngredientsFound.Add(t, new Ingredient()
                {
                    Name = t.ToString()
                });
            }
        }
        /// <summary>
        /// Validates this PBSExtemporaneousIngredient
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages to date, these may be added to within this method</param>
        public void Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (vb.ArgumentRequiredCheck("IngredientName", IngredientName))
            {
                IngredientName.Validate(vb.Path + "IngredientName", vb.Messages);
            }

            if (vb.ArgumentRequiredCheck("IngredientQuantity", IngredientQuantity))
            {
                IngredientQuantity.Validate(vb.Path + "IngredientQuantity", vb.Messages);
            }
        }
示例#5
0
    private void Start()
    {
        if (!instances.Contains(this))
        {
            instances.Add(this);
        }
        x = transform.GetSiblingIndex();
        ingredientName = CookManager.instance.IngredientGroups[type][x];

        SetName();

        CookManager.instance.languageChange += SetName;

        GetComponent <Button>().onClick.AddListener(() => SelectIngredient());
    }
示例#6
0
 public GameObject SelectIngredientPrefab(IngredientName ingredient)
 {
     foreach (GameObject prefab in ingredientPrefabs)
     {
         Ingredient ingredientScript = prefab.GetComponent <Ingredient>();
         if (ingredientScript == null)
         {
             ingredientScript = prefab.GetComponentInChildren <Ingredient>();
         }
         if (ingredientScript.ingredientName == ingredient)
         {
             return(prefab);
         }
     }
     Debug.Log("Prefab not found");
     return(null);
 }
示例#7
0
 private void completePotion(IngredientName i)
 {
     switch(i) {
     case IngredientName.Root:
         itemName = "Root";
         itemDescription = "";
         weight = 1;
         value = 1;
         ingredientEffect = IngredientEffect.GainHealth;
         ingredientQuality1 = IngredientQuality.Health;
         potency1 = 1;
         ingredientQuality2 = IngredientQuality.Health;
         potency2 = 2;
         ingredientQuality3 = IngredientQuality.Health;
         potency3 = 3;
         break;
     case IngredientName.Carrot:
         itemName = "Carrot";
         itemDescription = "";
         weight = 1;
         value = 1;
         ingredientEffect = IngredientEffect.GainHealth;
         ingredientQuality1 = IngredientQuality.Health;
         potency1 = 1;
         ingredientQuality2 = IngredientQuality.Health;
         potency2 = 2;
         ingredientQuality3 = IngredientQuality.Health;
         potency3 = 3;
         break;
     case IngredientName.Potato:
         itemName = "Potato";
         itemDescription = "";
         weight = 1;
         value = 1;
         ingredientEffect = IngredientEffect.GainHealth;
         ingredientQuality1 = IngredientQuality.Health;
         potency1 = 1;
         ingredientQuality2 = IngredientQuality.Health;
         potency2 = 2;
         ingredientQuality3 = IngredientQuality.Health;
         potency3 = 3;
         break;
     default:
         break;
     }
 }
示例#8
0
 public string[] returnRowDataGrid()
 {
     string[] rowdata = new string[5];
     rowdata[0] = RecipeIngredientsID.ToString();
     rowdata[1] = IngredientName.ToString();
     rowdata[2] = Quantity.ToString();
     rowdata[3] = UnitName.ToString();
     try
     {
         if (string.IsNullOrEmpty(Comments))
         {
             rowdata[4] = "";
         }
         else
         {
             rowdata[4] = Comments.ToString();
         }
     }
     catch
     {
         rowdata[4] = "";
     }
     return(rowdata);
 }
示例#9
0
        private async void CreateNewIngredient()
        {
            if (IngredientName != null)
            {
                var numberOfEqualIngredients = Ingredients.Select(x => x).Where(t => t.Name.ToUpper().Equals(IngredientName.ToUpper())).ToArray().Count();
                if (numberOfEqualIngredients > 0)
                {
                    await m_popupDialog.Dialog.ShowMessageAsync(this, $"Kan ikke legge til {IngredientName}", $"{IngredientName} kan ikke legges til fordi det eksisterer allerede en ingrediens med samme navn");

                    return;
                }

                Ingredients.Add(await m_foodFacade.AddIngredient(new Ingredient {
                    Name = IngredientName, Description = IngredientDescription
                }));
                IngredientName        = "";
                IngredientDescription = "";
                OnPropertyChanged(string.Empty);
                await RefreshIngredient();
            }
        }
示例#10
0
 public void setIngredient(IngredientName name)
 {
     ingredient = name;
 }
示例#11
0
 public void AddToInventory(IngredientName ingredient)
 {
     inventory.Add(ingredient);
 }
示例#12
0
 public Ingredient(IngredientName ingredientName)
 {
     this.ingredientName = ingredientName;
     baseItemType = BaseItemType.Potion;
     completePotion(ingredientName);
 }