public string Them(NiemYetGiaInNhanhBDO entityBDO) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); //Của dapper p.Add("@Ten", entityBDO.Ten); p.Add("@DienGiai", entityBDO.DienGiai); p.Add("@IdHangKhachHang", entityBDO.IdHangKhachHang); p.Add("@IdBangGia", entityBDO.IdBangGia); p.Add("@SoTrangToiDa", entityBDO.SoTrangToiDa); p.Add("@ThuTu", entityBDO.ThuTu); p.Add("@KhongSuDung", entityBDO.KhongSuDung); p.Add("@DaySoLuongNiemYet", entityBDO.DaySoLuongNiemYet); p.Add("@LoaiBangGia", entityBDO.LoaiBangGia); p.Add("@DuocGomTrang", entityBDO.DuocGomTrang); p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.Output); //Excecute connection.Execute("dbo.spNiemYetGiaInNhanh_Them", p, commandType: CommandType.StoredProcedure); //xử lý id out entityBDO.Id = p.Get <int>("@id"); ///nếu cần có thể ///đặt return ở đay cũng được } return("Đã thêm"); }
public NiemYetGiaInNhanhBDO DocTheoId(int iD) { NiemYetGiaInNhanhBDO output = null; using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); p.Add("@id", iD); output = connection.QueryFirstOrDefault <NiemYetGiaInNhanhBDO>("dbo.spNiemYetGiaInNhanh_DocTheoId", p, commandType: CommandType.StoredProcedure);//Thử return(output); } }
public bool Sua(ref string thongDiep, NiemYetGiaInNhanhBDO entityBDO) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB))) { var p = new DynamicParameters(); //Của dapper p.Add("@id", entityBDO.Id); p.Add("@Ten", entityBDO.Ten); p.Add("@DienGiai", entityBDO.DienGiai); p.Add("@IdHangKhachHang", entityBDO.IdHangKhachHang); p.Add("@IdBangGia", entityBDO.IdBangGia); p.Add("@SoTrangToiDa", entityBDO.SoTrangToiDa); p.Add("@ThuTu", entityBDO.ThuTu); p.Add("@KhongSuDung", entityBDO.KhongSuDung); p.Add("@DaySoLuongNiemYet", entityBDO.DaySoLuongNiemYet); p.Add("@LoaiBangGia", entityBDO.LoaiBangGia); p.Add("@DuocGomTrang", entityBDO.DuocGomTrang); //Excecute connection.Execute("dbo.spNiemYetGiaInNhanh_SuaTheoId", p, commandType: CommandType.StoredProcedure); } thongDiep = "Đã sửa"; return(true); }
public bool Sua(ref string thongDiep, NiemYetGiaInNhanhBDO niemYetGiaBDO) { return(niemYetGiaInNhanhDAO.Sua(ref thongDiep, niemYetGiaBDO)); }
public string Them(NiemYetGiaInNhanhBDO niemYetGiaBDO) { return(niemYetGiaInNhanhDAO.Them(niemYetGiaBDO)); }