private void btnItem_Click(object sender, EventArgs e) { CrystalButton btnItem = sender as CrystalButton; GoodsSetMeal goodsSetMealItem = btnItem.Tag as GoodsSetMeal; if (goodsSetMealItem != null) { if (IsGoodsSetMealItemInList(goodsSetMealItem)) { btnItem.BackColor = btnItem.DisplayColor; foreach (GoodsSetMeal item in _dicResultGoodsSetMeal[goodsSetMealItem.GroupNo]) { if (item.GoodsID == goodsSetMealItem.GoodsID && item.GroupNo == goodsSetMealItem.GroupNo) { _dicResultGoodsSetMeal[goodsSetMealItem.GroupNo].Remove(item); break; } } } else { btnItem.BackColor = Color.Black; if (_dicResultGoodsSetMeal.ContainsKey(goodsSetMealItem.GroupNo)) { _dicResultGoodsSetMeal[goodsSetMealItem.GroupNo].Add(goodsSetMealItem); } else { List <GoodsSetMeal> goodsSubItemList = new List <GoodsSetMeal>(); goodsSubItemList.Add(goodsSetMealItem); _dicResultGoodsSetMeal.Add(goodsSetMealItem.GroupNo, goodsSubItemList); } } } }
private void btnAddBigNumber_Click(object sender, EventArgs e) { if (curPayoffWay != null) { CrystalButton btn = sender as CrystalButton; string bigNumber = btn.Text.Substring(1); if (m_InputNumber.IndexOf('.') > 0) { if (m_InputNumber.EndsWith(".")) { int count = Convert.ToInt32(m_InputNumber.Substring(0, m_InputNumber.Length - 1)) + Convert.ToInt32(bigNumber); m_InputNumber = count.ToString(); } else { decimal count = Convert.ToDecimal(m_InputNumber) + Convert.ToDecimal(bigNumber); m_InputNumber = count.ToString("f2"); } } else { int count = Convert.ToInt32(m_InputNumber) + Convert.ToInt32(bigNumber); m_InputNumber = count.ToString(); } CalculateAllPrice(); } }
private void btnAdd_Click(object sender, EventArgs e) { if (curPayoffWay != null) { CrystalButton btn = sender as CrystalButton; if (m_InputNumber == "0" && !btn.Text.Equals(".")) { m_InputNumber = btn.Text; } else { //避免出现两个“.” if (btn.Text == "." && m_InputNumber.IndexOf('.') > 0) { return; } //现金只能有两位小数 if (btn.Text != "." && m_InputNumber.IndexOf('.') > 0 && m_InputNumber.Substring(m_InputNumber.IndexOf('.') + 1).Length >= 2) { return; } m_InputNumber += btn.Text; } if (!m_InputNumber.EndsWith(".")) { CalculateAllPrice(); } } }
private void GetPayoffButton() { foreach (PayoffWay payoff in ConstantValuePool.PayoffWayList) { CrystalButton btn = new CrystalButton(); btn.Name = payoff.PayoffID.ToString(); btn.Text = payoff.PayoffName; btn.Width = m_Width; btn.Height = m_Height; btn.BackColor = btn.DisplayColor = Color.Blue; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { float emSize = (float)btnStyle.FontSize; FontStyle style = FontStyle.Regular; btn.Font = new Font(btnStyle.FontName, emSize, style); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Tag = payoff; btn.Click += new System.EventHandler(this.btnPayoff_Click); payoffButtonList.Add(btn); } }
private void InitializeReasonButton() { int reasonCount = 0; foreach (Reason item in ConstantValuePool.ReasonList) { if (item.ReasonType == (int)ReasonItemType.DeleteItem) { reasonCount++; } } if (reasonCount > 0) { //判断每行显示多少列 int maxColumn = Convert.ToInt32(Math.Sqrt(Convert.ToDouble(reasonCount))); if (maxColumn * maxColumn < reasonCount) { maxColumn++; } //显示多少行 int perLine = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(reasonCount) / maxColumn)); //计算button长宽 int space = 6; int width = (this.pnlReason.Width - space * (maxColumn - 1)) / maxColumn; int height = (this.pnlReason.Height - space * (perLine - 1)) / perLine; int count = 1; int px = 0, py = 0; CrystalButton btn; foreach (Reason item in ConstantValuePool.ReasonList) { if (item.ReasonType == (int)ReasonItemType.DeleteItem) { btn = new CrystalButton(); btn.Name = item.ReasonID.ToString(); btn.Tag = item; btn.Text = item.ReasonName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.BackColor = Color.Blue; btn.DisplayColor = btn.BackColor; btn.Click += new System.EventHandler(this.btnReason_Click); this.pnlReason.Controls.Add(btn); count++; if (count > maxColumn) { px = 0; py += height + space; count = 1; } else { px += width + space; } } } } }
private void InitialOrderButton(IList <Order> orderList) { int maxColumn = 0; if (orderList.Count <= 5) { maxColumn = 1; } else if (orderList.Count > 5 && orderList.Count <= 10) { maxColumn = 2; } else { maxColumn = 3; } int width = (this.pnlContainer.Width - 12) / maxColumn; int height = Convert.ToInt32((this.pnlContainer.Height - 12) / Math.Ceiling((decimal)orderList.Count / maxColumn)); int count = 1; int px = 6, py = 6; foreach (Order order in orderList) { StringBuilder sbOrderInfo = new StringBuilder(); sbOrderInfo.Append("桌号:" + order.DeskName + "-" + order.SubOrderNo); sbOrderInfo.Append("\n"); sbOrderInfo.Append("人数:" + order.PeopleNum); sbOrderInfo.Append("\n"); sbOrderInfo.Append("消费金额:" + order.ActualSellPrice.ToString("N")); CrystalButton btnOrder = new CrystalButton(); btnOrder.BackColor = btnOrder.DisplayColor = Color.Olive; btnOrder.ForeColor = Color.White; btnOrder.Name = order.OrderID.ToString(); btnOrder.Text = sbOrderInfo.ToString(); btnOrder.Tag = order; btnOrder.Width = width; btnOrder.Height = height; btnOrder.Location = new Point(px, py); btnOrder.Click += new EventHandler(btnOrder_Click); this.pnlContainer.Controls.Add(btnOrder); count++; if (count > maxColumn) { px = 6; py += height; count = 1; continue; } px += width; } }
private void btnPayoff_Click(object sender, EventArgs e) { if (_curButton != null) { _curButton.BackColor = _curButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; btn.BackColor = ConstantValuePool.PressedColor; _curButton = btn; _curPayoffWay = btn.Tag as PayoffWay; }
private void btnCheckOut_Click(object sender, EventArgs e) { if (_prevPressedButton != null) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; if (btn == null) { return; } btn.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.CHECKOUT; _prevPressedButton = btn; }
private void btnNumber_Click(object sender, EventArgs e) { CrystalButton btn = sender as CrystalButton; if (btn == null) { return; } int index = _activeTextBox.SelectionStart; string text = _activeTextBox.Text; text = text.Insert(index, btn.Text); _activeTextBox.Text = text; //光标移动到下一位 _activeTextBox.Select(index + 1, 0); }
private void btnReason_Click(object sender, EventArgs e) { CrystalButton btn = sender as CrystalButton; m_CurrentReason = btn.Tag as Reason; if (m_PreviousBtn == null) { btn.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btn; } else { m_PreviousBtn.BackColor = m_PreviousBtn.DisplayColor; btn.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btn; } }
private void btnOrder_Click(object sender, EventArgs e) { CrystalButton btnOrder = sender as CrystalButton; m_Order = btnOrder.Tag as Order; if (m_PreviousBtn == null) { btnOrder.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btnOrder; } else { m_PreviousBtn.BackColor = m_PreviousBtn.DisplayColor; btnOrder.BackColor = ConstantValuePool.PressedColor; m_PreviousBtn = btnOrder; } }
private void btnPayoff_Click(object sender, EventArgs e) { foreach (CrystalButton button in payoffButtonList) { PayoffWay temp = button.Tag as PayoffWay; if (dic.ContainsKey(temp.PayoffID.ToString())) { button.BackColor = ConstantValuePool.PressedColor; } else { button.BackColor = button.DisplayColor; } } CrystalButton btn = sender as CrystalButton; btn.BackColor = ConstantValuePool.PressedColor; curPayoffWay = btn.Tag as PayoffWay; this.txtPayoff.Text = curPayoffWay.PayoffName + "(1:" + curPayoffWay.AsPay.ToString("f2") + ")"; if (dic.ContainsKey(curPayoffWay.PayoffID.ToString())) { OrderPayoff orderPayoff = dic[curPayoffWay.PayoffID.ToString()]; decimal totalPrice = orderPayoff.Quantity * orderPayoff.AsPay; if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon) { this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", orderPayoff.Quantity, totalPrice.ToString("f2")); } else { this.txtAmount.Text = string.Format("{0} 元", totalPrice.ToString("f2")); } } else { if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon) { this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", "0", "0.00"); } else { this.txtAmount.Text = string.Format("{0} 元", "0.00"); } } m_InputNumber = "0"; }
private void btnCutServiceFee_Click(object sender, EventArgs e) { CrystalButton btn = sender as CrystalButton; if (m_CutServiceFee) { m_CutServiceFee = false; btn.Text = "去服务费"; } else { m_CutServiceFee = true; btn.Text = "加服务费"; } //重新计算 CalculateOrderPrice(); txtReceAmount.Text = (m_ActualPayMoney + m_ServiceFee).ToString("f2"); }
private void btnTurnTable_Click(object sender, EventArgs e) { _deskName1St = string.Empty; _orderId1St = Guid.Empty; _firstDeskSingleOrder = false; if (_prevPressedButton != null) { _prevPressedButton.BackColor = _prevPressedButton.DisplayColor; } CrystalButton btn = sender as CrystalButton; if (btn == null) { return; } btn.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.CHANGE_DESK; _prevPressedButton = btn; }
private void DisplayGoodsSetMealButton() { pnlItem.Controls.Clear(); int space = 3; int width = (pnlItem.Width - 4 * space) / 5; int height = (pnlItem.Height - 4 * space) / 4; int px = 0, py = 0; int i = 0; for (int index = _itemPageIndex * 18; index < _currentGoodsSetMealList.Count; index++) { CrystalButton btn = new CrystalButton(); btn.Text = _currentGoodsSetMealList[index].GoodsName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.ForeColor = Color.White; btn.BackColor = btn.DisplayColor = Color.OrangeRed; if (IsGoodsSetMealItemInList(_currentGoodsSetMealList[index])) { btn.BackColor = Color.Black; } btn.Tag = _currentGoodsSetMealList[index]; btn.Click += new EventHandler(btnItem_Click); pnlItem.Controls.Add(btn); i++; px += width + space; if (i % 5 == 0) { px = 0; py += height + space; } } btnPageUp.Width = width; btnPageUp.Height = height; btnPageUp.Location = new Point(3 * (width + space), 3 * (height + space)); pnlItem.Controls.Add(btnPageUp); btnPageDown.Width = width; btnPageDown.Height = height; btnPageDown.Location = new Point(4 * (width + space), 3 * (height + space)); pnlItem.Controls.Add(btnPageDown); }
private void FormChoseMultiOrder_Load(object sender, EventArgs e) { if (m_OrderList != null && m_OrderList.Count > 0) { InitialOrderButton(m_OrderList); } if (m_DeskChange != null) { pnlBottom.Controls.Clear(); int px = 0, py = 5; int space = 10; int width = (this.pnlBottom.Width - 2 * space) / 3; int height = 43; CrystalButton btnMoveBill = new CrystalButton(); btnMoveBill.BackColor = Color.Teal; btnMoveBill.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular); btnMoveBill.ForeColor = System.Drawing.Color.White; btnMoveBill.Location = new Point(px, py); btnMoveBill.Name = "btnMoveBill"; btnMoveBill.Size = new Size(width, height); btnMoveBill.Text = "转台"; btnMoveBill.Click += new System.EventHandler(this.btnMoveBill_Click); this.pnlBottom.Controls.Add(btnMoveBill); px += width + space; CrystalButton btnMerge = new CrystalButton(); btnMerge.BackColor = Color.Teal; btnMerge.Font = new System.Drawing.Font("Microsoft YaHei", 12F, System.Drawing.FontStyle.Regular); btnMerge.ForeColor = System.Drawing.Color.White; btnMerge.Location = new Point(px, py); btnMerge.Name = "btnMerge"; btnMerge.Size = new Size(width, height); btnMerge.Text = "合并"; btnMerge.Click += new System.EventHandler(this.btnMerge_Click); this.pnlBottom.Controls.Add(btnMerge); px += width + space; btnCancel.Location = new Point(px, py); btnCancel.Size = new Size(width, height); this.pnlBottom.Controls.Add(btnCancel); } }
private void dataGirdViewExt1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dataGirdViewExt1.CurrentRow != null) { int selectIndex = dataGirdViewExt1.CurrentRow.Index; Guid goodsID = new Guid(dataGirdViewExt1.Rows[selectIndex].Cells["colGoodsID"].Value.ToString()); Goods goods = null; foreach (GoodsGroup goodsGroup in ConstantValuePool.GoodsGroupList) { if (goodsGroup.GoodsList != null) { foreach (Goods item in goodsGroup.GoodsList) { if (item.GoodsID == goodsID) { //修改当前品项组的值,为了读取可能存在的折扣 m_GoodsGroup.GoodsGroupID = goodsGroup.GoodsGroupID; m_GoodsGroup.GoodsGroupNo = goodsGroup.GoodsGroupNo; m_GoodsGroup.GoodsGroupName = goodsGroup.GoodsGroupName; m_GoodsGroup.GoodsGroupName2nd = goodsGroup.GoodsGroupName2nd; m_GoodsGroup.ButtonStyleID = goodsGroup.ButtonStyleID; m_GoodsGroup.GoodsList = goodsGroup.GoodsList; goods = item; break; } } if (goods != null) { break; } } } CrystalButton btn = new CrystalButton(); btn.Tag = goods; if (m_OrderAction != null) { m_OrderAction(btn, null); } } }
private void btnGroup_Click(object sender, EventArgs e) { CrystalButton btnGroup = sender as CrystalButton; List <GoodsSetMeal> temp = btnGroup.Tag as List <GoodsSetMeal>; if (temp != null) { _currentGoodsSetMealList = temp; } DisplayGoodsSetMealButton(); if (_itemPageIndex <= 0) { _itemPageIndex = 0; btnPageUp.Enabled = false; btnPageUp.BackColor = ConstantValuePool.DisabledColor; } if (_currentGoodsSetMealList.Count > 18 * (_itemPageIndex + 1)) { btnPageDown.Enabled = true; btnPageDown.BackColor = btnPageDown.DisplayColor; } }
private void UpdateDeskButtonInfo(CrystalButton btnDesk, DeskRealTimeInfo deskInfo) { if (btnDesk.InvokeRequired) { DelegateUpdateDeskButton myDelegate = new DelegateUpdateDeskButton(UpdateDeskButtonInfo); btnDesk.Invoke(myDelegate, new object[] { btnDesk, deskInfo }); } else { if (_currentFormActivate) { if (deskInfo == null) { BizDesk desk = btnDesk.Tag as BizDesk; if (desk != null) { desk.Status = (int)DeskButtonStatus.IDLE_MODE; desk.DeviceNo = string.Empty; btnDesk.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btnDesk.Text = desk.DeskName; } } else { btnDesk.BackColor = GetColorByStatus(deskInfo.DeskStatus, deskInfo.DeviceNo); if (deskInfo.IsSplitOrder) { btnDesk.Text = "**"; } else { btnDesk.Text = deskInfo.DeskName + "\n" + deskInfo.PeopleNum + "\n" + deskInfo.ConsumptionMoney.ToString("N"); } } } } }
private void DisplayGroupButton() { pnlGroup.Controls.Clear(); int space = 3; int width = (pnlGroup.Width - (_dicGoodsSetMealByGroup.Count - 1) * space) / _dicGoodsSetMealByGroup.Count; int height = pnlGroup.Height - space; int px = 0, py = 0; foreach (KeyValuePair <int, List <GoodsSetMeal> > item in _dicGoodsSetMealByGroup) { CrystalButton btn = new CrystalButton(); btn.Name = "button" + item.Key; btn.Text = item.Value[0].GroupName; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.ForeColor = Color.White; btn.BackColor = Color.DodgerBlue; btn.Tag = item.Value; btn.Click += new EventHandler(btnGroup_Click); pnlGroup.Controls.Add(btn); px += width + space; } }
private void InitializeRegionDeskButton() { //禁止引发Layout事件 this.pnlRegion.SuspendLayout(); this.pnlDesk.SuspendLayout(); this.SuspendLayout(); //动态加载区域控件 foreach (BizRegion region in ConstantValuePool.RegionList) { CrystalButton btn = new CrystalButton(); btn.Name = region.RegionID.ToString(); btn.Text = region.RegionName; btn.Width = region.Width; btn.Height = region.Height; btn.Location = new Point(region.PX, region.PY); btn.Tag = region; foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (region.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { btn.Font = new Font(btnStyle.FontName, (float)btnStyle.FontSize, FontStyle.Regular); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Click += new System.EventHandler(this.btnRegion_Click); if (_prevRegionButton == null) { _prevRegionButton = btn; _prevRegionButton.BackColor = ConstantValuePool.PressedColor; } this.pnlRegion.Controls.Add(btn); } //动态加载第一区域的桌况信息 BizRegion firstRegion = ConstantValuePool.RegionList[0]; _currentRegionId = firstRegion.RegionID; if (!_dicDeskInRegion.ContainsKey(_currentRegionId)) { List <CrystalButton> btnList = new List <CrystalButton>(); foreach (BizDesk desk in firstRegion.BizDeskList) { CrystalButton btn = new CrystalButton(); btn.Name = desk.DeskID.ToString(); btn.Text = desk.DeskName; btn.Width = desk.Width; btn.Height = desk.Height; btn.Location = new Point(desk.PX, desk.PY); btn.Tag = desk; btn.Font = new Font("Arial", ConstantValuePool.BizSettingConfig.FontSize, FontStyle.Regular); btn.ForeColor = Color.White; btn.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btn.Click += new System.EventHandler(this.btnDesk_Click); btnList.Add(btn); } _dicDeskInRegion.Add(firstRegion.RegionID, btnList); } foreach (CrystalButton btn in _dicDeskInRegion[firstRegion.RegionID]) { this.pnlDesk.Controls.Add(btn); } //恢复引发Layout事件 this.pnlRegion.ResumeLayout(false); this.pnlRegion.PerformLayout(); this.pnlDesk.ResumeLayout(false); this.pnlDesk.PerformLayout(); this.ResumeLayout(false); }
private void btnPayoff_Click(object sender, EventArgs e) { foreach (CrystalButton button in payoffButtonList) { PayoffWay payoffWay = button.Tag as PayoffWay; if (payoffWay != null) { button.BackColor = dic.ContainsKey(payoffWay.PayoffID.ToString()) ? ConstantValuePool.PressedColor : button.DisplayColor; } } CrystalButton btn = sender as CrystalButton; if (btn == null) { return; } curPayoffWay = btn.Tag as PayoffWay; if (curPayoffWay == null) { return; } btn.BackColor = ConstantValuePool.PressedColor; if (curPayoffWay.PayoffType == (int)PayoffWayMode.MembershipCard) { //屏蔽数字键盘 this.pnlNumericPad.Enabled = false; } else { this.pnlNumericPad.Enabled = true; } this.txtPayoff.Text = string.Format("{0}(1:{1})", curPayoffWay.PayoffName, curPayoffWay.AsPay.ToString("f2")); if (dic.ContainsKey(curPayoffWay.PayoffID.ToString())) { OrderPayoff orderPayoff = dic[curPayoffWay.PayoffID.ToString()]; decimal totalPrice = orderPayoff.Quantity * orderPayoff.AsPay; if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon) { this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", orderPayoff.Quantity, totalPrice.ToString("f2")); } else { this.txtAmount.Text = string.Format("{0} 元", totalPrice.ToString("f2")); } } else { if (curPayoffWay.PayoffType == (int)PayoffWayMode.GiftVoucher || curPayoffWay.PayoffType == (int)PayoffWayMode.Coupon) { this.txtAmount.Text = string.Format("{0} 张(合 {1} 元)", "0", "0.00"); } else { this.txtAmount.Text = string.Format("{0} 元", "0.00"); } if (curPayoffWay.PayoffType == (int)PayoffWayMode.MembershipCard) { decimal unPaidPrice = decimal.Parse(lbUnpaidAmount.Text.Substring(5)); if (unPaidPrice > 0) { Membership.FormVIPCardPayment formCardPayment = new Membership.FormVIPCardPayment(unPaidPrice); formCardPayment.ShowDialog(); if (formCardPayment.CardPaidAmount > 0) { OrderPayoff orderPayoff = new OrderPayoff(); orderPayoff.OrderPayoffID = Guid.NewGuid(); orderPayoff.OrderID = m_SalesOrder.order.OrderID; orderPayoff.PayoffID = curPayoffWay.PayoffID; orderPayoff.PayoffName = curPayoffWay.PayoffName; orderPayoff.PayoffType = curPayoffWay.PayoffType; orderPayoff.AsPay = curPayoffWay.AsPay; orderPayoff.Quantity = formCardPayment.CardPaidAmount / curPayoffWay.AsPay; if (!string.IsNullOrEmpty(formCardPayment.CardNo)) { orderPayoff.CardNo = formCardPayment.CardNo + "#" + formCardPayment.CardPassword; } orderPayoff.EmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID; dic.Add(curPayoffWay.PayoffID.ToString(), orderPayoff); } this.txtAmount.Text = string.Format("{0} 元", formCardPayment.CardPaidAmount.ToString("f2")); DisplayPayoffWay(); } } } m_InputNumber = "0"; }
private void FormFunctionPanel_Load(object sender, EventArgs e) { CrystalButton btnBillManage = new CrystalButton(); btnBillManage.Name = "btnBillManage"; btnBillManage.Text = "账单管理"; btnBillManage.BackColor = Color.Teal; btnBillManage.ForeColor = Color.White; btnBillManage.Click += new EventHandler(this.btnBillManage_Click); btnList.Add(btnBillManage); CrystalButton btnHandover = new CrystalButton(); btnHandover.Name = "btnHandover"; btnHandover.Text = "交班"; btnHandover.BackColor = Color.Teal; btnHandover.ForeColor = Color.White; btnHandover.Click += new EventHandler(this.btnHandover_Click); btnList.Add(btnHandover); //加载权限按钮 InitializeManagerButton(); CrystalButton btnMemberStored = new CrystalButton(); btnMemberStored.Name = "btnMemberStored"; btnMemberStored.Text = "会员储值"; btnMemberStored.BackColor = Color.Teal; btnMemberStored.ForeColor = Color.White; btnMemberStored.Click += new EventHandler(this.btnMemberStored_Click); btnList.Add(btnMemberStored); CrystalButton btnMemberSearch = new CrystalButton(); btnMemberSearch.Name = "btnMemberSearch"; btnMemberSearch.Text = "会员查询"; btnMemberSearch.BackColor = Color.Teal; btnMemberSearch.ForeColor = Color.White; btnMemberSearch.Click += new EventHandler(this.btnMemberSearch_Click); btnList.Add(btnMemberSearch); CrystalButton btnMemberTradeRecord = new CrystalButton(); btnMemberTradeRecord.Name = "btnMemberTradeRecord"; btnMemberTradeRecord.Text = "会员交易记录"; btnMemberTradeRecord.BackColor = Color.Teal; btnMemberTradeRecord.ForeColor = Color.White; btnMemberTradeRecord.Click += new EventHandler(this.btnMemberTradeRecord_Click); btnList.Add(btnMemberTradeRecord); CrystalButton btnMemberStatus = new CrystalButton(); btnMemberStatus.Name = "btnMemberStatus"; btnMemberStatus.Text = "会员状态管理"; btnMemberStatus.BackColor = Color.Teal; btnMemberStatus.ForeColor = Color.White; btnMemberStatus.Click += new EventHandler(this.btnMemberStatus_Click); btnList.Add(btnMemberStatus); CrystalButton btnUploadBill = new CrystalButton(); btnUploadBill.Name = "btnUploadBill"; btnUploadBill.Text = "上传单据"; btnUploadBill.BackColor = Color.Teal; btnUploadBill.ForeColor = Color.White; btnUploadBill.Click += new EventHandler(this.btnUploadBill_Click); btnList.Add(btnUploadBill); CrystalButton btnDownloadData = new CrystalButton(); btnDownloadData.Name = "btnDownloadData"; btnDownloadData.Text = "下载基础数据"; btnDownloadData.BackColor = Color.Teal; btnDownloadData.ForeColor = Color.White; btnDownloadData.Click += new EventHandler(this.btnDownloadData_Click); btnList.Add(btnDownloadData); CrystalButton btnModifyPassword = new CrystalButton(); btnModifyPassword.Name = "btnModifyPassword"; btnModifyPassword.Text = "修改密码"; btnModifyPassword.BackColor = Color.Teal; btnModifyPassword.ForeColor = Color.White; btnModifyPassword.Click += new EventHandler(this.btnModifyPassword_Click); btnList.Add(btnModifyPassword); CrystalButton btnCheckStock = new CrystalButton(); btnCheckStock.Name = "btnCheckStock"; btnCheckStock.Text = "沽清功能"; btnCheckStock.BackColor = Color.Teal; btnCheckStock.ForeColor = Color.White; btnCheckStock.Click += new EventHandler(this.btnCheckStock_Click); btnList.Add(btnCheckStock); CrystalButton btnPunchIn = new CrystalButton(); btnPunchIn.Name = "btnPunchIn"; btnPunchIn.Text = "上班打卡"; btnPunchIn.BackColor = Color.Teal; btnPunchIn.ForeColor = Color.White; btnPunchIn.Click += new EventHandler(this.btnPunchIn_Click); btnList.Add(btnPunchIn); CrystalButton btnSetting = new CrystalButton(); btnSetting.Name = "btnSetting"; btnSetting.Text = "系统设置"; btnSetting.BackColor = Color.Teal; btnSetting.ForeColor = Color.White; btnSetting.Click += new EventHandler(this.btnSetting_Click); btnList.Add(btnSetting); CrystalButton btnCancel = new CrystalButton(); btnCancel.Name = "btnCancel"; btnCancel.Text = "取消"; btnCancel.BackColor = Color.Red; btnCancel.ForeColor = Color.White; btnCancel.Click += new EventHandler(this.btnCancel_Click); btnList.Add(btnCancel); //判断每行显示多少列 int count = btnList.Count; int maxColumn = Convert.ToInt32(Math.Ceiling((Math.Sqrt(Convert.ToDouble(count))))); //显示多少行 int perLine = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(count) / maxColumn)); //计算button长宽 int space = 6; int width = (this.pnlFunction.Width - space * (maxColumn + 1)) / maxColumn; int height = (this.pnlFunction.Height - space * (perLine + 1)) / perLine; int index = 1; int px = space, py = space; foreach (CrystalButton btn in btnList) { btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Font = new Font("Microsoft YaHei", 10.5F, FontStyle.Bold); this.pnlFunction.Controls.Add(btn); index++; if (index > maxColumn) { px = space; py += height + space; index = 1; } else { px += width + space; } } }
private void InitializeManagerButton() { if (RightsItemCode.FindRights(RightsItemCode.DAILYSTATEMENT)) { CrystalButton btnDailyStatement = new CrystalButton(); btnDailyStatement.Name = "btnDailyStatement"; btnDailyStatement.Text = "日结"; btnDailyStatement.BackColor = Color.Teal; btnDailyStatement.ForeColor = Color.White; btnDailyStatement.Click += new EventHandler(this.btnDailyStatement_Click); btnList.Add(btnDailyStatement); } if (RightsItemCode.FindRights(RightsItemCode.PETTYCASHMODIFY)) { CrystalButton btnPettyCashModify = new CrystalButton(); btnPettyCashModify.Name = "btnPettyCashModify"; btnPettyCashModify.Text = "零用金修改"; btnPettyCashModify.BackColor = Color.Teal; btnPettyCashModify.ForeColor = Color.White; btnPettyCashModify.Click += new EventHandler(this.btnPettyCashModify_Click); btnList.Add(btnPettyCashModify); } if (RightsItemCode.FindRights(RightsItemCode.HOURSTURNOVER)) { CrystalButton btnHoursTurnover = new CrystalButton(); btnHoursTurnover.Name = "btnHoursTurnover"; btnHoursTurnover.Text = "小时营业额"; btnHoursTurnover.BackColor = Color.Teal; btnHoursTurnover.ForeColor = Color.White; btnHoursTurnover.Click += new EventHandler(this.btnHoursTurnover_Click); btnList.Add(btnHoursTurnover); } if (RightsItemCode.FindRights(RightsItemCode.HISTORYSEARCH)) { CrystalButton btnHistorySearch = new CrystalButton(); btnHistorySearch.Name = "btnHistorySearch"; btnHistorySearch.Text = "历史日结/交班查询"; btnHistorySearch.BackColor = Color.Teal; btnHistorySearch.ForeColor = Color.White; btnHistorySearch.Click += new EventHandler(this.btnHistorySearch_Click); btnList.Add(btnHistorySearch); } if (RightsItemCode.FindRights(RightsItemCode.SINGLEGOODSSTATISTICS)) { CrystalButton btnSingleGoodsStatistics = new CrystalButton(); btnSingleGoodsStatistics.Name = "btnSingleGoodsStatistics"; btnSingleGoodsStatistics.Text = "单品销量统计"; btnSingleGoodsStatistics.BackColor = Color.Teal; btnSingleGoodsStatistics.ForeColor = Color.White; btnSingleGoodsStatistics.Click += new EventHandler(this.btnSingleGoodsStatistics_Click); btnList.Add(btnSingleGoodsStatistics); } if (RightsItemCode.FindRights(RightsItemCode.DELETEDGOODSREPORT)) { CrystalButton btnDeletedGoodsReport = new CrystalButton(); btnDeletedGoodsReport.Name = "btnDeletedGoodsReport"; btnDeletedGoodsReport.Text = "删除品项报表"; btnDeletedGoodsReport.BackColor = Color.Teal; btnDeletedGoodsReport.ForeColor = Color.White; btnDeletedGoodsReport.Click += new EventHandler(this.btnDeletedGoodsReport_Click); btnList.Add(btnDeletedGoodsReport); } if (RightsItemCode.FindRights(RightsItemCode.PETTYCASHREPORT)) { CrystalButton btnPettyCashReport = new CrystalButton(); btnPettyCashReport.Name = "btnPettyCashReport"; btnPettyCashReport.Text = "零用金报表"; btnPettyCashReport.BackColor = Color.Teal; btnPettyCashReport.ForeColor = Color.White; btnPettyCashReport.Click += new EventHandler(this.btnPettyCashReport_Click); btnList.Add(btnPettyCashReport); } if (RightsItemCode.FindRights(RightsItemCode.HISTORYDAILYREPORT)) { CrystalButton btnHistoryDailyReport = new CrystalButton(); btnHistoryDailyReport.Name = "btnHistoryDailyReport"; btnHistoryDailyReport.Text = "历史日结汇总表"; btnHistoryDailyReport.BackColor = Color.Teal; btnHistoryDailyReport.ForeColor = Color.White; btnHistoryDailyReport.Click += new EventHandler(this.btnHistoryDailyReport_Click); btnList.Add(btnHistoryDailyReport); } if (RightsItemCode.FindRights(RightsItemCode.PUNCHINREPORT)) { CrystalButton btnPunchInReport = new CrystalButton(); btnPunchInReport.Name = "btnPunchInReport"; btnPunchInReport.Text = "打卡报表"; btnPunchInReport.BackColor = Color.Teal; btnPunchInReport.ForeColor = Color.White; btnPunchInReport.Click += new EventHandler(this.btnPunchInReport_Click); btnList.Add(btnPunchInReport); } if (RightsItemCode.FindRights(RightsItemCode.LOGSEARCH)) { CrystalButton btnLogSearch = new CrystalButton(); btnLogSearch.Name = "btnLogSearch"; btnLogSearch.Text = "日志查询"; btnLogSearch.BackColor = Color.Teal; btnLogSearch.ForeColor = Color.White; btnLogSearch.Click += new EventHandler(this.btnLogSearch_Click); btnList.Add(btnLogSearch); } }
/// <summary> /// /// </summary> /// <param name="displayModel">显示模式 1:单品折扣, 2:整单折扣</param> /// <param name="expenditure">未打折的消费金额</param> /// <param name="actualSellPrice">整单实际金额</param> public FormDiscount(DiscountDisplayModel displayModel, decimal expenditure, decimal actualSellPrice) { m_ActualSellPrice = actualSellPrice; InitializeComponent(); //显示折扣方式 //1:折扣率 2:固定折扣 IList <Discount> discountRateList = new List <Discount>(); IList <Discount> discountOffPayList = new List <Discount>(); foreach (Discount item in ConstantValuePool.DiscountList) { if (item.DisplayModel == (int)DiscountDisplayModel.ALL || item.DisplayModel == (int)displayModel) { if (expenditure == -1 || expenditure > item.MinQuotas) { if (item.DiscountType == (int)DiscountItemType.DiscountRate) { if (item.DiscountRate <= ConstantValuePool.CurrentEmployee.MinDiscount) { discountRateList.Add(item); } } if (item.DiscountType == (int)DiscountItemType.OffFixPay) { if (item.OffFixPay / item.MinQuotas <= ConstantValuePool.CurrentEmployee.MinDiscount) { discountOffPayList.Add(item); } } } } } //显示折扣率 int count = discountRateList.Count; int maxColumn = (int)Math.Ceiling(Convert.ToDecimal(count) / 5); int maxRow = (int)Math.Ceiling(Convert.ToDecimal(count) / maxColumn); int space = 8; int width = (this.tabPage1.Width - (maxColumn - 1) * space) / maxColumn; int height = (this.tabPage1.Height - (maxRow - 1) * space) / maxRow; int px = 0, py = 0, index = 1; foreach (Discount item in discountRateList) { CrystalButton btn = new CrystalButton(); btn.Name = item.DiscountID.ToString(); btn.Text = item.DiscountName; btn.BackColor = Color.Teal; btn.Font = new Font("微软雅黑", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Tag = item; btn.Click += new System.EventHandler(this.btnDiscount_Click); this.tabPage1.Controls.Add(btn); index++; if (index > maxColumn) { px = 0; py += height + space; index = 1; } else { px += width + space; } } //显示固定折扣 if (discountOffPayList.Count > 0) { count = discountOffPayList.Count; maxColumn = (int)Math.Ceiling(Convert.ToDecimal(count) / 5); maxRow = (int)Math.Ceiling(Convert.ToDecimal(count) / maxColumn); width = (this.tabPage2.Width - (maxColumn - 1) * space) / maxColumn; height = (this.tabPage2.Height - (maxRow - 1) * space) / maxRow; px = 0; py = 0; index = 1; foreach (Discount item in discountOffPayList) { CrystalButton btn = new CrystalButton(); btn.Name = item.DiscountID.ToString(); btn.Text = item.DiscountName; btn.BackColor = Color.Teal; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Width = width; btn.Height = height; btn.Location = new Point(px, py); btn.Tag = item; btn.Click += new System.EventHandler(this.btnDiscount_Click); this.tabPage2.Controls.Add(btn); index++; if (index > maxColumn) { px = 0; py += height + space; index = 1; } else { px += width + space; } } } }
public HausErweiterungen(int iStadtID) { InitializeComponent(); int iTopButton = 136; int iTopLabel = 131; int i = 0; _stadtID = iStadtID; _reduzierung = 1; if (SW.Dynamisch.GetHumWithID(SW.Dynamisch.GetAktiverSpieler()).CheckPrivilegX(15)) { _reduzierung = ((PrivSparplan)SW.Statisch.GetPrivX(15)).FaktorReduzierung; } lbl_frage.Text = "Welche Erweiterung wollt Ihr an " + SW.Dynamisch.GetHumWithID(SW.Dynamisch.GetAktiverSpieler()).GetSpielerHatHausVonStadtAnArraystelle(_stadtID).GetNameInklPronomen() + " anbauen?"; _hausErweiterungen = SW.Dynamisch.GetHumWithID(SW.Dynamisch.GetAktiverSpieler()).GetSpielerHatHausVonStadtAnArraystelle(_stadtID).GetFehlendeOderVorhandeneHauserweiterungen(); if (_hausErweiterungen.Count > 0) { // Alle nicht bereits vorhandenen Hauserweiterungen auslesen und anzeigen foreach (HausErweiterung oErweiterung in _hausErweiterungen) { #region Controls erstellen _btnErweiterungBauen = new CrystalButton(); _btnErweiterungBauen.BackColor = System.Drawing.Color.Transparent; _btnErweiterungBauen.BackgroundImageLayout = ImageLayout.Stretch; _btnErweiterungBauen.FlatAppearance.BorderSize = 0; _btnErweiterungBauen.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent; _btnErweiterungBauen.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent; _btnErweiterungBauen.FlatStyle = FlatStyle.Flat; _btnErweiterungBauen.Font = new System.Drawing.Font("Arial", 20.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); _btnErweiterungBauen.ForeColor = System.Drawing.Color.Black; _btnErweiterungBauen.Location = new System.Drawing.Point(55, iTopButton); _btnErweiterungBauen.Margin = new Padding(0); _btnErweiterungBauen.Name = "btnErweiterungBauen" + i.ToString(); _btnErweiterungBauen.Size = new System.Drawing.Size(20, 20); _btnErweiterungBauen.TabIndex = 223; _btnErweiterungBauen.UseVisualStyleBackColor = false; _btnErweiterungBauen.Tag = i; _btnErweiterungBauen.Click += new EventHandler(this.btnErweiterungBauen_Click); _btnErweiterungBauen.MouseDown += new MouseEventHandler(this.btnErweiterungBauen_MouseDown); _btnErweiterungBauen.BackgroundImage = Properties.Resources.SymbUnchecked; this.Controls.Add(_btnErweiterungBauen); _lblErweiterungBauen = new Label(); _lblErweiterungBauen.AutoSize = true; _lblErweiterungBauen.BackColor = System.Drawing.Color.Transparent; _lblErweiterungBauen.Font = Grafik.GetStandardFont(18); //new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); _lblErweiterungBauen.ForeColor = System.Drawing.Color.Black; _lblErweiterungBauen.Location = new System.Drawing.Point(87, iTopLabel); _lblErweiterungBauen.MaximumSize = new System.Drawing.Size(473, 0); _lblErweiterungBauen.Name = "lblErweiterungBauen" + i.ToString(); _lblErweiterungBauen.Size = new System.Drawing.Size(162, 29); _lblErweiterungBauen.TabIndex = 225; _lblErweiterungBauen.Text = oErweiterung.NameFuerKauf + " für " + Convert.ToInt32(oErweiterung.Kaufpreis * _reduzierung).ToStringGeld(); _lblErweiterungBauen.MouseDown += new MouseEventHandler(this.btnErweiterungBauen_MouseDown); this.Controls.Add(_lblErweiterungBauen); if (_lblErweiterungBauen.Height <= 29) { iTopButton += 35; iTopLabel += 35; } else { iTopButton += 70; iTopLabel += 70; } i++; #endregion } this.Height = iTopLabel + 40; } }
private void BindPayoffWay() { this.pnlPayoffWay.Controls.Clear(); //support six buttons int space = 5; int px = 0, py = 0; int width = (pnlPayoffWay.Width - 2 * space) / 3; int height = (pnlPayoffWay.Height - space) / 2; List <PayoffWay> payoffWayList = new List <PayoffWay>(); foreach (PayoffWay item in ConstantValuePool.PayoffWayList) { if (item.AsVIPCardPayWay) { payoffWayList.Add(item); } } int pageSize = 0; if (payoffWayList.Count > 6) { pageSize = 6; } else { pageSize = payoffWayList.Count; } for (int index = 0; index < pageSize; index++) { PayoffWay payoff = payoffWayList[index]; CrystalButton btn = new CrystalButton(); btn.Name = payoff.PayoffID.ToString(); btn.Text = payoff.PayoffName; btn.Width = width; btn.Height = height; btn.BackColor = btn.DisplayColor = Color.Blue; btn.Font = new Font("Microsoft YaHei", 12F, FontStyle.Regular); btn.ForeColor = Color.White; btn.Location = new Point(px, py); foreach (ButtonStyle btnStyle in ConstantValuePool.ButtonStyleList) { if (payoff.ButtonStyleID.Equals(btnStyle.ButtonStyleID)) { float emSize = (float)btnStyle.FontSize; FontStyle style = FontStyle.Regular; btn.Font = new Font(btnStyle.FontName, emSize, style); btn.ForeColor = ColorConvert.RGB(btnStyle.ForeColor); btn.BackColor = btn.DisplayColor = ColorConvert.RGB(btnStyle.BackColor); break; } } btn.Tag = payoff; btn.Click += new System.EventHandler(this.btnPayoff_Click); pnlPayoffWay.Controls.Add(btn); px += width + space; if ((index + 1) % 3 == 0) { px = 0; py += height + space; } } }
private void btnRegion_Click(object sender, EventArgs e) { CrystalButton btnRegion = sender as CrystalButton; if (btnRegion == null) { return; } BizRegion region = btnRegion.Tag as BizRegion; if (region == null) { return; } _currentFormActivate = false; lock (_dicDeskInRegion) { //禁止引发Layout事件 this.pnlDesk.SuspendLayout(); this.SuspendLayout(); //清除pnlDesk内所有控件 this.pnlDesk.Controls.Clear(); //获取Desk List _prevRegionButton.BackColor = _prevRegionButton.DisplayColor; btnRegion.BackColor = ConstantValuePool.PressedColor; _prevRegionButton = btnRegion; _currentRegionId = region.RegionID; if (!_dicDeskInRegion.ContainsKey(_currentRegionId)) { List <CrystalButton> btnList = new List <CrystalButton>(); if (region.BizDeskList != null && region.BizDeskList.Count > 0) { foreach (BizDesk desk in region.BizDeskList) { CrystalButton btn = new CrystalButton(); btn.Name = desk.DeskID.ToString(); btn.Text = desk.DeskName; btn.Width = desk.Width; btn.Height = desk.Height; btn.Location = new Point(desk.PX, desk.PY); btn.Tag = desk; btn.Font = new Font("Arial", ConstantValuePool.BizSettingConfig.FontSize, FontStyle.Regular); btn.ForeColor = Color.White; btn.BackColor = GetColorByStatus(desk.Status, desk.DeviceNo); btn.Click += new System.EventHandler(this.btnDesk_Click); btnList.Add(btn); } } _dicDeskInRegion.Add(region.RegionID, btnList); } foreach (CrystalButton btn in _dicDeskInRegion[region.RegionID]) { this.pnlDesk.Controls.Add(btn); } this.pnlDesk.Controls.Add(btnFreeColor); this.pnlDesk.Controls.Add(btnTakeColor); this.pnlDesk.Controls.Add(btnLookColor); //恢复引发Layout事件 this.pnlDesk.ResumeLayout(false); this.pnlDesk.PerformLayout(); this.ResumeLayout(false); } _currentFormActivate = true; }
private void FormDesk_Load(object sender, EventArgs e) { InitializeRegionDeskButton(); const int space = 5; const int width = 75; const int height = 28; int px = this.pnlDesk.Width - 3 * (width + space); int py = this.pnlDesk.Height - height - space; this.btnFreeColor.Width = width; this.btnFreeColor.Height = height; this.btnFreeColor.Location = new Point(px, py); px += width + space; this.btnTakeColor.Width = width; this.btnTakeColor.Height = height; this.btnTakeColor.Location = new Point(px, py); px += width + space; this.btnLookColor.Width = width; this.btnLookColor.Height = height; this.btnLookColor.Location = new Point(px, py); this.pnlSysTools.Width = this.scrollingText1.Width = this.pnlToolBar.Width; int toolsBarNum = 6; if (ConstantValuePool.BizSettingConfig.SaleType == ShopSaleType.DineInAndTakeout) { toolsBarNum++; } else { btnTakeOut.Visible = false; } int btnWidth = this.pnlSysTools.Width / toolsBarNum; int btnHeight = this.pnlSysTools.Height; px = 0; py = 0; btnManager.Size = new System.Drawing.Size(btnWidth, btnHeight); btnManager.Location = new Point(px, py); px += btnWidth; btnOrder.Size = new System.Drawing.Size(btnWidth, btnHeight); btnOrder.Location = new Point(px, py); px += btnWidth; btnClear.Size = new System.Drawing.Size(btnWidth, btnHeight); btnClear.Location = new Point(px, py); px += btnWidth; btnTurnTable.Size = new System.Drawing.Size(btnWidth, btnHeight); btnTurnTable.Location = new Point(px, py); px += btnWidth; btnCheckOut.Size = new System.Drawing.Size(btnWidth, btnHeight); btnCheckOut.Location = new Point(px, py); if (ConstantValuePool.BizSettingConfig.SaleType == ShopSaleType.DineInAndTakeout) { px += btnWidth; btnTakeOut.Size = new System.Drawing.Size(btnWidth, btnHeight); btnTakeOut.Location = new Point(px, py); } px += btnWidth; btnExit.Size = new System.Drawing.Size(this.pnlSysTools.Width - px, btnHeight); btnExit.Location = new Point(px, py); btnOrder.DisplayColor = btnOrder.BackColor; btnClear.DisplayColor = btnClear.BackColor; btnTurnTable.DisplayColor = btnTurnTable.BackColor; btnCheckOut.DisplayColor = btnCheckOut.BackColor; if (RightsItemCode.FindRights(RightsItemCode.TAKEORDER)) { if (_haveDailyClose) { btnOrder.BackColor = ConstantValuePool.PressedColor; _operateType = ButtonOperateType.ORDER; _prevPressedButton = btnOrder; } else { btnOrder.Enabled = false; btnOrder.BackColor = ConstantValuePool.DisabledColor; _operateType = ButtonOperateType.NONE; } } else { btnOrder.Enabled = false; btnOrder.BackColor = ConstantValuePool.DisabledColor; _operateType = ButtonOperateType.NONE; } if (!RightsItemCode.FindRights(RightsItemCode.CLEARDESK)) { btnClear.Enabled = false; btnClear.BackColor = ConstantValuePool.DisabledColor; } if (!RightsItemCode.FindRights(RightsItemCode.TURNTABLE)) { btnTurnTable.Enabled = false; btnTurnTable.BackColor = ConstantValuePool.DisabledColor; } if (!RightsItemCode.FindRights(RightsItemCode.CHECKOUT)) { btnCheckOut.Enabled = false; btnCheckOut.BackColor = ConstantValuePool.DisabledColor; } string strNotice = string.Empty; foreach (Notice item in ConstantValuePool.NoticeList) { strNotice += item.NoticeContent + "\t\t\t"; } if (!string.IsNullOrEmpty(strNotice)) { scrollingText1.ScrollText = strNotice; } Thread backWork = new Thread(new ThreadStart(DoWork)); backWork.IsBackground = true; backWork.Start(); }
private void btnDesk_Click(object sender, EventArgs e) { if (_operateType == ButtonOperateType.NONE) { return; } CrystalButton btnDesk = sender as CrystalButton; if (btnDesk == null) { return; } BizDesk tempDesk = btnDesk.Tag as BizDesk; if (tempDesk == null) { return; } _currentFormActivate = false; //重新获取Desk信息 BizDesk desk = DeskService.GetInstance().GetBizDeskByName(tempDesk.DeskName); if (_operateType == ButtonOperateType.ORDER) { if (desk.Status == (int)DeskButtonStatus.IDLE_MODE) { //人数 Feature.FormNumericKeypad keyForm = new Feature.FormNumericKeypad(); keyForm.DisplayText = "请输入就餐人数"; keyForm.ShowDialog(); if (!string.IsNullOrEmpty(keyForm.KeypadValue) && keyForm.KeypadValue != "0" && keyForm.KeypadValue.IndexOf('.') == -1) { _formOrder.PersonNum = int.Parse(keyForm.KeypadValue); } else { return; } //更新桌况为占用状态 const int status = (int)DeskButtonStatus.OCCUPIED; if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status)) { desk.Status = status; btnDesk.BackColor = GetColorByStatus(status, ConstantValuePool.BizSettingConfig.DeviceNo); _formOrder.CurrentDeskName = desk.DeskName; _formOrder.PlaceSalesOrder = null; _formOrder.VisibleShow = true; _formOrder.Show(); } } else if (desk.Status == (int)DeskButtonStatus.OCCUPIED) { if (string.IsNullOrEmpty(desk.DeviceNo) || desk.DeviceNo == ConstantValuePool.BizSettingConfig.DeviceNo) { //更新桌况为占用状态 const int status = (int)DeskButtonStatus.OCCUPIED; if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status)) { //获取桌子的订单列表 IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName); if (orderList != null && orderList.Count > 0) { Guid orderId = Guid.Empty; if (orderList.Count == 1) { orderId = orderList[0].OrderID; } else { Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList); form.ShowDialog(); if (form.SelectedOrder != null) { orderId = form.SelectedOrder.OrderID; } } SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(orderId); if (salesOrder != null) { if (salesOrder.order.Status == 3) //已预结 { //open check out form FormCheckOut checkForm = new FormCheckOut(salesOrder, desk.DeskName); checkForm.ShowDialog(); } else { //open order form _formOrder.CurrentDeskName = desk.DeskName; _formOrder.PlaceSalesOrder = salesOrder; _formOrder.VisibleShow = true; _formOrder.Show(); } } } } } } } else if (_operateType == ButtonOperateType.CLEAR) { if (desk.Status == (int)DeskButtonStatus.OCCUPIED && !string.IsNullOrEmpty(desk.DeviceNo)) { //更新桌况为非占用状态 const int status = (int)DeskButtonStatus.OCCUPIED; if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, string.Empty, status)) { btnDesk.BackColor = GetColorByStatus(status, string.Empty); } } } else if (_operateType == ButtonOperateType.CHANGE_DESK) { if (string.IsNullOrEmpty(_deskName1St)) { //获取桌子的订单列表 IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName); if (orderList != null && orderList.Count > 0) { if (orderList.Count > 1) { Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList); form.ShowDialog(); if (form.SelectedOrder != null) { _deskName1St = desk.DeskName; _orderId1St = form.SelectedOrder.OrderID; _firstDeskSingleOrder = false; } else { _currentFormActivate = true; //使线程重新活跃 return; } } else { _deskName1St = desk.DeskName; _orderId1St = orderList[0].OrderID; _firstDeskSingleOrder = true; } } else { _currentFormActivate = true; //使线程重新活跃 return; //空桌 } } else { if (!string.IsNullOrEmpty(_deskName1St)) { if (desk.DeskName == _deskName1St) { _currentFormActivate = true; //使线程重新活跃 return; //点击相同的第一张桌子 } //获取桌子的订单列表 IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName); if (orderList != null && orderList.Count > 0) { DeskChange deskChange = new DeskChange(); deskChange.DeskName = desk.DeskName; deskChange.OrderID1st = _orderId1St; deskChange.OrderID2nd = Guid.Empty; Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList, deskChange); form.ShowDialog(); if (form.SelectedOrder != null) { int status = 0; if (_firstDeskSingleOrder) { //更新桌况为空闲状态 status = (int)DeskButtonStatus.IDLE_MODE; if (!DeskService.GetInstance().UpdateDeskStatus(_deskName1St, string.Empty, status)) { MessageBox.Show("更新桌况失败!"); } } status = (int)DeskButtonStatus.OCCUPIED; if (!DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status)) { MessageBox.Show("更新桌况失败!"); } _deskName1St = string.Empty; _orderId1St = Guid.Empty; _firstDeskSingleOrder = false; } else { _deskName1St = string.Empty; _orderId1St = Guid.Empty; _firstDeskSingleOrder = false; } } else { //直接转台 DeskChange deskChange = new DeskChange(); deskChange.DeskName = desk.DeskName; deskChange.OrderID1st = _orderId1St; deskChange.OrderID2nd = Guid.Empty; if (OrderService.GetInstance().OrderDeskOperate(deskChange)) { int status = 0; if (_firstDeskSingleOrder) { //更新桌况为空闲状态 status = (int)DeskButtonStatus.IDLE_MODE; if (!DeskService.GetInstance().UpdateDeskStatus(_deskName1St, string.Empty, status)) { MessageBox.Show("更新桌况失败!"); } } status = (int)DeskButtonStatus.OCCUPIED; if (!DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status)) { MessageBox.Show("更新桌况失败!"); } _deskName1St = string.Empty; _orderId1St = Guid.Empty; _firstDeskSingleOrder = false; } } } } } else if (_operateType == ButtonOperateType.CHECKOUT) { if (desk.Status == (int)DeskButtonStatus.OCCUPIED) { if (string.IsNullOrEmpty(desk.DeviceNo) || desk.DeviceNo == ConstantValuePool.BizSettingConfig.DeviceNo) { //更新桌况为占用状态 const int status = (int)DeskButtonStatus.OCCUPIED; if (DeskService.GetInstance().UpdateDeskStatus(desk.DeskName, ConstantValuePool.BizSettingConfig.DeviceNo, status)) { //获取桌子的订单列表 IList <Order> orderList = OrderService.GetInstance().GetOrderList(desk.DeskName); if (orderList != null && orderList.Count > 0) { Guid orderId = Guid.Empty; if (orderList.Count == 1) { orderId = orderList[0].OrderID; } else { Feature.FormChoseMultiOrder form = new Feature.FormChoseMultiOrder(orderList); form.ShowDialog(); if (form.SelectedOrder != null) { orderId = form.SelectedOrder.OrderID; } } SalesOrder salesOrder = SalesOrderService.GetInstance().GetSalesOrder(orderId); if (salesOrder != null) { FormCheckOut checkForm = new FormCheckOut(salesOrder, desk.DeskName); checkForm.ShowDialog(); } } } } } } _currentFormActivate = true; }