Beispiel #1
0
 public ListTheKho(int stt, THEKHO TK)
 {
     STT       = stt + "";
     MaThe     = TK.MaTheKho;
     MaMH      = TK.MaMH;
     TenMH     = TK.MATHANG.TenMH;
     NguoiLap  = TK.NGUOIDUNG.HoTen;
     NgayLap   = TK.NgayLap.ToString("dd/MM/yyyy");
     SLTonGian = TK.MATHANG.SoLuongTonGian + "";
     SLTonKho  = TK.SoLuongTonKho + "";
 }
Beispiel #2
0
 public static int add(TheKho thekho)
 {
     try
     {
         using (EntitiesDataContext db = new EntitiesDataContext())
         {
             THEKHO tk;
             tk = (from s in db.THEKHOs
                   where s.masosach.Equals(thekho.MaSoSach) &&
                   s.ngayghi.Equals(thekho.NgayGhi)
                   select s).SingleOrDefault();
             if (tk != null)
             {
                 tk.soluong = thekho.SoLuong;
                 db.SubmitChanges();
                 return(1);
             }
             else
             {
                 tk = new THEKHO()
                 {
                     masosach = thekho.MaSoSach,
                     soluong  = thekho.SoLuong,
                     ngayghi  = thekho.NgayGhi
                 };
                 db.THEKHOs.InsertOnSubmit(tk);
                 db.SubmitChanges();
                 return(1);
             }
         }
     }
     catch
     {
         return(0);
     }
 }
 public TheKho(THEKHO thekho, SACH sach)
     : this(thekho)
 {
     Sach = new Sach(sach);
 }
 public TheKho(THEKHO thekho)
 {
     MaSoSach = thekho.masosach;
     SoLuong  = thekho.soluong;
     NgayGhi  = thekho.ngayghi;
 }