Ejemplo n.º 1
0
        public void update(DTO_PhieuBaoHanh obj)
        {
            using (CellphoneComponentEntities db = new CellphoneComponentEntities())
            {
                var resultMaNhanVien = db.Database
                                       .SqlQuery <String>("select MaNhanVien from dbo.NhanVien where TenNhanVien = N'" + obj.TenNhanVien + "'")
                                       .FirstOrDefault();
                var resultMaHangHoa = db.Database
                                      .SqlQuery <String>("select MaHangHoa from dbo.HangHoa where TenHangHoa = N'" + obj.TenHangHoa + "'")
                                      .FirstOrDefault();
                PhieuBaoHanh item = new PhieuBaoHanh();
                item.MaPhieuBaoHanh = obj.MaPhieuBaoHanh;
                item.NgayLap        = obj.NgayLap;
                item.NgayGiao       = obj.NgayGiao;
                item.MaNhanVien     = resultMaNhanVien;
                item.TenKhachHang   = obj.TenKhachHang;
                item.SoDienThoai    = obj.SoDienThoai;
                item.TongTien       = obj.TongTien;
                item.GhiChu         = obj.GhiChu;
                item.DaGiao         = obj.DaGiao;
                item.NgayChinhSua   = obj.NgayChinhSua;
                item.MaHangHoa      = resultMaHangHoa;

                db.PhieuBaoHanhs.Attach(item);
                db.Entry(item).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public void delete(String id)
 {
     using (CellphoneComponentEntities db = new CellphoneComponentEntities())
     {
         PhieuBaoHanh pbh = (from item in db.PhieuBaoHanhs
                             where item.MaPhieuBaoHanh == id
                             select item).SingleOrDefault();
         db.PhieuBaoHanhs.Remove(pbh);
         db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void XoaPhieuBaoHanh(PhieuBaoHanh ex)
 {
     KetNoi.ExecuteReader(@"Update PhieuBaoHanh Set TrangThai=N'0' Where MaPBH=N'" + ex.MaPBH + "'");
 }
Ejemplo n.º 4
0
 public void Update_PBH(PhieuBaoHanh ex)
 {
     KetNoi.ExecuteReader(@"update PhieuBaoHanh Set Where MaPBH=N'" + ex.MaPBH + "'");
 }
Ejemplo n.º 5
0
 public void ThemPBH(PhieuBaoHanh ex)
 {
     KetNoi.ExecuteReader(@"Insert Into PhieuBaoHanh Values(N'" + ex.MaPBH + "',N'" + ex.MaKH + "',N'" + ex.MaNV + "','" + ex.NgayLap + "','" + ex.NgayLayHang + "',N'" + ex.TrangThai + "')");
 }