/// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmWalletWithdrawalDialogWindow_Load(object sender, EventArgs e)
        {
            #region 固定

            //初始化【详情】Tab内控件
            InitializeDetailTabControls();
            #endregion

            #region 处理参数

            if (_viewParameters == null)
            {
                return;
            }

            #region 钱包相关信息

            if (_viewParameters.ContainsKey(ComViewParamKey.DestModel.ToString()))
            {
                _withdrawalInfo = _viewParameters[ComViewParamKey.DestModel.ToString()] as WalletWithdrawalUIModel;

                if (_withdrawalInfo != null)
                {
                    //开户人
                    txtWal_CustomerName.Text = _withdrawalInfo.Wal_CustomerName;
                    //开户组织
                    txtWal_Org_Name.Text = _withdrawalInfo.Wal_Org_Name;
                    //钱包账号
                    txtWal_No.Text = _withdrawalInfo.Wal_No;
                    //可用余额
                    txtWal_AvailableBalance.Text = (_withdrawalInfo.Wal_AvailableBalance ?? 0).ToString();
                }
            }
            #endregion

            #endregion
        }
        /// <summary>
        /// 提现
        /// </summary>
        public override void WithdrawCashAction()
        {
            //当前钱包
            MDLEWM_Wallet curWallet = new MDLEWM_Wallet();
            string        walletNo  = string.Empty;

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情提现

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

                walletNo = DetailDS.Wal_No;
                _bll.CopyModel(DetailDS, curWallet);
            }
            else
            {
                #region 列表提现

                gdGrid.UpdateData();

                var checkedWallet = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedWallet.Count != 1)
                {
                    //请勾选一个钱包提现!
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "请勾选一个钱包提现!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (string.IsNullOrEmpty(checkedWallet[0].Wal_ID) ||
                    string.IsNullOrEmpty(checkedWallet[0].Wal_No))
                {
                    //没有获取到钱包,提现失败
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.EWM_Wallet, SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                walletNo = checkedWallet[0].Wal_No;
                _bll.CopyModel(checkedWallet[0], curWallet);

                #endregion
            }

            string argsResultMessage = string.Empty;
            string argsNewWalletNo   = string.Empty;
            bool   validateResult    = BLLCom.ValidateWallet(WalTransTypeEnum.Name.TX, 0, string.Empty,
                                                             walletNo, string.Empty, string.Empty, string.Empty, ref argsResultMessage, ref argsNewWalletNo, ref curWallet);
            if (!validateResult)
            {
                MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { argsResultMessage }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            WalletWithdrawalUIModel withdrawalWallet = new WalletWithdrawalUIModel();
            _bll.CopyModel(curWallet, withdrawalWallet);

            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //操作参数Key
                { ComViewParamKey.EnumKeyOperation.ToString(), Operation.Show },
                //新打开界面的Model
                { ComViewParamKey.DestModel.ToString(), withdrawalWallet }
            };

            FrmWalletWithdrawalDialogWindow frmWalletWithdrawalDialogWindow = new FrmWalletWithdrawalDialogWindow(paramViewParameters)
            {
                StartPosition = FormStartPosition.CenterScreen
            };
            DialogResult dialogResult = frmWalletWithdrawalDialogWindow.ShowDialog();

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

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                _bll.CopyModel(withdrawalWallet, DetailDS);
                //刷新列表
                RefreshList();
            }
            else
            {
                var curHead = GridDS.FirstOrDefault(x => x.Wal_ID == withdrawalWallet.Wal_ID);
                if (curHead != null)
                {
                    _bll.CopyModel(withdrawalWallet, curHead);
                }
            }

            SetDetailDSToCardCtrls();
            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();
        }
예제 #3
0
        /// <summary>
        /// 提现
        /// </summary>
        /// <param name="paramModel">UIModel</param>
        /// <returns></returns>
        public bool SaveDetailDS(WalletWithdrawalUIModel paramModel)
        {
            var funcName = "SaveDetailDS";

            LogHelper.WriteBussLogStart(BussID, LoginInfoDAX.UserName, funcName, "", "", null);

            #region 准备数据

            //将UIModel转为TBModel
            var argsWallet = CopyModel <MDLEWM_Wallet>(paramModel);
            //待保存的钱包异动日志
            MDLEWM_WalletTrans newWalletTrans = new MDLEWM_WalletTrans();

            #region 更新[电子钱包]
            argsWallet.Wal_UpdatedBy       = LoginInfoDAX.UserName;
            argsWallet.Wal_UpdatedTime     = BLLCom.GetCurStdDatetime();
            argsWallet.WHERE_Wal_ID        = argsWallet.Wal_ID;
            argsWallet.WHERE_Wal_VersionNo = argsWallet.Wal_VersionNo;
            #endregion

            if (paramModel.ThisWithdrawalAmount > 0)
            {
                //生成钱包异动日志
                newWalletTrans = BLLCom.CreateWalletTrans(new MDLEWM_WalletTrans()
                {
                    WalT_Org_ID   = LoginInfoDAX.OrgID,
                    WalT_Org_Name = LoginInfoDAX.OrgShortName,
                    WalT_Wal_ID   = argsWallet.Wal_ID,
                    WalT_Wal_No   = argsWallet.Wal_No,
                    //异动类型为{提现}
                    WalT_TypeName = WalTransTypeEnum.Name.TX,
                    WalT_TypeCode = WalTransTypeEnum.Code.TX,
                    //异动金额
                    WalT_Amount      = -paramModel.ThisWithdrawalAmount,
                    WalT_ChannelName = LoginTerminalEnum.Name.PC,
                    WalT_ChannelCode = LoginTerminalEnum.Code.PC,
                    WalT_Remark      = argsWallet.Wal_Remark,
                });
            }
            #endregion

            #region 带事务的保存

            try
            {
                DBManager.BeginTransaction(DBCONFIG.Coeus);

                #region 保存[电子钱包]

                bool saveWalletResult = _bll.Save(argsWallet);
                if (!saveWalletResult)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.RECHARGE + SystemTableEnums.Name.EWM_Wallet });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                #region 保存[电子钱包异动]

                bool insertWalletTransResult = _bll.Insert(newWalletTrans);
                if (!insertWalletTransResult)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.NEW + SystemTableEnums.Name.EWM_WalletTrans });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }
                #endregion

                DBManager.CommitTransaction(DBCONFIG.Coeus);
            }
            catch (Exception ex)
            {
                DBManager.RollBackTransaction(DBCONFIG.Coeus);
                ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.RECHARGE, ex.Message });
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ex.Message, "", null);
                return(false);
            }

            #endregion

            //将最新数据回写给DetailDS
            CopyModel(argsWallet, paramModel);

            return(true);
        }