点菜系统程序副本Word格式.docx
- 文档编号:3742183
- 上传时间:2023-05-02
- 格式:DOCX
- 页数:14
- 大小:24.17KB
点菜系统程序副本Word格式.docx
《点菜系统程序副本Word格式.docx》由会员分享,可在线阅读,更多相关《点菜系统程序副本Word格式.docx(14页珍藏版)》请在冰点文库上搜索。
YES];
if(!
[dbtableExists:
groupTable"
]){[dbexecuteUpdate:
createtablegroupTable(group_idintegerprimarykey,kindtext,nametext,picNametext,highPicNametext)"
menuTable"
createtablemenuTable(menu_idintegerprimarykey,groupIDinteger,iKindtext,nametext,priceinteger,unittext,detailtext,picNametext)"
myMenuTable"
createtablemyMenuTable(myMenu_idintegerprimarykey,myMenuNametext,myMenuPriceinteger,myMenuKindtext,myMenuDealNumtext)"
historyMenuTable"
createtablehistoryMenuTable(historyMenu_idintegerprimarykey,datetext,hourtext,roomNumtext)"
markMenuTable"
createtablemarkMenuTable(markMenu_idintegerprimarykey,datetext,hourtext,roomNumtext,myMenuNametext,myMenuPriceinteger,myMenuKindtext,myMenuDealNumtext)"
}[dbclose];
}//保存数据+(void)saveWithGroup:
(Group*)group{if(!
]){[selfcreatTable];
}FMResultSet*result=[dbexecuteQuery:
select*fromgroupTablewherekind=?
"
group.kind];
if([resultnext]){[resultclose];
return;
}[dbexecuteUpdate:
insertintogroupTable(kind,name,picName,highPicName)values(?
?
)"
group.kind,group.name,group.picName,group.highPicName];
[dbclose];
}+(NSArray*)getGroupTable{if(!
]){NSAssert(NO,@"
此表不存在"
}NSMutableArray*array=[[NSMutableArrayalloc]initWithCapacity:
0];
FMResultSet*result=[dbexecuteQuery:
select*fromgroupTable"
while([resultnext]){Group*group=[[Groupalloc]init];
group.name=[resultstringForColumn:
name"
group.kind=[resultstringForColumn:
kind"
group.picName=[resultstringForColumn:
picName"
group.highPicName=[resultstringForColumn:
highPicName"
[arrayaddObject:
group];
[resultclose];
returnarray;
}+(void)saveWithMenu:
(Menu*)menu{if(!
select*frommenuTablewherename=?
menu.name];
insertintomenuTable(groupID,iKind,name,price,unit,detail,picName)values(?
[NSStringstringWithFormat:
%d"
menu.groupID],menu.iKind,menu.name,[NSStringstringWithFormat:
menu.price],menu.unit,menu.detail,menu.picName];
}//更新我的菜单+(void)updateWithMyMenu:
(NSString*)myMenuDealNumMyMenuID:
(NSInteger)Id{if(!
]){NSAssert(NO,@"
updatemyMenuTablesetmyMenuDealNum=?
wheremyMenu_id=?
myMenuDealNum,[NSStringstringWithFormat:
Id]];
}//取出我的菜单+(NSArray*)getMyMenuTable{if(!
select*frommyMenuTable"
NSMutableArray*array=[[NSMutableArrayalloc]initWithCapacity:
while([resultnext]){MyMenu*myMenu=[[MyMenualloc]init];
myMenu.myMenuname=[resultstringForColumn:
myMenuname"
myMenu.myMenuPrice=[resultintForColumn:
myMenuPrice"
myMenu.myMenuKind=[resultstringForColumn:
myMenuKind"
myMenu.myMenuDealNum=[resultstringForColumn:
myMenuDealNum"
myMenu];
}[resultclose];
}//删除我的菜单+(void)deleteWithMyMenuTable{if(!
[dbopen]){NSAssert(NO,@"
deletefrommyMenuTable"
}//保存历史菜单+(void)saveWithHistoryMenu:
(HistoryMenu*)historyMenu{if(!
insertintohistoryMenuTable(date,hour,roomNum)values(?
historyMenu.dateStr,historyMenu.hourStr,historyMenu.roomNum];
}//取出历史菜单+(NSArray*)getHistoryMenuTable{if(!
select*fromhistoryMenuTable"
while([resultnext]){HistoryMenu*historyMenu=[[HistoryMenualloc]init];
historyMenu.hourStr=[resultstringForColumn:
hour"
historyMenu.dateStr=[resultstringForColumn:
date"
historyMenu.roomNum=[resultstringForColumn:
roomNum"
historyMenu];
}//删除历史菜单+(void)deleteWithHistoryMenuTable:
(NSString*)remarkDateandTime:
(NSString*)remarkTimeandRoom:
(NSString*)remarkRoom{if(!
deletefromhistoryMenuTablewheredate=?
andhour=?
androomNum=?
remarkDate,remarkTime,remarkRoom];
[dbexecuteUpdate:
deletefrommarkMenuTablewheredate=?
"
}5.2系统初始化的实现//首页//点击“点菜系统”动画进入第二个界面-(IBAction)dianCaiClick:
(id)sender{[UIViewbeginAnimations:
nilcontext:
nil];
[UIViewsetAnimationDuration:
1];
_twoPageView.alpha=1;
[UIViewcommitAnimations];
}//点击“网站首页”联网进入-(IBAction)webClick:
(id)sender{NSURL*url=[NSURLURLWithString:
[[UIApplicationsharedApplication]openURL:
url];
}//第二个界面//点击“中文”或“English”进入主页-(IBAction)chineseMenu:
(id)sender{CommendViewController*commendVC=[[CommendViewControlleralloc]init];
commendVC.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
[selfpresentViewController:
commendVCanimated:
YEScompletion:
}//点击“返回”进入首页-(IBAction)goBack:
_twoPageView.alpha=0;
}//点击“历史菜单”模态进入历史菜单界面-(IBAction)historyMenu:
(id)sender{HistoryMenuViewController*historyMenuVC=[[HistoryMenuViewControlleralloc]init];
historyMenuVC.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
historyMenuVCanimated:
}
5.3点菜功能的实现
使用了iphone中一个APIAVAudioPlayer来实现了音乐的播放,切换,拖动播放,另外界面上能调整音量,快进等。
主要代码如下//点击“点菜”
-(IBAction)orderFoodBtnClick:
(id)sender{//把所点菜品信息放入数据库中MyMenu*myMenu=[[MyMenualloc]init];
myMenu.myMenuname=[_middleNameArrayobjectAtIndex:
_currentImgIndex];
myMenu.myMenuPrice=[[_middlePriceArrayobjectAtIndex:
_currentImgIndex]intValue];
myMenu.myMenuKind=[_iKindAryobjectAtIndex:
_sectionCurrentIndex];
myMenu.myMenuDealNum=@"
1"
;
//判断所点菜品是否已经点过if([MenuDataBasesaveWithmyMenu:
myMenu]){//如果该菜已经点过不需再点出现提示已点过此菜UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:
提示"
message:
已点过此菜"
delegate:
selfcancelButtonTitle:
取消"
otherButtonTitles:
[alertshow];
}//如果该菜没点提示点菜成功UIAlertView*alert=[[UIAlertViewalloc]initWithTitle:
点菜成功"
nildelegate:
确定"
_app.kindNum++;
//"
已点种类"
_kindNumLabel.text=[NSStringstringWithFormat:
_app.kindNum];
5.4菜单列表的实现
通过iphone自带的控件UITableView,将菜单列表展现在cell上,点击使用的代理模式进行回调。
主要代码如下
#pragmamark-UITableViewDataSourse//菜品列表行数-(NSInteger)tableView:
(UITableView*)tableViewnumberOfRowsInSection:
(NSInteger)section{if(tableView==_barTableVi){return_app.groupArray.count;
}elseif(tableView==_commendMenuTableVi){if(_isOpen[section]){return_middleNameArray.count;
}else{return0;
}}return0;
//给每个cell数据
-(UITableViewCell*)tableView:
(UITableView*)tableViewcellForRowAtIndexPath:
(NSIndexPath*)indexPath{if(tableView==_barTableVi){staticNSString*cellIndentifier=@"
UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:
cellIndentifier];
cell){cell=[[UITableViewCellalloc]initWithStyle:
UITableViewCellStyleDefaultreuseIdentifier:
cell.selectionStyle=UITableViewCellSelectionStyleNone;
}cell.imageView.image=[UIImageimageNamed:
[[_app.groupArrayobjectAtIndex:
indexPath.row]picName]];
cell.imageView.highlightedImage=[UIImageimageNamed:
indexPath.row]highPicName]];
if(indexPath.row==_app.cellValue){cell.imageView.image=[UIImageimageNamed:
}returncell;
}elseif(tableView==_commendMenuTableVi){staticNSString*cellIndencifier=@"
cellIndencifier];
UITableViewCellStyleValue1reuseIdentifier:
}cell.textLabel.text=[_middleNameArrayobjectAtIndex:
indexPath.row];
UIImageView*imgVi=[[UIImageView
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 点菜 系统 程序 副本
![提示](https://static.bingdoc.com/images/bang_tan.gif)