Esempio n. 1
0
        private void sureButton_Click(object sender, EventArgs e)
        {
            if (branch.Equals(BranchPay.money))
            {
                alreadyAmount = cDBDMoney.alreadyAmount;
            }
            if (branch.Equals(BranchPay.card))
            {
                alreadyAmount = cDBDCard.alreadyAmount;
            }

            PayInfo payinfo = new PayInfo();

            //付款单号
            payinfo.Id         = DateTime.Now.ToString("yyyyMMddHHmmss");
            payinfo.CreateTime = DateTime.Now;
            payinfo.UpdateTime = DateTime.Now;
            //付款金额
            payinfo.PayAmount = alreadyAmount.ToString();
            //订单号
            payinfo.orderId = orderNum;
            //业务员
            payinfo.salesmanId = LoginUserInfo.id;
            //付款日期
            payinfo.payDate = DateTime.Now;
            //支付方式
            payinfo.PayMode = branch;
            //分店
            payinfo.BranchId = LoginUserInfo.branchId;
            //会员卡号
            payinfo.MemberId = associator_cardnumber;
            ///保存付款信息到本地数据库
            BranchPayInfoService branchService = new BranchPayInfoService();

            branchService.AddPayInfo(payinfo);
            ///上传付款信息到远处服务器
            ///TODO  暂时未考虑断线问题
            PayInfoService service = new PayInfoService();

            service.AddPayInfo(payinfo);

            check();
            //MessageBox.Show(alreadyTotalAmount.ToString());
            if (alreadyTotalAmount == totalAmountValue)
            {
                flag = true;
            }
            MessageBox.Show("付款成功");
            this.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// 确定支付
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            ///1,支付信息的存储等
            ///2,调用结算界面的方法,存储信息,挪动历史订单信息


            customerDelivery.actualTotalMoney = textBox4.Text;

            if (paidAmount >= float.Parse(textBox4.Text))
            {
                flag = true;
                if (float.Parse(textBox4.Text) - this.cardpayment > 0)
                {
                    PayInfo obj = new PayInfo();
                    obj.Id         = Guid.NewGuid().ToString();
                    obj.CreateTime = DateTime.Now;
                    obj.UpdateTime = DateTime.Now;
                    obj.PayAmount  = (float.Parse(textBox4.Text) - this.cardpayment).ToString("0.00");
                    obj.orderId    = orderId;
                    obj.salesmanId = LoginUserInfo.id;
                    obj.payDate    = DateTime.Now;
                    obj.PayMode    = BranchPay.money;
                    obj.MemberId   = memberCardId;
                    obj.BranchId   = LoginUserInfo.branchId;
                    AddPayInfo(obj);
                }
            }
            else
            {
                flag             = false;
                cashTextbox.Text = (float.Parse(textBox4.Text) - paidAmount).ToString("0.00");
            }

            if (flag)
            {
                BranchPayInfoService payService = new BranchPayInfoService();

                payService.AddPayInfo(payList);

                //上传支付信息
                if (PingTask.IsConnected)
                {
                    PayInfoService masterPayInfoService = new PayInfoService();
                    masterPayInfoService.AddPayInfo(payList);
                }
                else
                {
                    List <UploadInfo> list = new List <UploadInfo>();
                    foreach (PayInfo obj in payList)
                    {
                        UploadInfo uploadInfo = new UploadInfo();
                        uploadInfo.Id         = obj.Id;
                        uploadInfo.CreateTime = DateTime.Now;
                        uploadInfo.UpdateTime = DateTime.Now;
                        uploadInfo.Type       = Constant.PAY_INFO;
                        list.Add(uploadInfo);
                    }
                    UploadDao uploadDao = new UploadDao();
                    uploadDao.AddUploadInfo(list);
                }


                MessageBox.Show("支付完成!");
                if (ModeFlag == 1)
                {
                    customerDelivery.saveRefuseInform(Constant.ORDER_STATUS_PART_REFUSE);
                }
                else
                {
                    customerDelivery.saveAllPay(Constant.ORDER_STATUS_FININSH);
                }
                clFlag = true;
                ///打印小票的代码
                ///start

                ///付款金额,
                customerDelivery.printTicket(float.Parse(textBox4.Text));
                ///stop
                this.Close();
            }
            else
            {
                MessageBox.Show("支付尚未完成!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
        }