コード例 #1
0
ファイル: MounterControl.cs プロジェクト: sohaeac/bev-lo
        private void btn_set_mounters_Click(object sender, EventArgs e)
        {
            char a = Form1.Instance.index_Haut.Connection_User.Text[14];

            this.pnl_week_orders_forMounter.Controls.Clear();
            Orders = new Dictionary <Model_Bike, Client>();
            MySqlDataReader reader = null;
            String          sql    = "SELECT * from bikes, command,customer where bikes.N_command = command.id_command and customer.id = command.id_customer order by bikes.production_order";

            MySqlConnection connectionDB = Connection.connection();

            connectionDB.Open();

            try
            {
                MySqlCommand comando = new MySqlCommand(sql, connectionDB);
                reader = comando.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Model_Bike bike = new Model_Bike(reader.GetString("colour"), reader.GetString("type_bike"), reader.GetString("size"), 1, 1);
                        bike.set_id(reader.GetInt16("id_bike"));
                        bike.set_order(reader.GetInt16("production_order"));
                        bike.set_status(reader.GetString("Status"));
                        bike.set_mounter(reader.GetInt16("Id_mounter").ToString());
                        Orders.Add(bike, new Client(reader.GetString("firstname"), reader.GetString("lastname"), reader.GetString("email"), reader.GetString("adress"), int.Parse(reader.GetString("postalcode")), reader.GetString("city"), reader.GetString("business_name")));
                    }
                }
                else
                {
                    MessageBox.Show("NoOrderWasfound");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Searching error" + ex.Message);
            }
            finally
            {
                connectionDB.Close();
            }
            foreach (KeyValuePair <Model_Bike, Client> elt in Orders)
            {
                MounterOrder order = new MounterOrder(elt.Key.id_bike.ToString(), elt.Key.type, elt.Key.colour, elt.Key.size, elt.Value.last_name, elt.Value.business_name, elt.Key.order.ToString(), elt.Key.status);
                if (Form1.Instance.index_Haut.Connection_User.Text[14] == elt.Key.mounter[0])
                {
                    order.Status_bike.Enabled = true;
                }
                else if (order.Status_bike.Text != "Waiting")
                {
                    order.Status_bike.Enabled = false;
                }
                Form1.Instance.MounteurControl.pnl_week_orders_forMounter.Controls.Add(order);
            }
        }
コード例 #2
0
 private void Add_to_Cart_Click(object sender, EventArgs e)
 {
     if (BoxSize.Text != "" & boxColor.Text != "")
     {
         Model_Bike model_bike = new Model_Bike(boxColor.Text, label_model.Text, BoxSize.Text, Double.Parse(price_lbl.Text), int.Parse(quantity_input.Text));
         //Command.Add(model_bike);
         Form1.Instance.Cart.list_models.Add(model_bike);
         Form1.Instance.cart.FLPanel_Cart.Controls.Add(new Panier_composantes("ok", model_bike.type, model_bike.colour, model_bike.size, model_bike.quantity.ToString(), model_bike.price.ToString()));
     }
 }
コード例 #3
0
        private void btn_get_orders_Click(object sender, EventArgs e)
        {
            Form1.Instance.production_Planning.title_production_planning.Text     = "This week orders are";
            Form1.Instance.production_Planning.title_production_planning.Location = new Point(287, 57);
            Form1.Instance.production_Planning.btn_get_orders.Visible             = false;
            Form1.Instance.production_Planning.pnl_week_orders.Visible            = true;

            Dictionary <Model_Bike, Client> Orders = new Dictionary <Model_Bike, Client>();

            String          sql    = "SELECT * from bikes, command,customer where bikes.id_command = command.id_command and customer.id_customer = command.id_customer ";
            MySqlDataReader reader = null;

            /* MySqlDataReader reader = null;
             * reader    = Connection.SearchReader(sql);
             * Console.WriteLine(2);
             * if (reader.HasRows)
             * {
             *   while (reader.Read())
             *   {
             *       Console.WriteLine(1);
             *       Model_Bike bike = new Model_Bike(reader.GetString("colour"), reader.GetString("type_bike"), reader.GetString("size"), 1, 1);
             *       bike.set_id(reader.GetInt16("id_bike"));
             *
             *       Orders.Add(bike, new Client(reader.GetString("firstname"), reader.GetString("lastname"), reader.GetString("email"), reader.GetString("adress"), int.Parse(reader.GetString("postalcode")), reader.GetString("city"), reader.GetString("business_name")));
             *   }
             *
             * }
             * else
             * {
             *   MessageBox.Show("NoOrderWasfound");
             *
             * }*/

            MySqlConnection connectionDB = Connection.connection();

            connectionDB.Open();
            try
            {
                MySqlCommand comando = new MySqlCommand(sql, connectionDB);
                reader = comando.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Model_Bike bike = new Model_Bike(reader.GetString("colour"), reader.GetString("type_bike"), reader.GetString("size"), 1, 1, reader.GetString("production_date"));
                        Console.WriteLine(bike.delivery_time);
                        bike.set_id(reader.GetInt16("id_bike"));
                        bike.set_order(reader.GetInt16("production_order"));
                        Orders.Add(bike, new Client(reader.GetString("firstname"), reader.GetString("lastname"), reader.GetString("email"), reader.GetString("adress"), int.Parse(reader.GetString("postalcode")), reader.GetString("city"), reader.GetString("business_name")));
                    }
                }
                else
                {
                    MessageBox.Show("NoOrderWasfound");
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Searching error" + ex.Message);
            }
            finally
            {
                connectionDB.Close();
            }


            foreach (KeyValuePair <Model_Bike, Client> elt in Orders)
            {
                Form1.Instance.production_Planning.pnl_week_orders.Controls.Add(new WeekOrders(elt.Key.id_bike.ToString(), elt.Key.type, elt.Key.size, elt.Value.last_name, elt.Value.business_name, elt.Key.order.ToString(), elt.Key.delivery_time.Split(' ')[0]));
            }
        }
