/// <summary> /// Khởi tạo để cập nhật CCGT /// </summary> public FormEditCCGT(string maCoCauGiaiThuong) { InitializeComponent(); this.coCauGiaiThuongBUS = new CoCauGiaiThuongBUS(); this.giaiThuongBUS = new GiaiThuongBUS(); this.listMaGiaiThuongToDelete = new List <string>(); try { this.coCauGiaiThuong = this.coCauGiaiThuongBUS.GetCoCauGiaiThuongByMaCoCauGiaiThuong(maCoCauGiaiThuong); } catch (Exception ex) { this.DialogResult = DialogResult.Abort; XtraMessageBox.Show(ex.Message, @"Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FillMaCCGT() { try { DataTable dataTable = this.coCauGiaiThuongBUS.GetAll(); foreach (DataRow row in dataTable.Rows) { CoCauGiaiThuong coCauGiaiThuong = new CoCauGiaiThuong(row); this.comboBoxEdit_MaCCGT.Properties.Items.Add(coCauGiaiThuong); } if (this.loaiVe == null) { this.comboBoxEdit_MaCCGT.SelectedIndex = 0; } else { for (int i = 0; i < this.comboBoxEdit_MaCCGT.Properties.Items.Count; i++) { if (((CoCauGiaiThuong)this.comboBoxEdit_MaCCGT.Properties.Items[i]).MaCoCauGiaiThuong == this.loaiVe.MaCoCauGiaiThuong) { this.comboBoxEdit_MaCCGT.SelectedIndex = i; break; } } } } catch (Exception ex) { this.DialogResult = DialogResult.Abort; XtraMessageBox.Show(ex.Message, @"Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Thêm CCGT /// </summary> public void InsertCCGT() { try { this.coCauGiaiThuong = new CoCauGiaiThuong(string.Empty, this.barEditItem_NgayLap.EditValue.ToString()); this.coCauGiaiThuong.MaCoCauGiaiThuong = this.coCauGiaiThuongBUS.Insert(this.coCauGiaiThuong); for (int i = 0; i < this.gridView.RowCount; i++) { this.InsertGiaiThuong(this.gridView.GetDataRow(i)); } this.DialogResult = DialogResult.OK; XtraMessageBox.Show("Thêm Thành Công", @"Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { this.coCauGiaiThuong = null; XtraMessageBox.Show(ex.Message, @"Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }