Example #1
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            dem = 0;
            ThemVaCapNhatMon t = new ThemVaCapNhatMon(null, null, null, null, null);

            t.Show();
        }
Example #2
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            dem = 1;
            try
            {
                int r;
                r = dgvThongTinMon.CurrentCell.RowIndex;
                if (r >= 0)
                {
                    //    byte[] HinhAnh = null;
                    string MaMon   = dgvThongTinMon.Rows[r].Cells[0].Value.ToString();
                    string TenMon  = dgvThongTinMon.Rows[r].Cells[1].Value.ToString();
                    string TheLoai = dgvThongTinMon.Rows[r].Cells[3].Value.ToString();
                    string GiaMon  = dgvThongTinMon.Rows[r].Cells[2].Value.ToString();
                    //  string ha = dgvThongTinMon.Rows[r].Cells[4].Value.ToString();
                    if (b != null)
                    {
                        //  HinhAnh = (byte[])dgvThongTinMon.Rows[r].Cells[4].Value;
                        k = 1;
                    }
                    else
                    {
                        k = 0;
                    }

                    ThemVaCapNhatMon capnhat = new ThemVaCapNhatMon(MaMon, TenMon, TheLoai, GiaMon, b);
                    capnhat.Show();
                }
                else
                {
                    MessageBox.Show("Chưa Chọn Món Cần Cập Nhật!!!");
                }
            }
            catch (SqlException)
            {
                MessageBox.Show("Không Được. Lỗi rồi!!!");
            }
        }