コード例 #4
0
        private void Add_to_Cart_Click(object sender, EventArgs e)
        {
            if (BoxSize.Text != "" & boxColor.Text != "")
            {
                Dictionary <string, int> items = new Dictionary <string, int>();
                items.Add("Béquille_Standart_Standart", 1);
                items.Add("Kit de frein_Standart_Standart", 1);
                items.Add("Kit vitesse_Standart_Standart", 1);
                items.Add("Kit pédalier_Standart_Standart", 1);
                items.Add("Cassette de pignons_Standart_Standart", 1);
                items.Add("Catadioptre_Standart_Standart", 4);
                items.Add("Chaîne_Standart_Standart", 1);
                items.Add("Chambre à air_Standart_Standart", 2);
                items.Add("Détrailleur_Standart_Standart", 1);
                items.Add("Disque de frein_Standart_Standart", 2);
                items.Add("Guidon_Standart_Standart", 1);
                items.Add("Plateau_Standart_Standart", 1);
                items.Add("Selle_Standart_Standart", 1);
                if (BoxSize.Text == "25")
                {
                    items.Add("Fourche_Standart_M", 1);
                    items.Add("Roue_Standart_M", 1);
                }
                if (BoxSize.Text == "27")
                {
                    items.Add("Fourche_Standart_L", 1);
                    items.Add("Roue_Standart_M", 1);
                }

                if (label_model.Text == "City")
                {
                    items.Add("Eclairage_Standart_Standart", 1);
                    items.Add("Porte-bagage_Standart_Standart", 1);
                    if (boxColor.Text == "green" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Green_M", 1);
                        items.Add("Garde-boue_Green_M", 1);
                    }
                    if (boxColor.Text == "green" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Green_L", 1);
                        items.Add("Garde-boue_Green_L", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Red_M", 1);
                        items.Add("Garde-boue_Red_M", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Red_L", 1);
                        items.Add("Garde-boue_Red_L", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Blue_M", 1);
                        items.Add("Garde-boue_Blue_M", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Blue_L", 1);
                        items.Add("Garde-boue_Blue_L", 1);
                    }
                    if (BoxSize.Text == "25")
                    {
                        items.Add("Pneu_Standart_M", 2);
                    }
                    if (BoxSize.Text == "27")
                    {
                        items.Add("Pneu_Standart_L", 2);
                    }
                }
                if (label_model.Text == "Explorer")
                {
                    items.Add("Eclairage_Standart_Standart", 1);
                    items.Add("Porte-bagage_Standart_Standart", 1);
                    if (boxColor.Text == "green" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Green_M", 1);
                        items.Add("Garde-boue large_Green_M", 1);
                    }
                    if (boxColor.Text == "green" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Green_L", 1);
                        items.Add("Garde-boue large_Green_L", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Red_M", 1);
                        items.Add("Garde-boue large_Red_M", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Red_L", 1);
                        items.Add("Garde-boue large_Red_L", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre_Blue_M", 1);
                        items.Add("Garde-boue large_Blue_M", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre_Blue_L", 1);
                        items.Add("Garde-boue large_Blue_L", 1);
                    }
                    if (BoxSize.Text == "25")
                    {
                        items.Add("Pneu large_Standart_M", 2);
                    }
                    if (BoxSize.Text == "27")
                    {
                        items.Add("Pneu large_Standart_L", 2);
                    }
                }
                if (label_model.Text == "Adventure")
                {
                    if (boxColor.Text == "green" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre renforcé_Green_M", 1);
                    }
                    if (boxColor.Text == "green" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre renforcé_Green_L", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre renforcé_Red_M", 1);
                    }
                    if (boxColor.Text == "red" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre renforcé_Red_L", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "25")
                    {
                        items.Add("Cadre renforcé_Blue_M", 1);
                    }
                    if (boxColor.Text == "blue" && BoxSize.Text == "27")
                    {
                        items.Add("Cadre renforcé_Blue_L", 1);
                    }
                    if (BoxSize.Text == "25")
                    {
                        items.Add("Pneu large_Standart_M", 2);
                    }
                    if (BoxSize.Text == "27")
                    {
                        items.Add("Pneu large_Standart_L", 2);
                    }
                }

                Model_Bike model_bike = new Model_Bike(boxColor.Text, label_model.Text, BoxSize.Text, Double.Parse(price_lbl.Text), int.Parse(quantity_input.Text));
                //Command.Add(model_bike);
                model_bike.set_items(items);
                Form1.Instance.Cart.list_models.Add(model_bike);
                Form1.Instance.cart.FLPanel_Cart.Controls.Add(new Panier_composantes(this.img, model_bike.type, model_bike.colour, model_bike.size, model_bike.quantity.ToString(), model_bike.price.ToString()));
            }
        }