Пример #1
0
        ////////////////////////////////////---------------INPUT ITEMS PANEL FUNCTIONS----------///////////////////////////////////////

        //The method executes when the add item button clicks
        private void additem_Click(object sender, EventArgs e)
        {
            if (I_brand.Text != "" && I_itemname.Text != "" && comboBox1.Text != "" && I_price.Text != "" && I_instock.Text != "")
            {
                try
                {
                    MySqlConnection conn  = new MySqlConnection(@"datasource=127.0.0.1;port=3306;SslMode=none;username=root;password=;database=wicrama;");
                    string          query = "insert into `items`(`model`,`part`,`type`,`price`,`instock`) values('" + I_brand.Text.Trim() + "','" + I_itemname.Text.Trim() + "','" + comboBox1.Text.Trim() + "','" + I_price.Text.Trim() + "','" + I_instock.Text.Trim() + "')";
                    MySqlCommand    cmd   = new MySqlCommand(query, conn);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    MessageBox.Show("The item is successfully added !");
                    I_brand.Clear();
                    I_itemname.Clear();
                    I_price.Clear();
                    I_instock.Clear();
                    comboBox1.SelectedIndex = -1;
                    FillGridView();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("u should fill the all fields");
            }
        }//add item method end
Пример #2
0
 //------------------------------------navigation pane button events
 //add-item button
 private void add_Click(object sender, EventArgs e)
 {
     slide_panel.Width = add.Width;
     slide_panel.Left  = add.Left;
     additem_panel.BringToFront();
     FillGridView();
     I_brand.Clear();
     I_itemname.Clear();
     I_price.Clear();
     I_instock.Clear();
     comboBox1.SelectedIndex = -1;
     I_itemcode.Enabled      = false;
     I_itemcode.Text         = "ID";
 }