Exemplo n.º 1
0
        public void CTPhieuGiaCong_Upd(CTGiaCong_DTO pbh)
        {
            var obj = vbdq.CTGIACONGs.Single(x => x.SoPhieuGiaCong == pbh.SoPhieuGiaCong && x.SoPhieuDV == pbh.SoPhieuDV && x.STT == pbh.STT);

            obj.SoLuong   = pbh.SoLuong;
            obj.DonGia    = pbh.DonGia;
            obj.ThanhTien = Decimal.Parse(pbh.ThanhTien.ToString());
            obj.MaTho     = pbh.MaTho;

            vbdq.SubmitChanges();
        }
        public FormCTPhieuGiaCong_AddUpd(CTGiaCong_DTO pbh)
        {
            InitializeComponent();
            comboBox_MaTho.DataSource    = ctphieugc_bus.LayDSMaTho();
            comboBox_MaTho.ValueMember   = "MaTho";
            comboBox_MaTho.DisplayMember = "MaTho";
            //
            txtSoPhieugc.Text            = pbh.SoPhieuGiaCong.ToString();
            txtSoPhieudv.Text            = pbh.SoPhieuDV.ToString();
            txtSTT.Text                  = pbh.STT.ToString();
            txtSoLuong.Text              = pbh.SoLuong.ToString();
            txtDonGia.Text               = pbh.DonGia.ToString();
            txtThanhTien.Text            = pbh.ThanhTien.ToString();
            comboBox_MaTho.SelectedValue = pbh.MaTho;

            btnThem.Enabled = false;
        }
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            Decimal       tien;
            CTGiaCong_DTO phieugc = new CTGiaCong_DTO();

            phieugc.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
            phieugc.SoPhieuDV      = Int16.Parse(txtSoPhieudv.Text);
            phieugc.STT            = Int16.Parse(txtSTT.Text);
            phieugc.DonGia         = Decimal.Parse(txtDonGia.Text);
            phieugc.SoLuong        = Int16.Parse(txtSoLuong.Text);
            tien = phieugc.ThanhTien;
            phieugc.ThanhTien = Decimal.Parse(txtThanhTien.Text);
            phieugc.MaTho     = Int16.Parse(comboBox_MaTho.SelectedValue.ToString());


            ctphieugc_bus.CTPhieuGiaCong_Upd(phieugc);
            ctphieugc_bus.CapNhatTongTien(phieugc.SoPhieuGiaCong, phieugc.SoPhieuDV, phieugc.STT, tien, 2);
            this.Close();
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (txtSoPhieugc.Text.CompareTo("") != 0)
            {
                CTGiaCong_DTO phieugc = new CTGiaCong_DTO();
                phieugc.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
                phieugc.SoPhieuDV      = Int16.Parse(txtSoPhieudv.Text);
                phieugc.STT            = Int16.Parse(txtSTT.Text);
                phieugc.DonGia         = Decimal.Parse(txtDonGia.Text);
                phieugc.SoLuong        = Int16.Parse(txtSoLuong.Text);
                phieugc.ThanhTien      = Decimal.Parse(txtThanhTien.Text);
                phieugc.MaTho          = Int16.Parse(comboBox_MaTho.SelectedValue.ToString());


                ctphieugc_bus.CTPhieuGiaCong_Add(phieugc);
                ctphieugc_bus.CapNhatTongTien(phieugc.SoPhieuGiaCong, phieugc.SoPhieuDV, phieugc.STT, 0, 1);
                this.Close();
            }
        }
Exemplo n.º 5
0
        public void CTPhieuGiaCong_Add(CTGiaCong_DTO pbh)
        {
            CTGIACONG obj = new CTGIACONG();

            obj.SoPhieuGiaCong = pbh.SoPhieuGiaCong;
            obj.SoPhieuDV      = pbh.SoPhieuDV;
            obj.STT            = pbh.STT;
            obj.SoLuong        = pbh.SoLuong;
            obj.DonGia         = pbh.DonGia;
            obj.ThanhTien      = Decimal.Parse(pbh.ThanhTien.ToString());
            obj.MaTho          = pbh.MaTho;

            vbdq.CTGIACONGs.InsertOnSubmit(obj);

            //update tinh trang cho phieu dv
            var phieudv = vbdq.CTPHIEUDICHVUs.Single(x => x.STT == pbh.STT && x.SoPhieuDV == pbh.SoPhieuDV);

            phieudv.TinhTrang = 1;

            vbdq.SubmitChanges();
        }
Exemplo n.º 6
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            if (txtSoPhieugc.Text.CompareTo("") == 0)
            {
                MessageBox.Show("Vui lòng chọn dòng dữ liệu muốn Sửa !");
            }
            else
            {
                CTGiaCong_DTO phieugc = new CTGiaCong_DTO();
                phieugc.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
                phieugc.SoPhieuDV      = Int16.Parse(txtSoPhieudv.Text);
                phieugc.STT            = Int16.Parse(txtSTT.Text);
                phieugc.DonGia         = Decimal.Parse(txtDonGia.Text);
                phieugc.SoLuong        = Int16.Parse(txtSoLuong.Text);
                phieugc.ThanhTien      = Decimal.Parse(txtThanhTien.Text);
                phieugc.MaTho          = Int32.Parse(txtMaTho.Text);

                FormCTPhieuGiaCong_AddUpd form = new FormCTPhieuGiaCong_AddUpd(phieugc);
                DialogResult dr = form.ShowDialog();
                dataGridView.DataSource = ctphieugc_bus.LayTatCa(sophieugc);
            }
        }