//顾客结账了 private void button3_Click(object sender, EventArgs e) { ListView lv = (ListView)tabMain.SelectedTab.Controls[0]; //房间对象 RoomInfo room = (RoomInfo)(tabMain.SelectedTab.Tag); if (lv.SelectedItems.Count <= 0) { msg.MsgDivShow("请选择要结账的餐桌", 1); return; } DeskInfo desk = (lv.SelectedItems[0].Tag as DeskInfo); //因为只允许单选,所以是tiems[0]; if (desk.DeskState == 0) //0如果是空闲的餐桌 { msg.MsgDivShow("请选择正在就餐的餐桌", 1); return; } OrderInfoBLL obll = new OrderInfoBLL(); object objOrderId = obll.GetOrderIdByDeskId(desk.DeskId); FrmGuestPay fgp = FrmGuestPay.Single(Convert.ToInt32(objOrderId), desk.DeskName, desk.DeskId); fgp.FormClosed += f_FormClosed; fgp.Show(); }
//增加消费 private void button2_Click(object sender, EventArgs e) { // ListView lv = (ListView)tabMain.SelectedTab.Controls[0]; //房间对象 RoomInfo room = (RoomInfo)(tabMain.SelectedTab.Tag); if (lv.SelectedItems.Count <= 0) { msg.MsgDivShow("请选择要增加消费的餐桌", 1); return; } DeskInfo desk = (lv.SelectedItems[0].Tag as DeskInfo); if (desk.DeskState == 0)//因为只允许单选,所以是tiems[0]; { msg.MsgDivShow("您选择的开单后的餐桌", 1); return; } //根据餐桌的id查询对应餐桌订单的id OrderInfoBLL obll = new OrderInfoBLL(); object objOrderId = obll.GetOrderIdByDeskId(desk.DeskId); FrmAddConsumption fac = FrmAddConsumption.Single(desk.DeskName, Convert.ToInt32(objOrderId)); fac.FormClosed += f_FormClosed; fac.Show(); }
public void SetText(object sender, EventArgs e) { //餐桌编号 var mea = e as MyEventArgs; var dk = mea.Obj as DeskInfo; labDeskName.Text = dk.DeskName; _dkId = dk.DeskId; //订单号 -> 根据DeskId查询OrderId var orderBLL = new OrderInfoBLL(); var orderId = orderBLL.GetOrderIdByDeskId(dk.DeskId); labOrderId.Text = orderId.ToString(); //消费总金额 -> 通过OrderId查询 var money = orderBLL.GetMoneyByOrderId(orderId); if (money != -1) { labMoney.Text = money.ToString(); lblMoney.Text = money.ToString(); } else { MessageBox.Show("查询订单消费失败"); } }
//增加消费 private void button2_Click(object sender, EventArgs e) { TabPage tp = tcin.TabPages[tcin.SelectedIndex]; //获取当前选中房间的名字 RoomInfo room = tp.Tag as RoomInfo; FrmEventArgs fea = new FrmEventArgs(); fea.Money = Convert.ToDecimal(room.RoomMinimunConsume); fea.Name = room.RoomName; //string roomName = room.RoomName; //最低消费 //获取当前选项卡中的listview控件 ListView lv = tp.Controls[0] as ListView; //判断是否有选中的餐桌 if (lv.SelectedItems.Count > 0) { //获取当前选中的餐桌 DeskInfo dk = lv.SelectedItems[0].Tag as DeskInfo; if (dk.DeskState == 1) { //fea.obj = dk; fea.Name = dk.DeskName;//餐桌的编号 //订单的id,根据餐桌的id查找订单的id OrderInfoBLL obll = new OrderInfoBLL(); int orderId = obll.GetOrderIdByDeskId(dk.DeskId); fea.Temp = orderId; FrmAddMoney fam = new FrmAddMoney(); this.evtAddMoney += new EventHandler(fam.SetText);//注册事件 if (this.evtAddMoney != null) { this.evtAddMoney(this, fea); } fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed); fam.ShowDialog(); } else { MessageBox.Show("请选择开单的餐桌"); } } else { MessageBox.Show("没选中"); } }
//结账按钮 private void button3_Click(object sender, EventArgs e) { TabPage tp = tcInFo.SelectedTab; //获取当前餐桌所在的房间的选项卡 RoomInfo r = tp.Tag as RoomInfo; //从tag中获取房间的对象==坑---名字,最低消费 ListView lv = tp.Controls[0] as ListView; //获取listview if (lv.SelectedItems.Count > 0) { ListViewItem lvt = lv.SelectedItems[0]; //获取当前listview中选中的项 DeskInfo dk = lvt.Tag as DeskInfo; //可以获取该选中的餐桌的编号还有id if (dk.DeskState == 1) { FrmBalance fb = new FrmBalance(); this.evtBalance += new EventHandler(fb.SetTxt);//传值 //获取要传递的参数后 显示开单的窗体 FrmEventArgs fea = new FrmEventArgs(); fea.Name = dk.DeskName; //餐桌的编号 fea.DkIdZ = dk.DeskId; //餐桌的id //这里必须要获取该餐桌的订单id===============坑 OrderInfoBLL obll = new OrderInfoBLL(); int orderId = obll.GetOrderIdByDeskId(dk.DeskId); //获取订单的id(当前餐桌) fea.Temp = orderId; //订单id传到消费窗体中 if (this.evtBalance != null) { this.evtBalance(this, fea); } //此窗体关闭后 一定要进行刷新. fb.FormClosed += new FormClosedEventHandler(fbl_FormClosed);//调用上面的方法 fb.ShowDialog(); } else { MessageBox.Show("请选择已经开单的餐桌"); } } else { MessageBox.Show("请看好目标后再下手"); } }
private void btnMoney_Click(object sender, EventArgs e) { var tp = tabc.SelectedTab; var lv = tp.Controls[0] as ListView; if (lv.SelectedItems.Count <= 0) { MessageBox.Show("请选中"); return; } //餐桌的状态 if ((lv.SelectedItems[0].Tag as DeskInfo).DeskState != 1) { MessageBox.Show("请选中已开单的餐桌"); return; } //注册事件 var fam = new FrmAddMoney(); evtFrmMoney += new EventHandler(fam.SetText); var mea = new MyEventArgs(); var dk = lv.SelectedItems[0].Tag as DeskInfo; mea.Name = dk.DeskName;//餐桌编号 var bll = new OrderInfoBLL(); //订单的id,选中的开单餐桌的当前订单 mea.Temp = bll.GetOrderIdByDeskId(dk.DeskId); //窗体传值 if (this.evtFrmMoney != null) { this.evtFrmMoney(this, mea); fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed); fam.ShowDialog(); } }