コード例 #1
0
        //--------------------------Sửa Món Ăn---------------------------------
        private void btnSuaMonAn_Click(object sender, EventArgs e)
        {
            if (drMonAn == null)
            {
                MessageBox.Show("Chọn Món Ăn Muốn Sửa");
                return;
            }

            MonAn_DTO monAn = new MonAn_DTO();

            monAn.ID         = int.Parse(drMonAn.Cells["ID"].Value.ToString());
            monAn.TenNhomMon = cbNhomMon.Text;
            monAn.TenMonAn   = txtTenMonAn.Text;
            monAn.DonViTinh  = txtDonViTinh.Text;
            monAn.Gia        = int.Parse(txtDonGia.Text);
            monAn.IMAGE      = pictureBox1.Image;

            if (MonAn_BUS.SuaMonAn(monAn))
            {
                drMonAn           = null;
                cbNhomMon.Text    = "";
                txtTenMonAn.Text  = "";
                txtDonViTinh.Text = "";
                txtDonGia.Text    = "";
                pictureBox1.Image = null;
                LoadMonAn();
                MessageBox.Show("Sửa thành công");
                return;
            }
            MessageBox.Show("Sửa thất bại");
        }
コード例 #2
0
        //--------------------------Sửa Món Ăn---------------------------------
        private void btnSuaMonAn_Click(object sender, EventArgs e)
        {
            if (TKDN.Substring(0, 2) == "NV")
            {
                MessageBox.Show("Chỉ có chức vụ quản lý mới được sử dụng chức năng này.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (drMonAn == null)
                {
                    MessageBox.Show("Chọn Món Ăn Muốn Sửa");
                    return;
                }

                MonAn_DTO monAn = new MonAn_DTO();

                monAn.ID         = int.Parse(drMonAn.Cells["ID"].Value.ToString());
                monAn.TenNhomMon = cbNhomMon.Text;
                monAn.TenMonAn   = txtTenMonAn.Text;
                monAn.DonViTinh  = txtDonViTinh.Text;
                monAn.Gia        = int.Parse(txtDonGia.Text);
                monAn.IMAGE      = pictureBox1.Image;

                if (MonAn_BUS.SuaMonAn(monAn))
                {
                    drMonAn           = null;
                    cbNhomMon.Text    = "";
                    txtTenMonAn.Text  = "";
                    txtDonViTinh.Text = "";
                    txtDonGia.Text    = "";
                    pictureBox1.Image = null;
                    LoadMonAn();
                    MessageBox.Show("Sửa thành công");
                    return;
                }
                MessageBox.Show("Sửa thất bại");
            }
        }