public static int add(DaiLy daily)
 {
     try
     {
         using (EntitiesDataContext db = new EntitiesDataContext())
         {
             DAILY dl;
             dl = (from d in db.DAILies
                   where d.masodaily.Equals(daily.MaSoDaiLy)
                   select d).SingleOrDefault();
             if (dl != null) return 0; //Nếu đại lý đã tồn tại
             dl = new DAILY()
             {
                 ten = daily.TenDaiLy,
                 diachi = daily.DiaChi,
                 sodienthoai = daily.SoDienThoai,
                 sotaikhoan = daily.SoTaiKhoan,
                 nganhang = daily.NganHang,
                 masonguoidung = daily.MaSoNguoiDung
             };
             db.DAILies.InsertOnSubmit(dl);
             db.SubmitChanges();
             return dl.masodaily;
         }
     }
     catch(Exception ex)
     {
         Console.WriteLine(ex.Message);
         return 0;
     }
 }
Exemplo n.º 2
0
 public DaiLy(DAILY daily)
 {
     MaSoDaiLy = daily.masodaily;
     TenDaiLy = daily.ten;
     DiaChi = daily.diachi;
     SoDienThoai = daily.sodienthoai;
     SoTaiKhoan = daily.sotaikhoan;
     TrangThai = daily.trangthai;
     MaSoNguoiDung = daily.masonguoidung;
     NganHang = daily.nganhang;
 }
 partial void DeleteDAILY(DAILY instance);
 partial void UpdateDAILY(DAILY instance);
 partial void InsertDAILY(DAILY instance);
Exemplo n.º 6
0
 public CongNoDaiLy(CONGNODAILY congno, DAILY daily, SACH sach)
     : this(congno,daily)
 {
     Sach = new Sach(sach);
 }
Exemplo n.º 7
0
 public CongNoDaiLy(CONGNODAILY congno, DAILY daily)
     : this(congno)
 {
     DaiLy = new DaiLy(daily);
 }
Exemplo n.º 8
0
 public HoaDonDaiLy(HOADONDAILY hoadon, DAILY daily)
     : this(hoadon)
 {
     DaiLy = new DaiLy(daily);
 }
Exemplo n.º 9
0
 public NguoiDung(NGUOIDUNG nd, DAILY dl)
     : this(nd)
 {
     MaSoDaiLy = dl.masodaily;
     DaiLy = new DaiLy(dl);
 }
Exemplo n.º 10
0
 public PhieuXuat(PHIEUXUAT phieu, DAILY daily)
     : this(phieu)
 {
     Daily = new DaiLy(daily);
 }