Beispiel #1
0
        /// <summary>
        /// 确认按钮
        /// </summary>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确认结账吗?", "订单操作", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                var personsConsumption = httpReq.HttpGet <Consumption>(string.Format("consumptions/{0}", PassValue.consumptionid));

                //实收金额
                string price_fixed = this.lbReceiveActual.Text;
                //应收金额
                string total = this.lbTotal.Text;
                PassValue.Infor_payment.paid      = PassValue.Infor_payment.closed = true;
                PassValue.Infor_payment.payments  = PassValue.payments.ToArray();
                PassValue.Infor_payment.discounts = personsConsumption.discounts;
                if (double.Parse(total) - double.Parse(price_fixed) <= 0.00)
                {
                    //判断有没有支付信息
                    if (PassValue.payments.Count() == 0)
                    {
                        MessageBox.Show("请输入支付信息,您不能结账,如支付金额为0,请选择其他?", "订单操作", MessageBoxButtons.OK, MessageBoxIcon.Question);
                        return;
                    }
                    else
                    {
                        //判断支付信息有没有会员卡信息
                        Payment payment = PassValue.payments.Where(payments => payments.method.Equals("member")).FirstOrDefault();
                        if (payment != null)
                        {
                            //弹出密码输入框
                            InputPassWord ip = new InputPassWord();
                            if (ip.ShowDialog() == DialogResult.Cancel)
                            {
                                return;
                            }
                        }
                    }

                    HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", PassValue.consumptionid), PassValue.Infor_payment);
                    if ((int)httpResult.StatusCode == 410)
                    {
                        MessageBox.Show("请检查打印机是否连接!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else if ((int)httpResult.StatusCode == 401)
                    {
                        LoginBusiness lg = new LoginBusiness();
                        lg.LoginAgain();
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 0)
                    {
                        MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 403)
                    {
                        MessageBox.Show("操作被禁止!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 500)
                    {
                        MessageBox.Show("操作错误(500)!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 400)
                    {
                        MessageBox.Show("请求错误(400)!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }

                    PassValue.Infor_payment = new PatchOrders();
                    PassValue.discounts.Clear();
                    PassValue.payments.Clear();//清空
                    Messagebox mb = new Messagebox();
                    PassValue.MessageInfor = "结账完成";
                    mb.ShowDialog();
                    PassValue.consumptionid = "";
                    PassValue.MemberCardPwd = "";
                    PassValue.listItemID.Clear();
                    PassValue.listItemIDBefore.Clear();
                    PassValue.Percent = 0;

                    Desk d = this.Owner as Desk;
                    if (d == null)
                    {
                        if (m_ILoadData != null)
                        {
                            m_ILoadData.LoadData();
                        }
                    }
                    else
                    {
                        d.CurrentChooseDesk.Clear();
                        d.Refresh_Method();
                        d.CurrentChooseDesk = new Dictionary <string, string>();
                    }

                    this.Close();
                }
                else
                {
                    PassValue.MessageInfor = "应收金额:" + this.lbTotal.Text + "实际结账的金额是:" + this.lbReceiveActual.Text + ",您不能结账!";
                    MessageBox.Show(PassValue.MessageInfor);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 确认按钮
        /// </summary>
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确认结账吗?", "订单操作", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                var personsConsumption = httpReq.HttpGet<Consumption>(string.Format("consumptions/{0}", PassValue.consumptionid));

                //实收金额
                string price_fixed = this.lbReceiveActual.Text;
                //应收金额
                string total = this.lbTotal.Text;
                PassValue.Infor_payment.paid = PassValue.Infor_payment.closed = true;
                PassValue.Infor_payment.payments = PassValue.payments.ToArray();
                PassValue.Infor_payment.discounts = personsConsumption.discounts;
                if (double.Parse(total) - double.Parse(price_fixed) <= 0.00)
                {
                    //判断有没有支付信息
                    if (PassValue.payments.Count() == 0)
                    {
                        MessageBox.Show("请输入支付信息,您不能结账,如支付金额为0,请选择其他?", "订单操作", MessageBoxButtons.OK, MessageBoxIcon.Question);
                        return;
                    }
                    else
                    {
                        //判断支付信息有没有会员卡信息
                        Payment payment = PassValue.payments.Where(payments => payments.method.Equals("member")).FirstOrDefault();
                        if (payment != null)
                        {
                            //弹出密码输入框
                            InputPassWord ip = new InputPassWord();
                            if (ip.ShowDialog() == DialogResult.Cancel)
                            {
                                return;
                            }
                        }
                    }

                    HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", PassValue.consumptionid), PassValue.Infor_payment);
                    if ((int)httpResult.StatusCode == 410)
                    {
                        MessageBox.Show("请检查打印机是否连接!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else if ((int)httpResult.StatusCode == 401)
                    {
                        LoginBusiness lg = new LoginBusiness();
                        lg.LoginAgain();
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 0)
                    {
                        MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 403)
                    {
                        MessageBox.Show("操作被禁止!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 500)
                    {
                        MessageBox.Show("操作错误(500)!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    else if ((int)httpResult.StatusCode == 400)
                    {
                        MessageBox.Show("请求错误(400)!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }

                    PassValue.Infor_payment = new PatchOrders();
                    PassValue.discounts.Clear();
                    PassValue.payments.Clear();//清空
                    Messagebox mb = new Messagebox();
                    PassValue.MessageInfor = "结账完成";
                    mb.ShowDialog();
                    PassValue.consumptionid = "";
                    PassValue.MemberCardPwd = "";
                    PassValue.listItemID.Clear();
                    PassValue.listItemIDBefore.Clear();
                    PassValue.Percent = 0;

                    Desk d = this.Owner as Desk;
                    if (d == null)
                    {
                        if (m_ILoadData != null)
                        {
                            m_ILoadData.LoadData();
                        }
                    }
                    else
                    {
                        d.CurrentChooseDesk.Clear();
                        d.Refresh_Method();
                        d.CurrentChooseDesk = new Dictionary<string, string>();
                    }

                    this.Close();
                }
                else
                {
                    PassValue.MessageInfor = "应收金额:" + this.lbTotal.Text + "实际结账的金额是:" + this.lbReceiveActual.Text + ",您不能结账!";
                    MessageBox.Show(PassValue.MessageInfor);
                }
            }
        }