Ejemplo n.º 1
0
        //确认按钮
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            //if (applicationInfo.CanBuy(applicationInfo.TransNo, "", applicationInfo.Applicants, totalPrice))
            //{
            try
            {
                double exchangeRate = 1;
                if (applicationInfo.MoneyUnit == 2)
                {
                    exchangeRate = double.Parse(EmailControl.config.USrate.ToString());
                }
                else if (applicationInfo.MoneyUnit == 3)
                {
                    exchangeRate = double.Parse(EmailControl.config.HKrate.ToString());
                }
                //将额度修改转移到商品部最终确认步骤 2017/09/28
                //applicationInfo.StorePay(applicationInfo.TransNo, "", applicationInfo.Applicants, totalPrice,exchangeRate);
                applicationDetail.UpdateBuyApplicationDetail(ApplicationDetailTable, applicationInfo.TransNo);
                applicationInfo.StoreConfirm(applicationInfo.TransNo, Login.LoginUser, txtSalesDate.Value);
                //购买异常标识
                int exc = 0;
                foreach (DataRow dr in ApplicationDetailTable.Rows)
                {
                    if (dr["IsSuccess"].ToString() == "0")
                    {
                        exc++;
                    }
                }
                if (exc > 0)
                {
                    applicationInfo.SetFinalException(applicationInfo.TransNo);
                }

                Thread thread = new Thread(new ThreadStart(SendEmail));
                thread.Start();
                MessageBox.Show("确认完成", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("确认失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            //}
            //else
            //{
            //    MessageBox.Show("该用户余额不足", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
        }
        //确认按钮
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                totalPrice = 0;
                foreach (DataGridViewRow dgvr in dgvApplyDetails.Rows)
                {
                    if ((int)dgvr.Cells["IsSuccess"].Value == 1 && !CheckSpecial(dgvr.Cells["ItemID"].Value.ToString()))
                    {
                        decimal MoneyDiscont = 1;
                        switch (dgvr.Cells["MoneyUnit"].Value.ToString())
                        {
                        case "1":
                        default:
                            MoneyDiscont = 1;
                            break;

                        case "2":
                            MoneyDiscont = EmailControl.config.USrate;
                            break;

                        case "3":
                            MoneyDiscont = EmailControl.config.HKrate;
                            break;

                        case "4":
                            MoneyDiscont = EmailControl.config.MOPrate;
                            break;

                        case "5":
                            MoneyDiscont = EmailControl.config.SGDrate;
                            break;

                        case "6":
                            MoneyDiscont = EmailControl.config.MYRrate;
                            break;

                        case "7":
                            MoneyDiscont = EmailControl.config.GBPrate;
                            break;

                        case "8":
                            MoneyDiscont = EmailControl.config.EURrate;
                            break;

                        case "9":
                            MoneyDiscont = EmailControl.config.JPYrate;
                            break;

                        case "10":
                            MoneyDiscont = EmailControl.config.TWDrate;
                            break;
                        }
                        totalPrice += double.Parse(dgvr.Cells["FinalPrice"].Value.ToString()) * double.Parse(MoneyDiscont.ToString());
                    }
                }
                applicationInfo.StorePay(applicationInfo.TransNo, "", applicationInfo.Applicants, totalPrice, 1);
                applicationDetail.UpdateBuyApplicationDetail(ApplicationDetailTable, applicationInfo.TransNo);
                applicationInfo.FinalConfirm(applicationInfo.TransNo);
                MessageBox.Show("确认完成", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("确认失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }