private void Frm_desk_Load(object sender, EventArgs e) { try { lb_Name.Text = deskResult.Name; lb_Type.Text = StaticStr.GetStatusEnum(deskResult.DeskStatus).ToEnumDescription(); } catch (Exception ex) { Msg.ShowErrorMsg(ex); } }
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"; } } }
private void ViewDetails() { try { ColumnHeader clh; lv_desk.Clear(); lv_desk.View = View.Details;//设置视图为详细信息 clh = new ColumnHeader(); clh.Text = "图标"; clh.Width = 120; clh.TextAlign = HorizontalAlignment.Center; lv_desk.Columns.Add(clh); clh = new ColumnHeader(); clh.Text = "桌台名称"; clh.Width = 200; clh.TextAlign = HorizontalAlignment.Center; lv_desk.Columns.Add(clh); clh = new ColumnHeader(); clh.Text = "桌台状态"; clh.Width = 100; clh.TextAlign = HorizontalAlignment.Center; lv_desk.Columns.Add(clh); //clh = new ColumnHeader(); //clh.Text = "开台时间"; //clh.Width = 200; //clh.TextAlign = HorizontalAlignment.Center; //lv_desk.Columns.Add(clh); //clh = new ColumnHeader(); //clh.Text = "顾客人数"; //clh.Width = 100; //clh.TextAlign = HorizontalAlignment.Center; //lv_desk.Columns.Add(clh); //clh = new ColumnHeader(); //clh.Text = "服务员"; //clh.Width = 100; //clh.TextAlign = HorizontalAlignment.Center; //lv_desk.Columns.Add(clh); clh = new ColumnHeader(); clh.Text = "备注"; clh.Width = 200; clh.TextAlign = HorizontalAlignment.Center; lv_desk.Columns.Add(clh); ClientServicesProxy proxys = new ClientServicesProxy(); deskResultList = proxys.Find(new tb_Desk()); var deskTypeList = proxys.Find(new tb_DeskType()); if (deskResultList.IsNotNull() && deskTypeList.IsNotNull()) { var query = from d in deskResultList join t in deskTypeList on d.TypeId equals t.Id.ToString() select new { d.Id, d.Name, d.Status, d.ShopId, d.DeskStatus, d.Remarks, }; foreach (var item in query) { ListViewItem lv = new ListViewItem(item.Id); var em = StaticStr.GetStatusEnum(item.DeskStatus); lv.ImageIndex = em.GetHashCode() - 3; lv.SubItems.Add(item.Name); lv.SubItems.Add(em.ToEnumDescription()); lv.SubItems.Add(item.Remarks); lv_desk.Items.Add(lv); } } } catch (Exception ex) { Msg.ShowErrorMsg(ex); } }
/// <summary> /// 根据桌台使用情况,来插入不同的图片 /// </summary> /// <param name="rzt">表示桌台号</param> /// <param name="sy">表示桌台使用情况</param> private void AddItems(string key, string value, string DeskStatus) { var em = StaticStr.GetStatusEnum(DeskStatus); lv_desk.Items.Add(key, value, em.GetHashCode() - 3); }