/// <summary>
        /// 将Grid数据赋值给【详情】Tab内的对应控件
        /// </summary>
        private void SetGridDataToCardCtrls()
        {
            //判断是否允许将【列表】Grid数据设置到【详情】Tab内的对应控件
            if (!IsAllowSetGridDataToCard())
            {
                return;
            }

            SetCardCtrlsToDetailDS();
            base.NewUIModel = DetailDS;

            var activeRowIndex = gdGrid.ActiveRow.Index;

            //判断Grid内[唯一标识]是否为空
            if (gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value == null ||
                string.IsNullOrEmpty(gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value.ToString()))
            {
                return;
            }
            //将选中的Grid行对应数据Model赋值给[DetailDS]
            //********************************************************************************
            //**********************************【重要说明】**********************************
            //*****此处和上面的条件判断必须用GridDS内能唯一标识一条记录的字段作为过滤条件*****
            //********************************************************************************
            DetailDS = GridDS.FirstOrDefault(x => x.APN_ID == gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value);
            if (DetailDS == null || string.IsNullOrEmpty(DetailDS.APN_ID))
            {
                return;
            }

            if (txtAPN_ID.Text != DetailDS.APN_ID ||
                (txtAPN_ID.Text == DetailDS.APN_ID && txtAPN_VersionNo.Text != DetailDS.APN_VersionNo?.ToString()))
            {
                if (txtAPN_ID.Text == DetailDS.APN_ID && txtAPN_VersionNo.Text != DetailDS.APN_VersionNo?.ToString())
                {
                    //数据版本已过期,将加载最新详情。
                    MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0000, new object[] { MsgParam.DataHasOverdue }), MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
                else if (ViewHasChanged())
                {
                    //将放弃之前的修改,是否继续?
                    DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0000, new object[] { MsgParam.ConfirmGiveUpEdit }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dialogResult != DialogResult.OK)
                    {
                        //选中【详情】Tab
                        tabControlFull.Tabs[SysConst.EN_DETAIL].Selected = true;
                        return;
                    }
                }
                //将DetailDS数据赋值给【详情】Tab内的对应控件
                SetDetailDSToCardCtrls();
            }

            //选中【详情】Tab
            tabControlFull.Tabs[SysConst.EN_DETAIL].Selected = true;

            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();
        }
        /// <summary>
        /// 刷新列表
        /// </summary>
        private void RefreshList()
        {
            var curHead = GridDS.FirstOrDefault(x => x.ASAH_ID == DetailDS.ASAH_ID);

            if (curHead != null)
            {
                _bll.CopyModel(DetailDS, curHead);
            }
            else
            {
                GridDS.Insert(0, DetailDS);
            }

            gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 刷新列表
        /// </summary>
        /// <param name="paramIsDelete">是否是删除操作</param>
        private void RefreshList(bool paramIsDelete = false)
        {
            if (paramIsDelete)
            {
                if (tabControlFull.Tabs[SysConst.EN_LIST].Selected)
                {
                    var removeList = _detailGridDS.Where(x => x.IsChecked == true).ToList();
                    foreach (var loopRemove in removeList)
                    {
                        _detailGridDS.Remove(loopRemove);
                    }
                }
                else
                {
                    var curHead = GridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _detailGridDS.Remove(curHead);
                    }
                }
            }
            else
            {
                if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
                {
                    var curHead = _detailGridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _bll.CopyModel(DetailDS, curHead);
                    }
                    else
                    {
                        _detailGridDS.Insert(0, DetailDS);
                    }
                }
            }

            gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
        /// <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();
        }