示例#1
0
        /// <summary>
        /// Возвращает вес брутто/нетто 10-го ингредиента определенного блюда
        /// </summary>
        public class_ingr_food[] ves_list9()
        {
            class_ingr_food[] ves_list9 = new class_ingr_food[512];

            string query = "select *  from Ingridients_in_food where Id_ingridients='";

            for (int k = 1; k < this._ingr_list10.Count(); k++)

                if (this._ingr_list10[k] != null)
                {

                    string guer = this._ingr_list10[k].ingr_id;

                    string query1 = guer + "'";

                    string query3 = "and ID_food='";

                    for (int t = 1; t < this._food_list1.Count(); t++)

                        if (this._food_list1[t] != null)
                        {

                            string guer1 = this._food_list1[t].food_id;

                            string query4 = guer1 + "'";

                            string query2 = query + query1 + query3 + query4;

                            try
                            {
                                SqlCommand com = Program.data_module._conn.CreateCommand();
                                com.CommandText = query2;
                                SqlDataReader rd = com.ExecuteReader();

                                int i = 0;
                                while (rd.Read())
                                {
                                    i = i + 1;
                                    ves_list9[i] = new class_ingr_food();
                                    ves_list9[i].result = "OK";

                                    ves_list9[i].net = rd.GetDouble(2).ToString();
                                    ves_list9[i].bruto = rd.GetDouble(1).ToString();
                                    // customers_list1[i].name = rd.GetString(0).ToString();
                                    // customers_list1[i].ingr_id = rd.GetInt32(1).ToString();

                                }

                                rd.Close();
                                rd.Dispose();
                                com.Dispose();
                            }

                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message + " " + ex.Data);
                                return null;
                            }
                        }
                }

            return ves_list9;
        }
示例#2
0
        /// <summary>
        /// Возвращает вес брутто/нетто первого ингредиента определенного блюда
        /// </summary>
        public class_ingr_food[] ves_list()
        {
            class_ingr_food[] ves_list = new class_ingr_food[512];
            string query = "select *  from Ingridients_in_food where Id_ingridients='";

                if (_ingr_list1 == null)
            {
                _ingr_list1 = null;

            }
            else
            {
                if (this._ingr_list[1] != null)
                {

                    string guer = this._ingr_list[1].ingr_id;

                    string query1 = guer + "'";

                    string query3 = "and ID_food='";

                    for (int t = 1; t < this._food_list1.Count(); t++)

                        if (this._food_list1[t] != null)
                        {
                            string guer2 = this._food_list1[t].food_id;

                            string query4 = guer2 + "'";

                            string query2 = query + query1 + query3 + query4;

                            try
                            {
                                SqlCommand com = Program.data_module._conn.CreateCommand();
                                com.CommandText = query2;
                                SqlDataReader rd = com.ExecuteReader();

                                int i = 0;
                                while (rd.Read())
                                {
                                    i = i + 1;
                                    ves_list[i] = new class_ingr_food();
                                    ves_list[i].result = "OK";

                                    if (rd.IsDBNull(2))
                                    {
                                        ves_list[i].net = "0";
                                    }
                                    else
                                    {
                                        ves_list[i].net = rd.GetDouble(2).ToString();
                                    }

                                    if (rd.IsDBNull(1))
                                    {
                                        ves_list[i].bruto = "0";
                                    }
                                    else
                                    {
                                        ves_list[i].bruto = rd.GetDouble(1).ToString();
                                    }

                                }
                                rd.Close();
                                rd.Dispose();
                                com.Dispose();
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message + " " + ex.Data);
                                return null;
                            }
                        }
                }
            }

            return ves_list;
        }