Exemplo n.º 1
0
        private void btnLuu_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            System.Data.DataRow row = gvTheLoai.GetDataRow(gvTheLoai.FocusedRowHandle);
            if (them)
            {
                try
                {
                    BLTheLoai blTL = new BLTheLoai();

                    blTL.ThemTheLoai(MaTL, TenTL, ref err);

                    LoadData();

                    XtraMessageBox.Show("Đã thêm xong!");
                }
                catch
                {
                    XtraMessageBox.Show("Không thêm được. Lỗi rồi!");
                }
            }
            else
            {
                try
                {
                    BLTheLoai blTL = new BLTheLoai();

                    blTL.CapNhatTheLoai(MaTL, TenTL, ref err);

                    LoadData();

                    XtraMessageBox.Show("Đã sửa xong!");
                }
                catch (SqlException ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }
            }
        }