public Data searchAll(Data data) { rating rating = new Rating_db(); Data db = new Data(); db.open(); Data result = db.select(@"SELECT * FROM profile WHERE latitude<@eastLatitude AND latitude>@westLatitude AND longitude<@northLongitude AND longitude>@southLongitude", data); result.getString("averageRating", rating. db.close(); return result; }
public bool checkUserRating(Data data) { Rating_db rating = new Rating_db(); if (rating.checkUserRating(data).Count > 0) { return true; } else { return false; } }
public Double getRatingThree(Data data) { Rating_db rating = new Rating_db(); if (Convert.ToInt32(data.getString("totalRating")) > 0) { return (double)rating.getRatingThree(data).Count / (double)Convert.ToDouble(data.getString("totalRating")) * 100; } else { return 0; } }
public Double averageRating(Data data) { Rating_db rating = new Rating_db(); int total = rating.totalRating(data).Count; if (total == 0) { return 0; } else { int value = Convert.ToInt32(data.getString("sum_rating")); double average = ((double)value / (double)(total * 5)) * 5; return average; } }
public bool update(Data data) { Rating_db rating = new Rating_db(); return rating.update(data); }
public int numPerRate(Data data, String value) { Rating_db rating = new Rating_db(); data.add("value", value); return rating.numPerRate(data).Count; }
public bool insert(Data data) { Rating_db rating = new Rating_db(); return rating.insert(data); }
public int getTotalRating(Data data) { Rating_db rating = new Rating_db(); return rating.getTotalRating(data).Count; }