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 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 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 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"; }