示例#1
0
        private void btnTiepNhanSach_Click(object sender, EventArgs e)
        {
            PhieuPhats phieu = new PhieuPhats();

            phieu.MaPhieuPhat   = txtMaPP.Text;
            phieu.MaDocGia      = txtMaDocGia.Text;
            phieu.HoTenDocGia   = txtHoTen.Text;
            phieu.TienNo        = txtTienNo.Text;
            phieu.TienThu       = txtTienThu.Text;
            phieu.ConLai        = txtConLai.Text;
            phieu.NgayGhiNhan   = dtNgayGhiNhan.Text;
            phieu.NguoiTiepNhan = cbNguoiTiepNhan.Text;
            List <PhieuPhats> ds = pp.LayDanhPhieuPhat();
            int dem = 0;

            for (int i = 0; i < ds.Count(); i++)
            {
                if (ds[i].MaPhieuPhat == txtMaPP.Text)
                {
                    dem++;
                }
            }
            if (dem == 0)
            {
                pp.savePhieuPhat(phieu);
                ReLoadFrom();
            }
            else
            {
                MessageBox.Show("Nhập đầy đủ thông tin rồi click thêm", "Thông báo");
                ReLoadFrom();
            }
        }
示例#2
0
        private void btnSua_Click(object sender, EventArgs e)
        {
            PhieuPhats phieu = new PhieuPhats();

            phieu.MaPhieuPhat   = txtMaPP.Text;
            phieu.MaDocGia      = txtMaDocGia.Text;
            phieu.HoTenDocGia   = txtHoTen.Text;
            phieu.TienNo        = txtTienNo.Text;
            phieu.TienThu       = txtTienThu.Text;
            phieu.ConLai        = txtConLai.Text;
            phieu.NgayGhiNhan   = dtNgayGhiNhan.Text;
            phieu.NguoiTiepNhan = cbNguoiTiepNhan.Text;
            pp.removePhieu(txtMaPP.Text);
            pp.savePhieuPhat(phieu);
            ReLoadFrom();
        }
示例#3
0
        public void savePhieuPhat(PhieuPhats nv)
        {
            XDocument doc    = XDocument.Load(nameFile);
            XElement  school = doc.Element(TITTLE_PHIEUPHATS);

            school.Add(new XElement(TITTLE_PHIEUPHAT,
                                    new XElement(MaPhieuPhat, nv.MaPhieuPhat),
                                    new XElement(HoTenDocGia, nv.HoTenDocGia),
                                    new XElement(MaDocGia, nv.MaDocGia),
                                    new XElement(TienNo, nv.TienNo),
                                    new XElement(TienThu, nv.TienThu),
                                    new XElement(ConLai, nv.ConLai),
                                    new XElement(NgayGhiNhan, nv.NgayGhiNhan),
                                    new XElement(NguoiTiepNhan, nv.NguoiTiepNhan)

                                    ));
            doc.Save(nameFile);
        }