public bool insertBrand(DTO_NhanHieu nhanHieuDTO) { string query = "insert into NhanHieu(TenNhanHieu) values(@_TenNhanHieu)"; SqlParameter[] sqlParameters = new SqlParameter[1]; sqlParameters[0] = new SqlParameter("@_TenNhanHieu", SqlDbType.NVarChar); sqlParameters[0].Value = nhanHieuDTO.Name; return(conn.executeInsertQuery(query, sqlParameters)); }
public bool insertDevice(DTO_ThietBiSuaChua thietBiSuaChuaDTO) { string query = "insert into THIETBISUACHUA(TenThietBi, Model, MaNhanHieu) values(@_Ten,@_Model,@_BrandId)"; SqlParameter[] sqlParameters = new SqlParameter[3]; sqlParameters[0] = new SqlParameter("@_Ten", SqlDbType.NVarChar); sqlParameters[0].Value = thietBiSuaChuaDTO.Name; sqlParameters[1] = new SqlParameter("@_Model", SqlDbType.VarChar); sqlParameters[1].Value = thietBiSuaChuaDTO.Model; sqlParameters[2] = new SqlParameter("@_BrandId", SqlDbType.VarChar); sqlParameters[2].Value = thietBiSuaChuaDTO.BrandID.ToString(); return(conn.executeInsertQuery(query, sqlParameters)); }
public bool insertCustomer(DTO_KhachHang khachHangDTO) { string query = "insert into KhachHang(HoTen, DiaChi, SoDienThoai) values(@_HoTen, @_DiaChi, @_SDT)"; SqlParameter[] sqlParameters = new SqlParameter[3]; sqlParameters[0] = new SqlParameter("@_HoTen", SqlDbType.NVarChar); sqlParameters[0].Value = khachHangDTO.HoTen; sqlParameters[1] = new SqlParameter("@_DiaChi", SqlDbType.NVarChar); sqlParameters[1].Value = khachHangDTO.DiaChi; sqlParameters[2] = new SqlParameter("@_SDT", SqlDbType.VarChar); sqlParameters[2].Value = khachHangDTO.SDT; return(conn.executeInsertQuery(query, sqlParameters)); }
public bool insertRepairing(DTO_SuaChua repairDTO) { string query = "if exists (select * from YEUCAUSUACHUA where MaYeuCau = @_MaYeuCau and DaSuaChua = 0) begin insert into SUACHUA(MaYeuCau, NgayLap, TienCong, MoTaLoi) " + " values(@_MaYeuCau,@_NgayLap, @_TienCong, @_MoTaLoi ) update YEUCAUSUACHUA set DaSuaChua = 1 where MaYeuCau = @_MaYeuCau end "; SqlParameter[] sqlParameters = new SqlParameter[4]; sqlParameters[0] = new SqlParameter("@_MaYeuCau", SqlDbType.VarChar); sqlParameters[0].Value = repairDTO.requestID.ToString(); sqlParameters[1] = new SqlParameter("@_NgayLap", SqlDbType.VarChar); sqlParameters[1].Value = repairDTO.Date.ToString("MM-dd-yyyy"); sqlParameters[2] = new SqlParameter("@_TienCong", SqlDbType.VarChar); sqlParameters[2].Value = repairDTO.TienCong.ToString(); sqlParameters[3] = new SqlParameter("@_MoTaLoi", SqlDbType.NVarChar); sqlParameters[3].Value = repairDTO.MoTaLoi; return(conn.executeInsertQuery(query, sqlParameters)); }
public bool insertBoughtDevice(DTO_NhapThietBi nhapDTO) { string query = "insert into NHAPTHIETBI(MaYeuCau, TenThietBi, SoLuong, DonGia, NgayNhap) " + " values(@_MaYeuCau,@_TenThietBi, @_SoLuong, @_DonGia, @_NgayNhap)"; SqlParameter[] sqlParameters = new SqlParameter[5]; sqlParameters[0] = new SqlParameter("@_MaYeuCau", SqlDbType.VarChar); sqlParameters[0].Value = nhapDTO.RequestID.ToString(); sqlParameters[1] = new SqlParameter("@_TenThietBi", SqlDbType.NVarChar); sqlParameters[1].Value = nhapDTO.DeviceName; sqlParameters[2] = new SqlParameter("@_SoLuong", SqlDbType.VarChar); sqlParameters[2].Value = nhapDTO.Quantity.ToString(); sqlParameters[3] = new SqlParameter("@_DonGia", SqlDbType.VarChar); sqlParameters[3].Value = nhapDTO.UnitPrice.ToString(); sqlParameters[4] = new SqlParameter("@_NgayNhap", SqlDbType.VarChar); sqlParameters[4].Value = nhapDTO.Date.ToString("MM-dd-yyyy"); return(conn.executeInsertQuery(query, sqlParameters)); }
public bool insertRequest(DTO_YeuCauSuaChua yeucauDTO) { string query = "insert into YEUCAUSUACHUA(MaKH, NgayNhan, MaMonHang, SoLuong, MoTaTinhTrang, DaSuaChua, ChiTiet) " + " values(@_MaKH,@_NgayNhan,@_MaMonHang, @_SoLuong, @_MoTaTinhTrang, @_DaSuaChua, @_ChiTiet)"; SqlParameter[] sqlParameters = new SqlParameter[7]; sqlParameters[0] = new SqlParameter("@_MaKH", SqlDbType.VarChar); sqlParameters[0].Value = yeucauDTO.MaKH.ToString(); sqlParameters[1] = new SqlParameter("@_NgayNhan", SqlDbType.VarChar); sqlParameters[1].Value = yeucauDTO.NgayNhan.ToString("MM-dd-yyyy"); sqlParameters[2] = new SqlParameter("@_MaMonHang", SqlDbType.VarChar); sqlParameters[2].Value = yeucauDTO.MaMonHang.ToString(); sqlParameters[3] = new SqlParameter("@_SoLuong", SqlDbType.VarChar); sqlParameters[3].Value = yeucauDTO.SoLuong.ToString(); sqlParameters[4] = new SqlParameter("@_MoTaTinhTrang", SqlDbType.NVarChar); sqlParameters[4].Value = yeucauDTO.MoTaTinhTrang; sqlParameters[5] = new SqlParameter("@_DaSuaChua", SqlDbType.VarChar); sqlParameters[5].Value = yeucauDTO.DaSuaChua.ToString(); sqlParameters[6] = new SqlParameter("@_ChiTiet", SqlDbType.NVarChar); sqlParameters[6].Value = yeucauDTO.ChiTiet; return(conn.executeInsertQuery(query, sqlParameters)); }