Example #1
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            Canteen c = new Canteen();

            addEmployee();
            c.Refreshwindow();
        }
Example #2
0
        public void addEmployee()
        {
            Canteen c = new Canteen();

            try
            {
                conn = new MySqlConnection(strConn);

                MySqlCommand cmd = conn.CreateCommand();
                cmd.CommandType = CommandType.Text;
                string nall = null;
                //MessageBox.Show(id);
                //string getIDCateg = cbStatus.Text.Split(' ')[0];
                cmd.CommandText = "insert into tbl_employee_stat values(" + this.txt_ID_NUMBER.Text + ",'" + this.txt_NAME.Text + "'," + cbStatus.Text.Split(' ')[0] + ")";
                //cmd.CommandText = "Insert into tbl_employee_status values("+ nall +","+ nall +","+ cbStatus.Text.Split(' ')[0] + ")";
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                MessageBox.Show("Employee  Successfully Added");
                clear();
                c.Refreshwindow();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }