private void lv_desk_Click(object sender, EventArgs e) { if (lv_desk.SelectedItems.Count == 1) { string deskId = lv_desk.SelectedItems[0].SubItems[0].Name.Trim(); var deskResult = deskResultList.Find(n => n.Id.IsEquals(deskId)); var deskTypeResult = deskTypeResultList.Find(n => n.Id.IsEquals(deskResult.TypeId)); switch (StaticStr.GetStatusEnum(deskResult.DeskStatus)) { case StatusEnum.Normal: FrmOrder frm = new FrmOrder(); frm.deskResult = deskResult; frm.deskTypeResult = deskTypeResult; frm.ShowDialog(); break; case StatusEnum.Reserved: Frm_Yuding reserved = new Frm_Yuding(); reserved.deskResult = deskResult; reserved.ShowDialog(); break; case StatusEnum.Using: Frm_JZ usings = new Frm_JZ(); usings.deskResult = deskResult; usings.ShowDialog(); break; case StatusEnum.Clean: Frm_desk clean = new Frm_desk(); clean.deskResult = deskResult; clean.ShowDialog(); break; case StatusEnum.Malfunction: Frm_desk malfunction = new Frm_desk(); malfunction.deskResult = deskResult; malfunction.ShowDialog(); break; case StatusEnum.Unknown: Frm_desk unknown = new Frm_desk(); unknown.deskResult = deskResult; unknown.ShowDialog(); break; } //查询桌台消费信息 lv_info.Items.Clear(); toolStripLabel3.Text = deskResult.Name; var deskXSList = deskXSResultList.FindAll(n => n.XS_DeskName.IsEquals(deskId)); foreach (tb_DeskXS item in deskXSList) { ListViewItem lv = new ListViewItem(item.XS_goodsName); lv.SubItems.Add(item.XS_dj); lv.SubItems.Add(item.XS_Sum); lv.SubItems.Add(item.XS_allprice.ToString()); lv.SubItems.Add(item.XS_sj.ToString()); lv.SubItems.Add(item.Open_Waiter); lv.SubItems.Add(item.beizhu); lv_info.Items.Add(lv); } if (deskResult.IsNotNull() && deskResult.DeskStatus.IsEquals(StatusEnum.Using)) { //显示时间 var operResult = openResultList.Find(n => n.DeskId.IsEquals(deskId)); if (operResult.IsNotNull()) { LB_ktsj.Text = operResult.CreateTime.ToString(StaticStr.MM_dd_HH_mm); LB_YCNum.Text = operResult.CustomersNumber.ToString(); } var deskXSList2 = deskXSList.FindAll(n => n.XS_DeskName.IsEquals(deskId)); if (deskXSList2.IsNotNull()) { LB_money.Text = "¥" + deskXSList2.Sum(n => n.XS_allprice); } else { LB_money.Text = "¥0.00"; } } else { LB_YCNum.Text = "0"; LB_ktsj.Text = "—"; LB_yysj.Text = "—"; LB_money.Text = "¥0.00"; } } }
void TypeValidation(string typeName) { try { if (lv_desk.SelectedItems.Count == 1) { ClientServicesProxy proxys = new ClientServicesProxy(); tb_Desk deskInfoResult = proxys.Find(new tb_Desk { Id = lv_desk.SelectedItems[0].SubItems[0].Name.Trim() }).FirstOrDefault(); if (deskInfoResult.IsNotNull()) { if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Using)) { MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Using.ToEnumDescription())); } else if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Malfunction)) { MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Malfunction.ToEnumDescription())); } else if (deskInfoResult.DeskStatus.IsEquals(StatusEnum.Clean)) { MessageBox.Show(string.Format("此桌台{0}!无法开台", StatusEnum.Clean.ToEnumDescription())); } else { if (typeName.IsEquals("顾客开单")) { ///查询桌台类型 FrmOrder frmopen = new FrmOrder(); //frmopen = lv_desk.SelectedItems[0].SubItems[0].Name.Trim(); //deskInfoResult.TypeId = "GetDTType"; //deskInfoResult = proxys.Find(deskInfoResult).FirstOrDefault(); //frmopen.type = deskInfoResult.TypeId; frmopen.ShowDialog(); } else if (typeName.IsEquals("顾客点菜")) { if (frmxf == null || frmxf.IsDisposed) { frmxf = new Frm_XF(); frmxf.Rname = lv_desk.SelectedItems[0].SubItems[0].Name.Trim(); frmxf.ShowDialog(); } else { frmxf.ShowDialog(); } } else if (typeName.IsEquals("顾客结账")) { Frm_JZ frmjz = new Frm_JZ(); frmjz.Rname = lv_desk.SelectedItems[0].SubItems[0].Name.Trim(); frmjz.ShowDialog(); } } } } else { Msg.ShowErrorMsg("请选择桌台"); } } catch (Exception ex) { Msg.ShowErrorMsg(ex); } }