Beispiel #1
0
        //TestKnop
        public Knop TestKnop(int x, int y, Color color, string reference = "knop")
        {
            Knop myknop = new Knop();

            myknop.Location   = new Point3D(0, 0, 0);
            myknop.Dimensions = new Size3D(x, y, 0);
            myknop.Color      = color;
            myknop.Reference  = reference;
            myknop.ConstructVisualPart();
            return(myknop);
        }
Beispiel #2
0
 /// <summary>
 /// add a knop for the door, at the position left or right
 /// </summary>
 /// <param name="knop"></param>
 /// <param name="x_location"></param>
 /// <param name="knop_position"></param>
 public void SetKnop(Knop knop, int x_location, string knop_position = "left/right")
 {
     if (this.knop != null)
     {
         Selling_price -= this.knop.Selling_price;
     }
     this.knop_position = knop_position.Split('/')[0];
     this.knop          = knop;
     this.knop.Location = new Point3D(x_location, 0, 0);
     Selling_price     += this.knop.Selling_price;
 }
Beispiel #3
0
 public void SetKnop(Knop knop, int x_location, string knop_position = "left/right")
 {
     this.knop_position = knop_position.Split('/')[0];
     this.knop          = knop;
     this.knop.Location = new Point3D(x_location, 0, 0);
 }
Beispiel #4
0
        /// <summary>
        /// Returns a Part with the selected_characteristics if found in database. If there are multiple results, returns the first
        /// </summary>
        /// <param name="selected_characteristics"></param>
        /// <param name="order_by"></param>
        /// <returns></returns>
        public static Part DbSelectPart(Dictionary <string, string> selected_characteristics, string order_by = "")
        {
            BDD    database   = new BDD("kitbox");
            string selection  = "Ref, Code, hauteur, profondeur, largeur, Couleur, PrixClient";
            string table_name = "catalog";
            string condition  = "WHERE (";
            int    counter    = 0;

            foreach (string key in selected_characteristics.Keys)
            {
                counter++;
                condition += key + "='" + selected_characteristics[key] + "'";
                if (counter != selected_characteristics.Count)
                {
                    condition += " AND ";
                }
            }
            condition += ")";
            if (order_by != "")
            {
                condition += "ORDER BY " + order_by + ";";
            }
            Part request = null;
            List <List <object> > result = database.readElement(selection, table_name, condition);

            if (result.Count > 0)
            {
                if (result[0].Count == selection.Split(',').Length)
                {
                    Dictionary <string, object> data = new Dictionary <string, object>();
                    data["Reference"]     = Convert.ToString(result[0][0]);
                    data["Code"]          = Convert.ToString(result[0][1]);
                    data["Dimensions"]    = new Size3D(Convert.ToDouble(result[0][4]), Convert.ToDouble(result[0][2]), Convert.ToDouble(result[0][3]));
                    data["Color"]         = Color.FromName(TranslateColor(Convert.ToString(result[0][5])));
                    data["Selling_price"] = Convert.ToDouble(result[0][6]);

                    if (Convert.ToString(result[0][0]).Contains("Panneau") || Convert.ToString(result[0][0]).Contains("Traverse"))
                    {
                        request = new Panel();
                        request.SetData(data);
                    }
                    else if (Convert.ToString(result[0][0]).Contains("Porte"))
                    {
                        request = new Door();
                        request.SetData(data);
                    }
                    else if (Convert.ToString(result[0][0]).Contains("Coupelles"))
                    {
                        request = new Knop();
                        request.SetData(data);
                    }
                    else if (Convert.ToString(result[0][0]).Contains("Cornieres"))
                    {
                        request = new Angle();
                        request.SetData(data);
                    }
                    else if (Convert.ToString(result[0][0]).Contains("Tasseau"))
                    {
                        request = new Door();
                        request.SetData(data);
                    }
                }
            }
            return(request);
        }