It looks like you're new here. If you want to get involved, click one of these buttons!
-(NSMutableArray *) getNowOffers
{
NSMutableArray *nowOffers = [[NSMutableArray alloc] init];
FMDatabase *db = [FMDatabase databaseWithPath:[Utility getDatabasePath]];
[db open];
[db setLogsErrors: TRUE];
[db setTraceExecution: TRUE];
[self getTimeAndDate];
FMResultSet *results = [db executeQuery:@\"select s.id as i, s.description as offerdescription,r.id, r.logo, s.title as name from restaurant r, specialoffer s where r.id=s.restaurant_id and r.id = (:rest) and case (:weekDay) when 1 then s.sun_start < (:currentTime) and s.sun_end > (:currentTime) and sun_valid='Y' when 2 then s.mon_start < (:currentTime) and s.mon_end > (:currentTime) and mon_valid='Y' when 3 then s.tue_start < (:currentTime) and s.tue_end > (:currentTime)and tue_valid='Y' when 4 then s.wed_start < (:currentTime) and s.wed_end > (:currentTime) and wed_valid='Y' when 5 then s.thu_start < (:currentTime) and s.thu_end > (:currentTime) and thu_valid='Y' when 6 then s.fri_start < (:currentTime) and s.fri_end > (:currentTime) and fri_valid='Y' when 7 then s.sat_start < (:currentTime) and s.sat_end > (:currentTime) and sat_valid='Y' end order by r.id\" withParameterDictionary:daytimeDictionary];
while([results next])
{
if ([results stringForColumn:@\"name\"] == NULL) {
offerShortDescription = @\"No Offers Available\";
} else {
offerShortDescription = [results stringForColumn:@\"name\"];
}
offerFullDescription = [results stringForColumn:@\"offerdescription\"];
[nowOffers addObject:offerFullDescription];
[nowOffers addObject:offerShortDescription];
}
[db close];
return nowOffers;
}
-(void) loadOffers {
//create table
NSString *html = @\"<html><body leftmargin='0px' topmargin='0px' marginwidth='0px' marginheight='0px'><table width='100%' style='border: 0px; padding:2px; spacing:1px'>\";
NSMutableString *html2 = [NSMutableString stringWithFormat:@\"<tr><td align='center' style='background-color:#ccffcc;font-size:large;'>OFFERS ON NOW</td><td style='background-color:#ffffff;'> %@</td></tr>\", offerShortDescription];
NSString *html3 = [html stringByAppendingString: html2];
NSMutableString *html4 = [NSMutableString stringWithFormat:@\"<td style='background-color:#ffffff;'>%@</td></tr>\", offerFullDescription];
NSString *html5 = [html3 stringByAppendingString: html4];
[webView loadHTMLString:html5 baseURL:[NSURL URLWithString:@\"\"]];
}