Ejemplo n.º 1
0
        public Form_purchase()
        {
            InitializeComponent();

            int    totalHeight = 0;
            Locker locker;

            foreach (ICupboardComponents cupCompo in ShoppingCart.cupboardComponentsList)
            {
                if (cupCompo is Locker)
                {
                    locker = (Locker)cupCompo;

                    int    currentbox = locker.ID;
                    string height     = locker.height.ToString();
                    //string depth = locker.depth.ToString();
                    string doorsColor = EnumParse.parseColorEnumToStr(locker.doorsColor);
                    string panelColor = EnumParse.parseColorEnumToStr(locker.panelColor);
                    string price      = locker.price.ToString();

                    totalHeight += locker.height + 4;

                    dataGridView1.Rows.Add(currentbox, height, doorsColor, false, panelColor, price);
                }
            }
            string          MyConString = "SERVER=db4free.net;" + "DATABASE=kitbox_kewlax;" + "UID=kewlaw;" + "PASSWORD=locomac6; old guids = true";
            MySqlConnection conn        = new MySqlConnection(MyConString);

            conn.Open();
            List <string> HeightBracketsList = QueryKitbox.SpecsBoxList(conn, "Height", "Ref = \"AngleBracket\"");

            conn.Close();
            int angleBracketHeight = 0;
            int diff;
            int minDiff = 1000;

            foreach (string heightBracket in HeightBracketsList)
            {
                diff = Int32.Parse(heightBracket) - totalHeight;
                if (diff >= 0 && diff < minDiff)
                {
                    minDiff            = diff;
                    angleBracketHeight = Int32.Parse(heightBracket);
                }
            }

            conn.Open();
            string angleBracketPrices = DbUtils.BigMoney(conn, "CustPrice", "AngleBracket", angleBracketHeight.ToString(), "0", "0", EnumParse.parseColorEnumToStr(ShoppingCart.colorAngleBracketChosen))[0];

            conn.Close();
            double angleBracketPrice = Double.Parse(angleBracketPrices);

            AngleBracket angleBrackets = new AngleBracket(angleBracketPrice, "null", "0000", new ComponentSize(0, 0, 0), true, ShoppingCart.colorAngleBracketChosen);

            ShoppingCart.addCupboardComponent(angleBrackets);

            dataGridView1.Rows.Add("Anglebrackets", angleBracketHeight, " ", null, " ", angleBracketPrice.ToString() + " x4");
        }
Ejemplo n.º 2
0
 public void getPriceOnDoorTest()
 {
     door1       = new Door();
     door1.price = catalogueDB.getPrice(42, 52, 0, EnumParse.parseColorEnumToStr(ComponentColor.brown), "Door");
     Assert.AreEqual(10.92, door1.price);
 }