Example #1
0
        private void AddOr_Load(object sender, EventArgs e)
        {
            var mySql = new mySql();

            CBselect = mySql.selectFlAddOr + whFarm + whLen + whColour + whSleeve + whMix + whFt;
            dataGridViewOA.DataSource = bindingSource1;
            mySql.GetData(CBselect, bindingSource1);
            dataGridViewOA.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //fill up dataGridView by Farms
            dataGridView1.DataSource = bindingSource5;
            mySql.GetData(mySql.selectFarms, bindingSource5);
            //fill up dataGridView by Lengths
            dataGridView2.DataSource = bindingSource2;
            mySql.GetData(mySql.selectLengths, bindingSource2);
            ////fill up dataGridView by Colours
            dataGridView3.DataSource = bindingSource3;
            mySql.GetData(mySql.selectColour, bindingSource3);
            ////fill up dataGridView by Sleeves
            dataGridView4.DataSource = bindingSource4;
            mySql.GetData(mySql.selectSleeve, bindingSource4);
            //fill up combo boxes
            mySql.fillUpCb(cbFarm, "SELECT farms.farm_name FROM[MG_inkjop].[dbo].[farms]");
            mySql.fillUpCb(cbLengths, "SELECT lengths.length FROM[MG_inkjop].[dbo].[lengths]");
            mySql.fillUpCb(cbColour, "SELECT colours.colour FROM[MG_inkjop].[dbo].[colours]");
            mySql.fillUpCb(cbSleeve, "SELECT sleeves.sleeve FROM[MG_inkjop].[dbo].[sleeves]");
            dataGridViewOA.Columns[0].Visible = true;

            dataGridViewOrders.DataSource = bindingSourceOrders;
            mySql.GetData("select order_number from [MG_inkjop].[dbo].[orders] group by order_number", bindingSourceOrders);
            dataGridViewOrders.AllowUserToAddRows = false;//prevent from create empt row on the end

            tabControlAddOrder.Appearance = TabAppearance.Buttons;
            tabControlAddOrder.ItemSize   = new Size(0, 1);
            tabControlAddOrder.SizeMode   = TabSizeMode.Fixed;

            radioButtonMix1.Checked = true;
            radioButtonFt1.Checked  = true;
            mySql.updateAntall(lblAddOrAntalFl, dataGridViewOA);
        }