示例#1
0
        private void bntTab1Save_Click(object sender, EventArgs e)
        {
            if (grvCreateBrorrow.RowCount <= 0)
            {
                MessageBox.Show("Không có bản ghi nào để tạo phiếu mượn", "Cảnh bảo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (MessageBox.Show("Tạo phiếu mượn tài liệu và in phiếu mượn tài liệu", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DataTable   sourceTable = grcCreateBrorrow.DataSource as DataTable;
                PhieuMuonDb phieuMuonDb = new PhieuMuonDb();
                phieuMuonDb.Id_NhanVien = UcManagerMember.Home.LoginUser.Id;
                phieuMuonDb.Id_BanDoc   = Int32.Parse(txtMemberId.Text);
                phieuMuonDb.GhiChu      = "";
                phieuMuonDb.Id          = pmBLL.ThemPhieuMuon(phieuMuonDb);

                //chi tiet phieu muon
                List <ChiTietPhieuMuonDb> lstChiTietPhieuMuonDb = new List <ChiTietPhieuMuonDb>();
                for (int i = 0; i < sourceTable.Rows.Count; i++)
                {
                    ChiTietPhieuMuonDb ctpm = new ChiTietPhieuMuonDb();
                    ctpm.Id_PhieuMuon = phieuMuonDb.Id;
                    ctpm.Id_TaiLieu   = Int32.Parse(sourceTable.Rows[i]["ID"].ToString());
                    ctpm.HanTra       = Common.addDay(Int32.Parse(sourceTable.Rows[i]["SoNgayMuon"].ToString()));
                    ctpm.MoTa         = "";
                    ctpm.SoLuong      = 1;// mac dinh muon 1 cuon duy nhat
                    ctpm.TrangThai    = Constants.CT_PHIEUMUON_TRANGTHAI.DANG_MUON;
                    lstChiTietPhieuMuonDb.Add(ctpm);
                }

                pmBLL.ThemChiTietPhieuMuon(lstChiTietPhieuMuonDb);
                MessageBox.Show("Đã thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                removeDataTab1();
            }
        }
示例#2
0
 public ucDialogBill(ucManagerMember ucManagerMember)
 {
     InitializeComponent();
     this.UcManagerMember = ucManagerMember;
     this.memberId        = ucManagerMember.IdMemberSelect;
     this.pmBLL           = new PhieuMuonBLL();
     this.pm    = new PhieuMuonDb();
     this.bdBll = new MemberBLL();
     setDataInfo(memberId);
 }
示例#3
0
 public int ThemPhieuMuon(PhieuMuonDb pm)
 {
     try
     {
         String sql = "INSERT INTO PhieuMuon(NgayMuon,GhiChu,ID_BanDoc,ID_NhanVien) "
                      + " VALUES(@NgayMuon,@GhiChu,@ID_BanDoc,@ID_NhanVien);SELECT SCOPE_IDENTITY();";
         return(dpro.InsertGenId(sql,
                                 new DatabaseParamCls[] {
             new DatabaseParamCls("NgayMuon", DateTime.Now),
             new DatabaseParamCls("GhiChu", pm.GhiChu),
             new DatabaseParamCls("Id_BanDoc", pm.Id_BanDoc),
             new DatabaseParamCls("Id_NhanVien", pm.Id_NhanVien),
         }));
     }
     catch (Exception e)
     {
         throw e;
     }
     return(-1);
 }
示例#4
0
 public int ThemPhieuMuon(PhieuMuonDb pm)
 {
     return(pmDAL.ThemPhieuMuon(pm));
 }