Ejemplo n.º 1
0
        //xoa
        private void xóaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int currentRowIndex = dsmonan.CurrentCellAddress.Y;// 'current row selected

            //'Verify that indexing OK
            if (-1 < currentRowIndex && currentRowIndex < dsmonan.RowCount)
            {
                MonAnDTO ma = (MonAnDTO)dsmonan.Rows[currentRowIndex].DataBoundItem;
                if (ma != null)
                {
                    bool kq1 = dsnlBUS.XoatheoMA(ma.mama);
                    bool kq2 = maBUS.Xoa(ma);
                    if (!kq1 && !kq2)
                    {
                        MessageBox.Show("Xóa món ăn thất bại. Vui lòng kiểm tra lại dũ liệu");
                    }
                    else
                    {
                        MessageBox.Show("Xóa món ăn thành công");
                        this.loadData_Vao_GridView();
                    }
                }
            }
        }