Ejemplo n.º 1
0
        public void PhieuGiaCong_Upd(PhieuGiaCong_DTO pbh)
        {
            var obj = vbdq.PHIEUGIACONGs.Single(x => x.SoPhieuGiaCong == pbh.SoPhieuGiaCong);

            obj.NgayLap  = DateTime.Parse(pbh.NgayLap.ToString());
            obj.TongTien = Decimal.Parse(pbh.TongTien.ToString());

            vbdq.SubmitChanges();
        }
Ejemplo n.º 2
0
        public FormPhieuGiaCong_AddUpd(PhieuGiaCong_DTO phieugc)
        {
            InitializeComponent();
            txtSoPhieuGiaCong.Text = phieugc.SoPhieuGiaCong.ToString();
            dtPicker_NgayLap.Value = DateTime.Parse(phieugc.NgayLap.ToString());
            txtTongTien.Text       = phieugc.TongTien.ToString();

            btnThem.Enabled = false;
        }
Ejemplo n.º 3
0
        public void PhieuGiaCong_Add(PhieuGiaCong_DTO pbh)
        {
            PHIEUGIACONG obj = new PHIEUGIACONG();

            obj.SoPhieuGiaCong = pbh.SoPhieuGiaCong;
            obj.NgayLap        = DateTime.Parse(pbh.NgayLap.ToString());
            obj.TongTien       = Decimal.Parse(pbh.TongTien.ToString());

            vbdq.PHIEUGIACONGs.InsertOnSubmit(obj);
            vbdq.SubmitChanges();
        }
Ejemplo n.º 4
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            PhieuGiaCong_DTO phieugc = new PhieuGiaCong_DTO();

            phieugc.SoPhieuGiaCong = Int16.Parse(txtSoPhieuGiaCong.Text);
            phieugc.NgayLap        = dtPicker_NgayLap.Value.ToShortDateString();
            phieugc.TongTien       = Decimal.Parse(txtTongTien.Text);

            phieugc_bus.PhieuGiaCong_Upd(phieugc);
            this.Close();
        }
Ejemplo n.º 5
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
            {
                PhieuGiaCong_DTO phieugc = new PhieuGiaCong_DTO();
                phieugc.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
                phieugc.NgayLap        = txtNgayLap.Text;
                phieugc.TongTien       = Decimal.Parse(txtTongTien.Text);

                FormPhieuGiaCong_AddUpd form = new FormPhieuGiaCong_AddUpd(phieugc);
                DialogResult            dr   = form.ShowDialog();
                dataGridView.DataSource = phieugc_bus.LayTatCa();
            }
        }
Ejemplo n.º 6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (KT_Ngay(txtNgayLap.Text))
            {
                TextBox_readonly_false();
                try
                {
                    PhieuGiaCong_DTO phieudv = new PhieuGiaCong_DTO();
                    if (txtSoPhieugc.Text.CompareTo("") != 0)
                    {
                        phieudv.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
                    }
                    else
                    {
                        phieudv.SoPhieuGiaCong = 0;
                    }
                    if (txtNgayLap.Text.CompareTo("") != 0)
                    {
                        phieudv.NgayLap = txtNgayLap.Text;
                    }
                    else
                    {
                        phieudv.NgayLap = " ";
                    }

                    if (txtTongTien.Text.CompareTo("") != 0)
                    {
                        phieudv.TongTien = Decimal.Parse(txtTongTien.Text);
                    }
                    else
                    {
                        phieudv.TongTien = 0;
                    }

                    dataGridView.DataSource = phieugc_bus.Search(phieudv);
                }
                catch (FormatException ex) { }
                //catch (Exception ex2) { }
            }
            else
            {
                MessageBox.Show("Nhập ngày sai. Vui lòng nhập theo dạng : 2016/5/31");
            }
        }
Ejemplo n.º 7
0
        public List <PhieuGiaCong_DTO> Search(PhieuGiaCong_DTO phieu)
        {
            //DateTime t1 = phieugc.NgayLap;
            DateTime t1;

            DateTime.TryParse(phieu.NgayLap, out t1);
            var list = (from phieugc in vbdq.PHIEUGIACONGs
                        where (phieugc.SoPhieuGiaCong == phieu.SoPhieuGiaCong || phieu.SoPhieuGiaCong == 0) &&
                        (phieu.NgayLap.Contains(" ") || phieugc.NgayLap == t1) &&
                        (phieugc.TongTien == phieu.TongTien || phieu.TongTien == 0)
                        select new PhieuGiaCong_DTO
            {
                SoPhieuGiaCong = phieugc.SoPhieuGiaCong,
                NgayLap = phieugc.NgayLap.ToString(),
                TongTien = Decimal.Parse(phieugc.TongTien.ToString())
            });

            return(list.ToList());
        }
Ejemplo n.º 8
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            TextBox_readonly_false();
            try
            {
                PhieuGiaCong_DTO phieudv = new PhieuGiaCong_DTO();
                if (txtSoPhieugc.Text.CompareTo("") != 0)
                {
                    phieudv.SoPhieuGiaCong = Int16.Parse(txtSoPhieugc.Text);
                }
                else
                {
                    phieudv.SoPhieuGiaCong = 0;
                }
                if (txtNgayLap.Text.CompareTo("") != 0)
                {
                    phieudv.NgayLap = txtNgayLap.Text;
                }
                else
                {
                    phieudv.NgayLap = " ";
                }

                if (txtTongTien.Text.CompareTo("") != 0)
                {
                    phieudv.TongTien = Decimal.Parse(txtTongTien.Text);
                }
                else
                {
                    phieudv.TongTien = 0;
                }

                dataGridView.DataSource = phieugc_bus.Search(phieudv);
            }
            catch (FormatException ex) { }
            //catch (Exception ex2) { }
        }