예제 #1
0
        private void iCMNDPhieuThu_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.IsCMNDAddingNew)
            {
                this.iCMNDCapNhat_ItemClick(sender, e);
            }

            if (!this.IsCMNDValidatingError && this.cMNDBindingSource.Current != null)
            {
                this.xtraTabControl1.SelectedTabPageIndex = 1;
                QLCMND.CMND.CMNDRow row = (QLCMND.CMND.CMNDRow)((DataRowView)this.cMNDBindingSource.Current).Row;

                this.iPTThem_ItemClick(sender, e);
                this.txtPTHoTen.Text = row.hoten;

                if (row.IsdiachiNull())
                {
                    this.txtPTDiaChi.Text = "";
                }
                else
                {
                    this.txtPTDiaChi.Text = row.diachi;
                }

                this.txtPTSoTien.Focus();
            }
        }
예제 #2
0
 private void txtCMND_EditValueChanged(object sender, EventArgs e)
 {
     if (this.cMNDBindingSource1.Current != null && this.txtCMND.IsEditorActive)
     {
         QLCMND.CMND.CMNDRow row = (QLCMND.CMND.CMNDRow)((DataRowView)this.txtCMND.Properties.GetDataSourceRowByKeyValue(this.txtCMND.EditValue)).Row;
         this.txtPCNguoiNhan.Text   = row.hoten;
         this.txtPCNgayCap.DateTime = row.ngaycap;
         this.txtPCNoiCap.Text      = row.noicap;
         this.txtPCDiaChi.Text      = row.diachi;
     }
 }
예제 #3
0
        private void CapNhatCMND()
        {
            QLCMND.CMND.CMNDRow row = (QLCMND.CMND.CMNDRow)((DataRowView)this.cMNDBindingSource.Current).Row;

            row.lastupdate = DateTime.Now;

            if (string.IsNullOrEmpty(row.diachi))
            {
                row.diachi = row.hkthuongtru;
            }

            this.IsCMNDAddingNew = false;
            this.cMNDBindingSource.EndEdit();
            this.cMND._CMND.GetChanges();
            this.cMNDTableAdapter.Update(this.cMND._CMND);
            this.cMND._CMND.AcceptChanges();
        }
예제 #4
0
        private void iCMNDPhieuChi_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.IsCMNDAddingNew)
            {
                this.iCMNDCapNhat_ItemClick(sender, e);
            }

            if (!this.IsCMNDValidatingError && this.cMNDBindingSource.Current != null)
            {
                this.xtraTabControl1.SelectedTabPageIndex = 2;
                QLCMND.CMND.CMNDRow row = (QLCMND.CMND.CMNDRow)((DataRowView)this.cMNDBindingSource.Current).Row;

                this.iPCThem_ItemClick(sender, e);
                this.txtCMND.Text = row.cmndid;
                this.txtPCSoTien.Focus();
            }
        }
예제 #5
0
        private void iPCLuu_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.isPhieuChiTab() && this.phieuchiBindingSource.Current != null)
            {
                if (this.ValidatePhieuChiFields())
                {
                    QLCMND.CMND.phieuchiRow row = (QLCMND.CMND.phieuchiRow)((DataRowView)this.phieuchiBindingSource.Current).Row;

                    if (row.IscreateddateNull())
                    {
                        row.createddate = DateTime.Now;
                        row.ngaylap     = DateTime.Now;
                    }

                    this.IsPCAddingNew = false;
                    this.phieuchiBindingSource.EndEdit();
                    this.cMND.phieuchi.GetChanges();
                    this.phieuchiTableAdapter.Update(this.cMND.phieuchi);
                    this.cMND.phieuchi.AcceptChanges();

                    // Luu thong tin CMND
                    int currentPos = this.cMNDBindingSource.Position;
                    int position   = this.cMNDBindingSource.Find("cmndid", row.cmnd);

                    if (position >= 0)
                    {
                        this.cMNDBindingSource.Position = position;
                        this.iCMNDHuy_ItemClick(sender, e);

                        QLCMND.CMND.CMNDRow cmndRow = ((this.cMNDBindingSource.Current as DataRowView).Row as QLCMND.CMND.CMNDRow);
                        cmndRow.ngaycap = this.txtPCNgayCap.DateTime;
                        cmndRow.noicap  = this.txtPCNoiCap.Text;
                        cmndRow.diachi  = this.txtPCDiaChi.Text;

                        this.cMNDBindingSource.EndEdit();
                        this.cMND._CMND.GetChanges();
                        this.cMNDTableAdapter.Update(this.cMND._CMND);
                        this.cMND._CMND.AcceptChanges();
                    }
                    else
                    {
                        this.iCMNDHuy_ItemClick(sender, e);
                        this.ThemCMND();

                        QLCMND.CMND.CMNDRow cmndRow = ((this.cMNDBindingSource.Current as DataRowView).Row as QLCMND.CMND.CMNDRow);
                        cmndRow.ngaycap     = this.txtPCNgayCap.DateTime;
                        cmndRow.noicap      = this.txtPCNoiCap.Text;
                        cmndRow.hkthuongtru = this.txtPCDiaChi.Text;

                        this.CapNhatCMND();
                    }

                    this.cMNDBindingSource.Position = currentPos;
                }
            }
            else if (this.phieuchiBindingSource.Current == null)
            {
                var confirmResult = MessageBox.Show("Không có Phiếu chi nào trong danh sách hiện tại. Bạn có tạo một Phiếu chi mới không ??", "Confirm",
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (confirmResult == DialogResult.Yes)
                {
                    this.iPCThem_ItemClick(sender, e);
                }
            }
        }