Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        /// <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);
            }
        }