Exemple #1
0
        /// <summary>
        /// 充值
        /// </summary>
        public override void WalletDepositMoney()
        {
            if (string.IsNullOrEmpty(txtWal_No.Text))
            {
                //钱包账号为空,充值失败
                MessageBoxs.Show(Trans.SD, this.ToString(), MsgHelp.GetMsg(MsgCode.E_0016, new object[] { SystemTableColumnEnums.EWM_Wallet.Name.Wal_No, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //待充值的钱包
            WalletInfoUIModel walletToDeposit = BLLCom.GetWalletByWalletNo(txtWal_No.Text);

            if (string.IsNullOrEmpty(walletToDeposit.Wal_ID) ||
                string.IsNullOrEmpty(walletToDeposit.Wal_No))
            {
                //没有获取到钱包,充值失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //钱包相关信息
                { RIAViewParamKey.WalletInfo.ToString(), walletToDeposit },
            };

            //跳转到[钱包充值]
            SystemFunction.ShowViewFromView(MsgParam.WALLET_DEPOSITMONEY, ViewClassFullNameConst.RIA_FrmWalletDepositMoney, true, PageDisplayMode.TabPage, paramViewParameters, null);
        }
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmWalletDepositMoney_Load(object sender, EventArgs e)
        {
            #region 固定
            //基类.工具栏(动作,导航)
            base.ToolBarActionAndNavigate = toolBarActionAndNavigate;
            //工具栏(动作)单击事件
            this.toolBarActionAndNavigate.ToolClick += new ToolClickEventHandler(base.toolBarActionAndNavigate_ToolClick);
            //初始化【详情】Tab内控件
            InitializeDetailTabControls();
            //根据选中的Tab,设置动作按钮[是否可用](在系统权限的基础上进行控制)
            base.SetActionEnableBySelectedTab(SysConst.EN_LIST);
            #endregion

            //[保存]可用
            SetActionEnable(SystemActionEnum.Code.SAVE, true);

            #region 处理参数

            if (_viewParameters == null)
            {
                return;
            }

            #region 钱包相关信息

            if (_viewParameters.ContainsKey(RIAViewParamKey.WalletInfo.ToString()))
            {
                WalletInfoUIModel resultWalletInfo = _viewParameters[RIAViewParamKey.WalletInfo.ToString()] as WalletInfoUIModel;

                if (resultWalletInfo != null)
                {
                    //钱包ID
                    txtWal_ID.Text = resultWalletInfo.Wal_ID;
                    //钱包账号
                    txtWal_No.Text = resultWalletInfo.Wal_No;
                    //开户人
                    txtWal_CustomerID.Text   = resultWalletInfo.Wal_CustomerID;
                    txtWal_CustomerName.Text = resultWalletInfo.Wal_CustomerName;
                    //汽修商户
                    mcbAutoFactoryName.SelectedValue = resultWalletInfo.Wal_AutoFactoryCode;
                    //汽修商组织编码
                    txtWal_AutoFactoryOrgCode.Text = resultWalletInfo.Wal_AutoFactoryOrgCode;
                    //可用余额
                    txtWal_AvailableBalance.Text = (resultWalletInfo.Wal_AvailableBalance ?? 0).ToString();
                    _oldAvailableBalance         = resultWalletInfo.Wal_AvailableBalance ?? 0;
                    //充值基数
                    txtWal_DepositBaseAmount.Text = (resultWalletInfo.Wal_DepositBaseAmount ?? 0).ToString();
                    //钱包版本号
                    txtWal_VersionNo.Text = resultWalletInfo.Wal_VersionNo?.ToString() ?? "1";
                }
            }
            #endregion

            #endregion

            SetCardCtrlsToDetailDS();
            //将最新的值Copy到初始UIModel
            AcceptUIModelChanges();
        }
        /// <summary>
        /// 前端检查-提现
        /// </summary>
        /// <returns></returns>
        private bool ClientCheckForWithdrawal()
        {
            //验证密码
            if (string.IsNullOrEmpty(txtWal_TradingPassword.Text.Trim()))
            {
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0001, new object[] { MsgParam.PASSWORD }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (_withdrawalInfo.Wal_TradingPassword != CryptoHelp.EncodeToMD5(txtWal_TradingPassword.Text.Trim()))
            {
                //密码错误
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0011, new object[] { MsgParam.PASSWORD }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            //验证钱包
            if (string.IsNullOrEmpty(txtWal_No.Text))
            {
                //没有获取到钱包,提现失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            WalletInfoUIModel curWallet = BLLCom.GetWalletByWalletNo(txtWal_No.Text);

            if (string.IsNullOrEmpty(curWallet.Wal_ID) ||
                string.IsNullOrEmpty(curWallet.Wal_No))
            {
                //没有获取到钱包,提现失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            //验证本次提现金额
            if (numThisWithdrawalAmount.Value == null ||
                Convert.ToDecimal(numThisWithdrawalAmount.Value) == 0)
            {
                //本次提现金额不能为零!
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { MsgParam.WITHDRAWALAMOUNT_CANNOTZERO }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (curWallet.Wal_AvailableBalance < Convert.ToDecimal(numThisWithdrawalAmount.Value))
            {
                //提现金额大于钱包可用余额,不能提现!
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0017, new object[] { "提现金额大于钱包可用余额", SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            //确定要提现吗?
            DialogResult dialogResult = MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.I_0003, new object[] { SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dialogResult != DialogResult.OK)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 充值
        /// </summary>
        public override void WalletDepositMoney()
        {
            //待充值的钱包
            WalletInfoUIModel walletToDeposit = new WalletInfoUIModel();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                //选中【详情】Tab的场合
                _bll.CopyModel(DetailDS, walletToDeposit);
            }
            else
            {
                //选中【列表】Tab的场合
                gdGrid.UpdateData();

                var selectedWalletList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (selectedWalletList.Count == 0 || selectedWalletList.Count > 1)
                {
                    //请选择一个钱包进行充值
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0006, new object[] { MsgParam.ONE + SystemTableEnums.Name.EWM_Wallet, SystemNavigateEnum.Name.DEPOSITMONEY }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    for (int i = 0; i < selectedWalletList.Count; i++)
                    {
                        if (i != 0)
                        {
                            selectedWalletList[i].IsChecked = false;
                        }
                        gdGrid.DataSource = GridDS;
                        gdGrid.DataBind();
                    }
                    return;
                }
                _bll.CopyModel(selectedWalletList[0], walletToDeposit);
            }

            if (string.IsNullOrEmpty(walletToDeposit.Wal_ID) ||
                string.IsNullOrEmpty(walletToDeposit.Wal_No))
            {
                //没有获取到钱包,充值失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //钱包相关信息
                { RIAViewParamKey.WalletInfo.ToString(), walletToDeposit },
            };

            //跳转到[钱包充值]
            SystemFunction.ShowViewFromView(MsgParam.WALLET_DEPOSITMONEY, ViewClassFullNameConst.RIA_FrmWalletDepositMoney, true, PageDisplayMode.TabPage, paramViewParameters, null);
        }
        /// <summary>
        /// 前端检查-充值
        /// </summary>
        /// <returns></returns>
        private bool ClientCheckForRecharge()
        {
            //验证钱包
            if (string.IsNullOrEmpty(txtWal_No.Text))
            {
                //请输入有效的钱包
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0002, new object[] { SystemTableColumnEnums.EWM_Wallet.Name.Wal_No }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            WalletInfoUIModel curWallet = BLLCom.GetWalletByWalletNo(txtWal_No.Text);

            if (string.IsNullOrEmpty(curWallet.Wal_ID) ||
                string.IsNullOrEmpty(curWallet.Wal_No))
            {
                //没有获取到钱包,充值失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            //验证本次充值金额
            if (string.IsNullOrEmpty(txtThisDepositAmount.Text) ||
                txtThisDepositAmount.Text == "0")
            {
                //本次充值金额不能为零!
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { MsgParam.DEPOSITAMOUNT_CANNOTZERO }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            //TODO 验证充值基数
            //decimal thisDepositAmount = Convert.ToDecimal(txtThisDepositAmount.Text.Trim() == "" ? "0" : txtThisDepositAmount.Text.Trim());
            ////if (thisDepositAmount > 0 && !BLLCom.HasAuthorityInOrg(LoginInfoDAX.OrgID, SystemAction.IgnoreDepositBaseAmount))
            //if (thisDepositAmount > 0 && !BLLCom.HasAuthorityInOrg(LoginInfoDAX.OrgID, "IgnoreDepositBaseAmount",""))
            //{
            //    int depositBaseAmount = curWallet.Wal_DepositBaseAmount == null || curWallet.Wal_DepositBaseAmount == 0
            //        ? SystemConfigInfo.DepositTimesValue
            //        : Convert.ToInt32(curWallet.Wal_DepositBaseAmount);
            //    if (depositBaseAmount != 0 && base.DetailDS.Wal_Balance % depositBaseAmount != 0)
            //    {
            //        //ErrorMessage.Append(MsgHelp.GetMsg(MsgHelp.E_0000, new object[] { "本次充值金额必须是" + depositBaseAmount + "的整数倍" }));
            //        return false;
            //    }
            //}

            return(true);
        }
        /// <summary>
        /// 验证并获取钱包信息
        /// </summary>
        private void ValidateAndGetWalletInfo()
        {
            //判断钱包是否正常
            MDLEWM_Wallet argsWalletTbModel = new MDLEWM_Wallet();
            string        valicateMessage   = string.Empty;
            string        newWalletNo       = string.Empty;
            bool          valicateResult    = BLLCom.ValidateWallet(WalTransTypeEnum.Name.CZ, Convert.ToDecimal(txtThisDepositAmount.Text == "" ? "0" : txtThisDepositAmount.Text), string.Empty, txtWal_No.Text, string.Empty, string.Empty, string.Empty, ref valicateMessage, ref newWalletNo, ref argsWalletTbModel);

            if (!valicateResult)
            {
                MessageBoxs.Show(Trans.RIA, ToString(),
                                 MsgHelp.GetMsg(MsgCode.I_0000, new object[] { valicateMessage }), MessageBoxButtons.OK,
                                 MessageBoxIcon.Error);
                //清空画面
                InitializeDetailTabControls();
            }
            else
            {
                if (valicateMessage != string.Empty)
                {
                    var dialogResult = MessageBoxs.Show(Trans.RIA, ToString(),
                                                        MsgHelp.GetMsg(MsgCode.I_0000, new object[] { valicateMessage }), MessageBoxButtons.OKCancel,
                                                        MessageBoxIcon.Question);
                    if (dialogResult == DialogResult.OK)
                    {
                        WalletInfoUIModel resultWallet = BLLCom.GetWalletByWalletNo(txtWal_No.Text);
                        if (!string.IsNullOrEmpty(resultWallet.Wal_ID) &&
                            !string.IsNullOrEmpty(resultWallet.Wal_No))
                        {
                            //钱包ID
                            txtWal_ID.Text = resultWallet.Wal_ID;
                            //开户人
                            txtWal_CustomerID.Text   = resultWallet.Wal_CustomerID;
                            txtWal_CustomerName.Text = resultWallet.Wal_CustomerName;
                            //汽修商户
                            mcbAutoFactoryName.SelectedValue = resultWallet.Wal_AutoFactoryCode;
                            //汽修商组织
                            txtWal_AutoFactoryOrgCode.Text = resultWallet.Wal_AutoFactoryOrgCode;
                            //可用余额
                            txtWal_AvailableBalance.Text = (resultWallet.Wal_AvailableBalance ?? 0).ToString();
                            _oldAvailableBalance         = resultWallet.Wal_AvailableBalance ?? 0;
                            //充值基数
                            txtWal_DepositBaseAmount.Text = (resultWallet.Wal_DepositBaseAmount ?? 0).ToString();
                            //钱包版本号
                            txtWal_VersionNo.Text = resultWallet.Wal_VersionNo?.ToString() ?? "1";
                        }
                    }
                    else
                    {
                        //清空画面
                        InitializeDetailTabControls();
                        return;
                    }
                }
                else
                {
                    WalletInfoUIModel resultWallet = BLLCom.GetWalletByWalletNo(txtWal_No.Text);
                    if (!string.IsNullOrEmpty(resultWallet.Wal_ID) &&
                        !string.IsNullOrEmpty(resultWallet.Wal_No))
                    {
                        //钱包ID
                        txtWal_ID.Text = resultWallet.Wal_ID;
                        //开户人
                        txtWal_CustomerID.Text   = resultWallet.Wal_CustomerID;
                        txtWal_CustomerName.Text = resultWallet.Wal_CustomerName;
                        //汽修商户
                        mcbAutoFactoryName.SelectedValue = resultWallet.Wal_AutoFactoryCode;
                        //汽修商组织
                        txtWal_AutoFactoryOrgCode.Text = resultWallet.Wal_AutoFactoryOrgCode;
                        //可用余额
                        txtWal_AvailableBalance.Text = (resultWallet.Wal_AvailableBalance ?? 0).ToString();
                        _oldAvailableBalance         = resultWallet.Wal_AvailableBalance ?? 0;
                        //充值基数
                        txtWal_DepositBaseAmount.Text = (resultWallet.Wal_DepositBaseAmount ?? 0).ToString();
                        //钱包版本号
                        txtWal_VersionNo.Text = resultWallet.Wal_VersionNo?.ToString() ?? "1";
                    }
                }
            }
        }