Exemplo n.º 1
0
        private void button22_Click(object sender, EventArgs e)
        {
            idUser.Text         = "";
            pswUser.Text        = "";
            newUsFirstName.Text = "";
            newUsLastName.Text  = "";
            newUsMail.Text      = "";
            newUsPhone.Text     = "";
            newUsPostal.Text    = "";
            newUsPsw.Text       = "";
            newUsStNum.Text     = "";
            newUsStreet.Text    = "";

            panel2.Visible = false;
            panel3.Visible = false;
            panel1.Visible = true;


            order    = new Order();
            wardrobe = new Wardrobe(new Size3D(120, 36, 42));
            order.Wardrobes.Add(wardrobe);
            player_modif          = false;
            M_selectwardrobe.Text = Convert.ToString(0);
            Preset();
        }
Exemplo n.º 2
0
 private void UnBook(object sender, FormClosingEventArgs e)
 {
     foreach (object ersatz in order.Wardrobes)
     {
         Wardrobe wardrobe = (Wardrobe)ersatz;
         wardrobe.UnBook();
     }
 }
Exemplo n.º 3
0
 private void M_newwardrobe_Click(object sender, EventArgs e)
 {
     wardrobe = new Wardrobe(new Size3D(120, 36, 42));
     order.Wardrobes.Add(wardrobe);
     player_modif          = false;
     M_selectwardrobe.Text = Convert.ToString(order.Wardrobes.Count - 1);
     Preset();
 }
Exemplo n.º 4
0
 public Modelize()
 {
     InitializeComponent();
     order    = new Order();
     wardrobe = new Wardrobe(new Size3D(120, 36, 42));
     order.Wardrobes.Add(wardrobe);
     player_modif          = false;
     M_selectwardrobe.Text = Convert.ToString(0);
     Preset();
 }
Exemplo n.º 5
0
 public App()
 {
     InitializeComponent();
     order    = new Order();
     wardrobe = new Wardrobe(new Size3D(120, 36, 42));
     order.Wardrobes.Add(wardrobe);
     player_modif          = false;
     M_selectwardrobe.Text = Convert.ToString(0);
     Preset();
     label4.Visible   = false;
     button2.Visible  = false;
     newClientId.Text = "";
 }
Exemplo n.º 6
0
        private void compute_Click(object sender, EventArgs e)
        {
            wardrobe = null;
            switch (test_input.Text)
            {
            case "vp_door":    //VisualPart_Door
                part = TestDoor(62, 32, Color.Beige).Visual_part;
                break;

            case "vp_knop":    //VisualPart_Knop
                part = TestKnop(6, 6, Color.Black).Visual_part;
                break;

            case "vp_panel":    //VisualPart_Panel
                part = TestPanel(120, 2, Color.Tan).Visual_part;
                break;

            case "vp_angle":    //VisualPart_Angle
                part = TestAngle(2, 108, Color.Black).Visual_part;
                break;

            case "vp_box":    //VisualPart_Box
                part = TestBox(120, 36, 42).Visual_part;;
                break;

            case "vp_wardrobe":    //VisualPart_Wardrobe
                wardrobe              = TestWardrobe(120, 36, 42);
                part                  = wardrobe.Visual_part;
                AddBox.Visible        = true;
                ChangeSurface.Visible = true;
                RemoveBox.Visible     = true;
                ResizeBox.Visible     = true;
                ChangeColor.Visible   = true;
                Color_input.Visible   = true;
                break;
            }
            try
            {
                view = "front";
                TestVisualPart(view);
            }
            catch { return; }
        }
