Exemplo n.º 1
0
        private void toolStripSửa_Click(object sender, EventArgs e)
        {
            if (CoPhieuNo(int.Parse(txtSPhieu.Text)))
            {
                return;
            }

            DataGridViewRow r  = this.dataGridViewCT.SelectedRows[0];
            CTPhieuBan_DTO  ct = new CTPhieuBan_DTO()
            {
                SoPhieuBan = int.Parse(txtSPhieu.Text),
                MaSP       = int.Parse(r.Cells["MaSP"].Value.ToString()),
                SoLuong    = int.Parse(r.Cells["SoLuong"].Value.ToString()),
                DonGia     = decimal.Parse(r.Cells["DonGia"].Value.ToString()),
                ThanhTien  = decimal.Parse(r.Cells["ThanhTien"].Value.ToString())
            };
            M_CTPhieuBanHangEdit form = new M_CTPhieuBanHangEdit(ct, 1);
            DialogResult         dr   = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                loadgridview(this.CTPhieuBan.SelectTop(int.Parse(txtSPhieu.Text), 0));
                txtTongTien.Text = PhieuBan.Search(int.Parse(txtSPhieu.Text)).FirstOrDefault().TongTien.ToString();
            }
        }
Exemplo n.º 2
0
        private void toolStripButtonThem_Click(object sender, EventArgs e)
        {
            if (CoPhieuNo(int.Parse(txtSPhieu.Text)))
            {
                return;
            }

            CTPhieuBan_DTO ct = new CTPhieuBan_DTO()
            {
                SoPhieuBan = int.Parse(txtSPhieu.Text),
                MaSP       = 0,
                SoLuong    = 0,
                DonGia     = 0,
                ThanhTien  = 0
            };
            M_CTPhieuBanHangEdit form = new M_CTPhieuBanHangEdit(ct, 0);
            DialogResult         dr   = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                loadgridview(this.CTPhieuBan.SelectTop(int.Parse(txtSPhieu.Text), 0));
                txtTongTien.Text = PhieuBan.Search(int.Parse(txtSPhieu.Text)).FirstOrDefault().TongTien.ToString();
            }
        }