예제 #1
0
        private void btTra_sach_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < ds_PM.count(); i++)
            {
                if (tb_MDG_tra.Text == ds_PM[i].Ma_doc_gia)
                {
                    Phieutra b = new Phieutra(ds_PM[i].Ma_phieu_muon, ds_PM[i].Ma_doc_gia, ds_PM[i].Ngay_muon,
                                              ds_PM[i].Ngay_hen_tra, DateTime.Now, ds_PM[i].Ma_sach_1, ds_PM[i].Ma_sach_2);
                    ds_PT.add(b);
                    PHIEUTRA pt = new PHIEUTRA();
                    pt.MAPHIEUMUON = ds_PM[i].Ma_phieu_muon;
                    pt.NGAYTRA     = DateTime.Now;
                    a.PHIEUTRAs.InsertOnSubmit(pt);
                    a.SubmitChanges();
                    TimeSpan TG = b.Ngay_tra - b.Ngay_hen_tra;
                    if (TG.Days > 30)
                    {
                        MessageBox.Show("Tra qua han 1 thang\nTien phat: 20000VND");
                    }
                    break;
                }
            }

            loadlistPT();
            add_lvSach();
        }
예제 #2
0
        private void nap_du_lieu_PT()
        {
            for (int i = ds_PT.count() - 1; i >= 0; i--)
            {
                ds_PT.removeat(i);
            }
            var c = (from PM in a.PHIEUMUONs
                     join PT in a.PHIEUTRAs on PM.MAPHIEUMUON equals PT.MAPHIEUMUON
                     join CTPM in a.CTPMs on PM.MAPHIEUMUON equals CTPM.MAPHIEUMUON
                     join DG in a.DOCGIAs on PM.MADOCGIA equals DG.MADOCGIA
                     orderby PM.MAPHIEUMUON ascending
                     select new
            {
                MaPM = PM.MAPHIEUMUON,
                MaDG = PM.MADOCGIA,
                Ngaymuon = PM.NGAYMUON,
                NgayHentra = PM.NGAYHENTRA,
                NgayTra = PT.NGAYTRA,
                ma_sach = CTPM.MASACH,
            });

            foreach (var tmp in c)
            {
                Phieutra a = new Phieutra(tmp.MaPM, tmp.MaDG, tmp.Ngaymuon, tmp.NgayHentra, tmp.NgayTra, tmp.ma_sach, "");
                ds_PT.add(a);
            }
            for (int i = 0; i < ds_PT.count() - 1; i++)
            {
                if (ds_PT[i].Ma_phieu_muon.Equals(ds_PT[i + 1].Ma_phieu_muon))
                {
                    ds_PT[i].Ma_sach_2 = ds_PT[i + 1].Ma_sach_1;
                    ds_PT.removeat(i + 1);
                }
            }
        }
예제 #3
0
 private void addlistviewPT(Phieutra a)
 {
     lvi = lvlDs_tra.Items.Add(a.Ma_doc_gia);
     lvi.SubItems.Add(a.Ma_phieu_muon);
     lvi.SubItems.Add(a.Ngay_muon.ToShortDateString());
     lvi.SubItems.Add(a.Ngay_hen_tra.ToShortDateString());
     lvi.SubItems.Add(a.Ngay_tra.ToShortDateString());
     lvi.SubItems.Add(a.Ma_sach_1);
     lvi.SubItems.Add(a.Ma_sach_2);
 }
 public void add(Phieutra a)
 {
     ds.Add(a);
 }