Exemplo n.º 7
0
        private void M_previeworder_Click(object sender, EventArgs e)
        {
            if (order.CurrentClient != null)
            {
                wardrobe.Book(true);
                DbOrder.DbAddOrder(order);

                order    = new Order();
                wardrobe = new Wardrobe(new Size3D(120, 36, 42));
                order.Wardrobes.Add(wardrobe);
                player_modif          = false;
                M_selectwardrobe.Text = Convert.ToString(0);
                Preset();

                tabControl1.SelectTab(2);
            }
            else
            {
                tabControl1.SelectTab(1);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Places a new order for a client
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        private void button18_Click(object sender, EventArgs e)
        {
            if (int.TryParse(textBox8.Text, out int id))
            {
                Person person = DbConnect.searchClient(id);

                order    = new Order();
                wardrobe = new Wardrobe(new Size3D(120, 36, 42));
                order.Wardrobes.Add(wardrobe);
                player_modif          = false;
                M_selectwardrobe.Text = Convert.ToString(0);
                Preset();

                order.CurrentClient = person;
                tabControl1.SelectTab(1);
                if (person == null)
                {
                    tabControl1.SelectTab(2);
                    errorIdSearch.Visible = true;
                }
            }
        }
Exemplo n.º 9
0
 private void M_selectwardrobe_SelectedIndexChanged(object sender, EventArgs e)
 {
     wardrobe = (Wardrobe)order.Wardrobes[M_selectwardrobe.SelectedIndex];
     Preset();
 }
Exemplo n.º 10
0
        //TestWardrobe
        public Wardrobe TestWardrobe(int l, int h, int p, string reference = "wardrobe")
        {
            Wardrobe mywardrobe = new Wardrobe(new Size3D(l, h, p));

            return(mywardrobe);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Adds in the database the order given in the parameter, fills
        /// the tables with the components and links them to the current
        /// client and his the ordrer. The order must have a current_client
        /// with an existing id
        /// </summary>
        /// <param name="order">Order.</param>
        public static void DbAddOrder(Order order)
        {
            BDD database = new BDD("kitbox");
            Dictionary <string, object> bill = textString.bill();
            Dictionary <string, Dictionary <string, object> > components = new Dictionary <string, Dictionary <string, object> >();
            string   header_bill = bill["header"].ToString();
            string   footer_bill = bill["footer"].ToString();
            string   columnNames = "Client_Id, Date, Header_Bill, Footer_Bill";
            string   tableName   = "orders";
            string   client_id   = order.CurrentClient.Id.ToString();
            DateTime date        = DateTime.Now;

            date.AddDays(order.Delayed);
            string dateString = date.ToString();
            string data       = string.Format("{0},'{1}','{2}','{3}'", client_id, dateString, header_bill, footer_bill);

            // The order id is auto incremented in the orders table and we add
            // in the orders table : the client id, the date, the header bill and the footer bill
            database.addElement(tableName, columnNames, data);
            List <List <object> > list = database.readElement("Order_Id", tableName, string.Format("WHERE Client_Id = '{0}'", client_id.ToString()));
            int           order_id     = Convert.ToInt32(list[list.Count - 1][0]);
            List <object> wardrobes    = order.Wardrobes;

            tableName   = "rel_catord";
            columnNames = "Order_Id ,Wardrobe_Id,Box_Id,Component_Id";
            data        = "";
            // Choose a wardrobe in the list of wardrobes
            for (int i = 1; i <= wardrobes.Count; i++)
            {
                Wardrobe wardrobe   = (Wardrobe)wardrobes[i - 1];
                int      number_box = wardrobe.Components["Etage"].Count;
                data = string.Format("{0},{1},{2},{3}", order_id.ToString(), i.ToString(), "", "");
                // Choose an Angle
                foreach (KeyValuePair <string, object> cornieres in wardrobe.Components["Cornieres"])
                {
                    Angle  angle = (Angle)cornieres.Value;
                    string Id    = database.readElement("Id", "catalog", string.Format("WHERE Code='{0}'", angle.Code.ToString()))[0][0].ToString();
                    data = string.Format("'{0}','{1}','{2}','{3}'", order_id.ToString(), i.ToString(), "0", Id);
                    // Add the corner and its information in the table
                    database.addElement(tableName, columnNames, data);
                }
                // Choose a box of the wardrobe
                for (int j = 1; j <= number_box; j++)
                {
                    data = string.Format("{0},{1},{2},{3}", order_id.ToString(), i.ToString(), j.ToString(), "");
                    // The "Etage" key gives all the boxes
                    foreach (KeyValuePair <string, object> kvp in wardrobe.Components["Etage"])
                    {
                        if (Convert.ToInt32(kvp.Key) == j)
                        {
                            Box box = (Box)wardrobe.Components["Etage"][j.ToString()];
                            Dictionary <string, Dictionary <string, Part> > parts = box.Pieces;
                            foreach (KeyValuePair <string, Dictionary <string, Part> > kvp2 in parts)
                            {
                                // Choose a part
                                foreach (KeyValuePair <string, Part> kvp3 in kvp2.Value)
                                {
                                    string Id = database.readElement("Id", "catalog", string.Format("WHERE Code='{0}'", kvp3.Value.Code.ToString()))[0][0].ToString();
                                    data = string.Format("{0},{1},{2},{3}", order_id.ToString(), i.ToString(), j.ToString(), Id);
                                    // Add the part of the box and its information in the database
                                    database.addElement(tableName, columnNames, data);
                                }
                            }
                        }
                    }
                }
            }
        }