Пример #1
0
        private void cancel_button_Click(object sender, EventArgs e)
        {
            Profile_Supplier g = new Profile_Supplier();

            g.Show();
            this.Hide();
        }
Пример #2
0
        private void Supplier_Link_Click(object sender, EventArgs e)
        {
            Profile_Supplier g = new Profile_Supplier();

            g.Show();
            this.Hide();
        }
Пример #3
0
        private void add_button_Click(object sender, EventArgs e)
        {
            //add function

            if (item_name_text.Text == "" || item_type_text.Text == "" || item_purchaseprice_text.Text == "" || item_sellingprice_text.Text == "" || item_supplier_text.Text == "")
            {
                MessageBox.Show("Please input required field.");
            }
            else if (item_type_text.Items.Contains(item_type_text.Text) == false)
            {
                MessageBox.Show("Please select an item type from list");
                item_type_text.Text = String.Empty;
            }
            else if (measure_text.Items.Contains(measure_text.Text) == false)
            {
                MessageBox.Show("Please select a measurement from list");
                measure_text.Text = String.Empty;
            }
            else
            {
                string    y  = "select * from item where item_id = '" + item_id.Text + "'";
                DataTable dt = new DataTable();
                dt = main.SELECT_Statement(y);

                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("Item already exists!", "BOX", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    int    suppid = Convert.ToInt32(supplier_id.Text);
                    int    typeid = Convert.ToInt32(item_type_id_fk.Text);
                    string query  = "INSERT INTO item(item_name,item_type_id_fk, item_measurement, item_purchase_price,item_selling_price, supplier_id_item_fk, item_brand, item_size)" +
                                    "VALUES('" + item_name_text.Text + "','" + typeid + "','" + measure_text.Text + "','" + item_purchaseprice_text.Text + "','" + item_sellingprice_text.Text + "','" + suppid + "','" + brand_text.Text + "','" + item_size.Text + "');";
                    main.CUD_Statement(query);
                    MessageBox.Show("Item Added!", "BOX", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Profile_Supplier g = new Profile_Supplier();
                    g.Show();
                    this.Hide();
                }
            }
        }