Ejemplo n.º 1
0
        private void toolAdd_Click(object sender, EventArgs e)
        {
            try
            {
                long maphieu = ThamSo.LayMaPhieuThanhToan() + 1;
                ThamSo.GanMaPhieuThanhToan(maphieu + 1);

                PhieuThanhToan phieuthanhtoan = new PhieuThanhToan();
                phieuthanhtoan.Id                 = maphieu.ToString();
                phieuthanhtoan.VanChuyen.Id       = int.Parse(cbbChiPhiVC.SelectedValue.ToString());
                phieuthanhtoan.VanChuyen.Ten      = cbbChiPhiVC.Text;
                phieuthanhtoan.VanChuyen.Gia      = int.Parse(txtChiPhiVC.Text);
                phieuthanhtoan.ChiPhiPhatSinh.Id  = int.Parse(cbbChiPhiPS.SelectedValue.ToString());
                phieuthanhtoan.ChiPhiPhatSinh.Ten = cbbChiPhiPS.Text;
                phieuthanhtoan.ChiPhiPhatSinh.Gia = int.Parse(txtChiPhiPS.Text);
                phieuthanhtoan.NgayNhap           = DateTime.Now;
                phieuthanhtoan.KhachHang.Id       = cmbKhachHang.SelectedValue.ToString();
                phieuthanhtoan.GhiChu             = txtGhiChu.Text;
                phieuthanhtoan.ChietKhau          = int.Parse(numChietKhau.Value.ToString());
                phieuthanhtoan.GiamGia            = int.Parse(numGiamGia.Value.ToString());
                phieuthanhtoan.SoTien             = long.Parse(numTongTien.Value.ToString());
                ctrl.Store(phieuthanhtoan);
                ctrl.HienthiPhieuThanhToan(dataGridView);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //bindingNavigator.BindingSource.MoveLast();
        }
Ejemplo n.º 2
0
        private void toolAdd_Click(object sender, EventArgs e)
        {
            long maphieu = ThamSo.LayMaPhieuThanhToan();;

            ThamSo.GanMaPhieuThanhToan(maphieu + 1);

            DataRow row = ctrl.NewRow();

            row["ID"] = maphieu;
            row["NGAY_THANH_TOAN"] = DateTime.Now.Date;
            row["TONG_TIEN"]       = numTongTien.Value;
            ctrl.Add(row);
            bindingNavigator.BindingSource.MoveLast();
        }