/// <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> /// <param name="paramIsDelete">是否是删除操作</param> private void RefreshList(bool paramIsDelete = false) { if (paramIsDelete) { if (tabControlFull.Tabs[SysConst.EN_LIST].Selected) { var removeList = GridDS.Where(x => x.IsChecked == true).ToList(); foreach (var loopRemove in removeList) { GridDS.Remove(loopRemove); } } else { var curHead = GridDS.FirstOrDefault(x => x.APT_ID == DetailDS.APT_ID); if (curHead != null) { GridDS.Remove(curHead); } } } else { var curHead = GridDS.FirstOrDefault(x => x.APT_ID == DetailDS.APT_ID); if (curHead != null) { _bll.CopyModel(DetailDS, curHead); } else { GridDS.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(); }
/// <summary> /// 销户 /// </summary> public override void CloseAccountAction() { //当前钱包 WalletQueryAndOperateUIModel curWallet = new WalletQueryAndOperateUIModel(); #region 验证以及准备数据 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.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #endregion curWallet = DetailDS; } 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.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } curWallet = checkedWallet[0]; #endregion } //判断钱包有无应收款 var noSettleBill = BLLCom.GetNoSettleBillByCustomerID(curWallet.Wal_CustomerID); if (noSettleBill.Count > 0) { MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "钱包的开户人还有未结算的单据,请先收款" }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (curWallet.Wal_AvailableBalance > 0) { MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "该钱包余额大于零,请提现后销户" }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //提示信息 string warningMessage = "您是否需要销户?\n"; warningMessage += "钱包账号:" + curWallet.Wal_No + "\n"; warningMessage += "开户组织:" + curWallet.Wal_CreatedByOrgName + "\n"; warningMessage += "开户人:" + curWallet.Wal_CustomerName + "\n"; warningMessage += "可用余额:" + curWallet.Wal_AvailableBalance + "\n"; //弹提示框 DialogResult dialogResult = MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, warningMessage), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } #endregion #region 保存数据 bool closeAccountResult = _bll.CloseAccountDetailDS(curWallet); if (!closeAccountResult) { //销户失败 MessageBoxs.Show(Trans.RIA, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //销户成功 MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); #endregion //刷新列表 RefreshList(); //4.将DetailDS数据赋值给【详情】Tab内的对应控件 SetDetailDSToCardCtrls(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); //设置详情页面控件以及导航按钮是否可编辑 SetDetailControl(); }
/// <summary> /// 删除 /// </summary> public override void DeleteAction() { //2.执行删除 #region 准备数据 //待删除的码表列表 List <MDLSM_CodeTable> deleteCodeTableList = new List <MDLSM_CodeTable>(); if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { #region 详情删除 if (string.IsNullOrEmpty(txtCT_ID.Text)) { //码表信息为空,不能删除 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.SM_CodeTable, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //查询[码表]是否被引用过 var usedCount = 0; _bll.QueryForObject <Int32>(SQLID.BS_CodeTableManager_SQL03, new MDLSM_CodeTable { WHERE_CT_Type = cbCT_Type.Text.Trim(), WHERE_CT_Name = txtCT_Name.Text.Trim() }); if (usedCount > 0) { MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0003, new object[] { SystemTableEnums.Name.SM_CodeTable }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //确认删除操作 DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } //待删除的码表 MDLSM_CodeTable deleteCodeTable = new MDLSM_CodeTable { WHERE_CT_ID = txtCT_ID.Text.Trim() }; deleteCodeTableList.Add(deleteCodeTable); #endregion } else { #region 列表删除 gdGrid.UpdateData(); //勾选的码表列表 List <CodeTableManagerUIModel> checkedCodeTableList = GridDS.Where(x => x.IsChecked == true).ToList(); if (checkedCodeTableList.Count == 0) { MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.SM_CodeTable, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #region 查询码表是否被引用过 //勾选的[码表]列表中已被引用的[码表]列表 List <CodeTableManagerUIModel> checkedUsedList = new List <CodeTableManagerUIModel>(); foreach (var loopCodeTable in checkedCodeTableList) { var resultUsedCount = _bll.QueryForObject <Int32>(SQLID.BS_CodeTableManager_SQL03, new MDLSM_CodeTable { WHERE_CT_Type = loopCodeTable.CT_Type, WHERE_CT_Name = loopCodeTable.CT_Name }); if (resultUsedCount > 0) { loopCodeTable.IsChecked = false; checkedUsedList.Add(loopCodeTable); } } if (checkedUsedList.Count > 0) { //勾选的列表中包含已被引用的[码表],是否忽略 DialogResult continueDelete = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0026, new object[] { }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (continueDelete != DialogResult.OK) { foreach (var loopCheckedUsed in checkedUsedList) { loopCheckedUsed.IsChecked = false; } gdGrid.DataSource = GridDS; gdGrid.DataBind(); return; } checkedCodeTableList.RemoveAll(x => x.IsChecked == false); gdGrid.DataSource = GridDS; gdGrid.DataBind(); } else { //勾选的列表中不包含已被引用的[码表] //确认删除操作 DialogResult confirmDeleteResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedCodeTableList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (confirmDeleteResult != DialogResult.OK) { return; } } #endregion foreach (var loopCheckedCodeTable in checkedCodeTableList) { if (string.IsNullOrEmpty(loopCheckedCodeTable.CT_ID)) { continue; } //待删除的码表 MDLSM_CodeTable deleteCodeTable = new MDLSM_CodeTable { WHERE_CT_ID = loopCheckedCodeTable.CT_ID }; deleteCodeTableList.Add(deleteCodeTable); } #endregion } #endregion #region 除数据 if (deleteCodeTableList.Count > 0) { var deleteCodeTableResult = _bll.DeleteCodeTable(deleteCodeTableList); if (!deleteCodeTableResult) { //删除失败 MessageBoxs.Show(Trans.BS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); } //删除成功 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion //3.清空【详情】画面数据 InitializeDetailTabControls(); //刷新列表 RefreshList(true); //将最新的值Copy到初始UIModel SetCardCtrlsToDetailDS(); this.AcceptUIModelChanges(); }
/// <summary> /// 开户 /// </summary> public override void WalletCreateAccount() { //待开户的客户 CustomerQueryUIModel customerToCreateAccount = new CustomerQueryUIModel(); if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { //选中【详情】Tab的场合 //验证该客户是否已开户 List <WalletInfoUIModel> resultWalletList = BLLCom.GetWalletListByOwnerInfo(CustomerTypeEnum.Name.PTKH, DetailDS.GC_ID); if (resultWalletList.Count > 0) { //该客户已开户 MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { "客户:" + DetailDS.GC_Name + "已开户!" }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } customerToCreateAccount.CustomerID = DetailDS.GC_ID; customerToCreateAccount.CustomerName = DetailDS.GC_Name; customerToCreateAccount.CustomerType = CustomerTypeEnum.Name.PTKH; } else { //选中【列表】Tab的场合 gdGrid.UpdateData(); var selectedCustomerList = GridDS.Where(x => x.IsChecked == true).ToList(); if (selectedCustomerList.Count == 0 || selectedCustomerList.Count > 1) { //请选择一个普通客户进行开户 MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0006, new object[] { MsgParam.ONE + SystemTableEnums.Name.PIS_GeneralCustomer, SystemNavigateEnum.Name.CREATEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); for (int i = 0; i < selectedCustomerList.Count; i++) { if (i != 0) { selectedCustomerList[i].IsChecked = false; } gdGrid.DataSource = GridDS; gdGrid.DataBind(); } return; } //验证该客户是否已开户 List <WalletInfoUIModel> resultWalletList = BLLCom.GetWalletListByOwnerInfo(CustomerTypeEnum.Name.PTKH, selectedCustomerList[0].GC_ID); if (resultWalletList.Count > 0) { //该客户已开户 MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { "客户:" + selectedCustomerList[0].GC_Name + "已开户!" }), MessageBoxButtons.OK, MessageBoxIcon.Information); selectedCustomerList[0].IsChecked = false; gdGrid.DataSource = GridDS; gdGrid.DataBind(); return; } customerToCreateAccount.CustomerID = selectedCustomerList[0].GC_ID; customerToCreateAccount.CustomerName = selectedCustomerList[0].GC_Name; customerToCreateAccount.CustomerType = CustomerTypeEnum.Name.PTKH; } if (string.IsNullOrEmpty(customerToCreateAccount.CustomerID) || string.IsNullOrEmpty(customerToCreateAccount.CustomerName)) { //没有获取到客户,开户失败 MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemNavigateEnum.Name.CREATEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Dictionary <string, object> paramViewParameters = new Dictionary <string, object> { //客户信息 { ComViewParamKey.CustomerInfo.ToString(), customerToCreateAccount }, }; //跳转到[钱包开户] SystemFunction.ShowViewFromView(MsgParam.WALLET_CREATEACCOUNT, ViewClassFullNameConst.RIA_FrmWalletCreateAccount, true, PageDisplayMode.TabPage, paramViewParameters, null); }
/// <summary> /// 删除 /// </summary> public override void DeleteAction() { //2.执行删除 #region 准备数据 //待删除的[普通客户]列表 List <MDLPIS_GeneralCustomer> deleteGeneralCustomerList = new List <MDLPIS_GeneralCustomer>(); if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { #region 详情删除 if (string.IsNullOrEmpty(txtGC_ID.Text)) { //普通客户信息为空,不能删除 MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #region 验证普通客户是否已被使用 if (!string.IsNullOrEmpty(txtGC_ID.Text.Trim())) { //验证普通客户是否已被使用 StringBuilder customerIDs = new StringBuilder(); customerIDs.Append(SysConst.Semicolon_DBC + txtGC_ID.Text + SysConst.Semicolon_DBC); //查询普通客户是否被引用过 List <MDLPIS_GeneralCustomer> generalCustomerList = new List <MDLPIS_GeneralCustomer>(); _bll.QueryForList(SQLID.PIS_GeneralCustomerManager_SQL02, new MDLPIS_GeneralCustomer { WHERE_GC_ID = customerIDs.ToString() }, generalCustomerList); if (generalCustomerList.Count > 0) { MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { txtGC_Name.Text.Trim(), MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } #endregion //确认删除操作 DialogResult dialogResult = MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } //待删除的普通客户 MDLPIS_GeneralCustomer deleteGeneralCustomer = new MDLPIS_GeneralCustomer { WHERE_GC_ID = txtGC_ID.Text.Trim() }; deleteGeneralCustomerList.Add(deleteGeneralCustomer); #endregion } else { #region 列表删除 gdGrid.UpdateData(); //勾选的普通客户列表 List <GeneralCustomerManagerUIModel> checkedGeneralCustomerList = GridDS.Where(x => x.IsChecked == true).ToList(); if (checkedGeneralCustomerList.Count == 0) { MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #region 验证普通客户是否已被使用 //验证普通客户是否已被使用 StringBuilder customerIDs = new StringBuilder(); customerIDs.Append(SysConst.Semicolon_DBC); foreach (var loopSelectedItem in checkedGeneralCustomerList) { customerIDs.Append(loopSelectedItem.GC_ID + SysConst.Semicolon_DBC); } //查询普通客户是否被引用过 List <MDLPIS_GeneralCustomer> generalCustomerList = new List <MDLPIS_GeneralCustomer>(); _bll.QueryForList(SQLID.PIS_GeneralCustomerManager_SQL02, new MDLPIS_GeneralCustomer { WHERE_GC_ID = customerIDs.ToString() }, generalCustomerList); if (generalCustomerList.Count > 0) { StringBuilder customerName = new StringBuilder(); int i = 0; foreach (var loopWarehouse in generalCustomerList) { i++; if (i == 1) { customerName.Append(loopWarehouse.GC_Name); } else { customerName.Append(SysConst.Comma_DBC + loopWarehouse.GC_Name); } } //普通客户已经被使用,不能删除 MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { customerName, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #endregion foreach (var loopCheckedGeneralCustomer in checkedGeneralCustomerList) { if (string.IsNullOrEmpty(loopCheckedGeneralCustomer.GC_ID)) { continue; } //待删除的普通客户 MDLPIS_GeneralCustomer deleteGeneralCustomer = new MDLPIS_GeneralCustomer { WHERE_GC_ID = loopCheckedGeneralCustomer.GC_ID }; deleteGeneralCustomerList.Add(deleteGeneralCustomer); } #endregion } #endregion #region 除数据 if (deleteGeneralCustomerList.Count > 0) { var deleteGeneralCustomerResult = _bll.DeleteGeneralCustomer(deleteGeneralCustomerList); if (!deleteGeneralCustomerResult) { //删除失败 MessageBoxs.Show(Trans.PIS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); } //删除成功 MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion //3.清空【详情】画面数据 InitializeDetailTabControls(); //刷新列表 RefreshList(true); //4.将DetailDS数据赋值给【详情】Tab内的对应控件 SetDetailDSToCardCtrls(); //将最新的值Copy到初始UIModel this.AcceptUIModelChanges(); }
/// <summary> /// 删除 /// </summary> public override void DeleteAction() { #region 准备数据 //待删除的车辆品牌车系列表 List <MDLBS_VehicleBrandInspireSumma> deleteVehicleBrandInspireList = new List <MDLBS_VehicleBrandInspireSumma>(); if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { #region 详情删除 if (string.IsNullOrEmpty(txtVBIS_ID.Text)) { MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.BS_VehicleBrandInspireSumma, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //验证品牌车系是否被引用过 List <MDLBS_AutoPartsArchive> usedBrandAndInspireList = new List <MDLBS_AutoPartsArchive>(); _bll.QueryForList(SQLID.BS_VehicleBrandInspireSummaManager_SQL02, new MDLBS_VehicleBrandInspireSumma { WHERE_VBIS_Brand = mcbVBIS_Brand.SelectedValue + SysConst.Semicolon_DBC, WHERE_VBIS_Inspire = mcbVBIS_Inspire.SelectedValue + SysConst.Semicolon_DBC, }, usedBrandAndInspireList); if (usedBrandAndInspireList.Count > 0) { //品牌车系已经被使用,不能删除 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { mcbVBIS_Brand.SelectedText + SysConst.Comma_DBC + mcbVBIS_Inspire.SelectedText, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //确认删除 DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } //待删除的车辆品牌车系 MDLBS_VehicleBrandInspireSumma vehicleBrandInspireToDelete = new MDLBS_VehicleBrandInspireSumma { WHERE_VBIS_ID = txtVBIS_ID.Text.Trim(), VBIS_Brand = mcbVBIS_Brand.SelectedValue, VBIS_Inspire = mcbVBIS_Inspire.SelectedValue, }; deleteVehicleBrandInspireList.Add(vehicleBrandInspireToDelete); #endregion } else { #region 列表删除 gdGrid.UpdateData(); //勾选的品牌车系列表 List <VehicleBrandInspireSummaManagerUIModel> checkedVehicleBrandInspireList = GridDS.Where(x => x.IsChecked == true).ToList(); if (checkedVehicleBrandInspireList.Count == 0) { MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.BS_VehicleBrandInspireSumma, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //验证品牌车系是否被引用过 string vehicleBrandStr = string.Empty; string vehicleInspireStr = string.Empty; foreach (var loopVehicleBrandInspire in checkedVehicleBrandInspireList) { if (string.IsNullOrEmpty(loopVehicleBrandInspire.VBIS_Brand) || string.IsNullOrEmpty(loopVehicleBrandInspire.VBIS_Inspire)) { continue; } vehicleBrandStr += loopVehicleBrandInspire.VBIS_Brand + SysConst.Semicolon_DBC; vehicleInspireStr += loopVehicleBrandInspire.VBIS_Inspire + SysConst.Semicolon_DBC; } List <MDLBS_AutoPartsArchive> usedBrandAndInspireList = new List <MDLBS_AutoPartsArchive>(); _bll.QueryForList(SQLID.BS_VehicleBrandInspireSummaManager_SQL02, new MDLBS_VehicleBrandInspireSumma { WHERE_VBIS_Brand = vehicleBrandStr, WHERE_VBIS_Inspire = vehicleInspireStr, }, usedBrandAndInspireList); if (usedBrandAndInspireList.Count > 0) { string usedBrandstring = string.Empty; foreach (var loopBrandAndInspire in usedBrandAndInspireList) { if (string.IsNullOrEmpty(loopBrandAndInspire.APA_VehicleBrand)) { continue; } usedBrandstring += loopBrandAndInspire.APA_VehicleBrand + SysConst.Comma_DBC; } //品牌车系已经被使用,不能删除 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { usedBrandstring, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //确认删除 DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedVehicleBrandInspireList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } foreach (var loopCheckedVehicleBrandInspire in checkedVehicleBrandInspireList) { if (string.IsNullOrEmpty(loopCheckedVehicleBrandInspire.VBIS_ID)) { continue; } //待删除的车辆品牌车系 MDLBS_VehicleBrandInspireSumma vehicleBrandInspireToDelete = new MDLBS_VehicleBrandInspireSumma { WHERE_VBIS_ID = loopCheckedVehicleBrandInspire.VBIS_ID, VBIS_Brand = loopCheckedVehicleBrandInspire.VBIS_Brand, VBIS_Inspire = loopCheckedVehicleBrandInspire.VBIS_Inspire, }; deleteVehicleBrandInspireList.Add(vehicleBrandInspireToDelete); } #endregion } #endregion #region 除数据 if (deleteVehicleBrandInspireList.Count > 0) { var deleteResult = _bll.DeleteVehicleBrandInspire(deleteVehicleBrandInspireList); if (!deleteResult) { //删除失败 MessageBoxs.Show(Trans.BS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //删除成功 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion //3.清空【详情】画面数据 InitializeDetailTabControls(); //刷新列表 RefreshList(true); //将最新的值Copy到初始UIModel SetCardCtrlsToDetailDS(); this.AcceptUIModelChanges(); }
/// <summary> /// 删除 /// </summary> public override void DeleteAction() { #region 验证删除 //待删除的配件名称列表 List <MDLBS_AutoPartsName> deleteAutoPartsNameList = new List <MDLBS_AutoPartsName>(); if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected) { #region 详情删除 if (string.IsNullOrEmpty(txtAPN_ID.Text)) { //配件名称信息为空,不能删除 MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableColumnEnums.BS_AutoPartsName.Name.APN_Name, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //验证配件名称是否被引用过 List <MDLBS_AutoPartsArchive> usedAutoPartsNameList = new List <MDLBS_AutoPartsArchive>(); _bll.QueryForList(SQLID.BS_AutoPartsNameManager_SQL03, txtAPN_Name.Text + SysConst.Semicolon_DBC, usedAutoPartsNameList); if (usedAutoPartsNameList.Count > 0) { //配件名称已经被使用,不能删除 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { txtAPN_Name.Text, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //确认删除 DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } MDLBS_AutoPartsName deleteAutoPartsName = new MDLBS_AutoPartsName() { WHERE_APN_ID = txtAPN_ID.Text.Trim(), }; deleteAutoPartsNameList.Add(deleteAutoPartsName); #endregion } else { #region 列表删除 gdGrid.UpdateData(); var checkedAutoPartsNameList = GridDS.Where(p => p.IsChecked == true).ToList(); if (checkedAutoPartsNameList.Count == 0) { //请勾选至少一条配件名称信息进行删除 MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableColumnEnums.BS_AutoPartsName.Name.APN_Name, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string autoPartsNameStr = string.Empty; foreach (var loopCheckedAutoPartsName in checkedAutoPartsNameList) { if (string.IsNullOrEmpty(loopCheckedAutoPartsName.APN_Name)) { continue; } autoPartsNameStr += loopCheckedAutoPartsName.APN_Name + SysConst.Semicolon_DBC; } //验证配件名称是否被引用过 List <MDLBS_AutoPartsArchive> usedAutoPartsNameList = new List <MDLBS_AutoPartsArchive>(); _bll.QueryForList(SQLID.BS_AutoPartsNameManager_SQL03, autoPartsNameStr, usedAutoPartsNameList); if (usedAutoPartsNameList.Count > 0) { string usedAutoPartsNameStr = string.Empty; foreach (var loopName in usedAutoPartsNameList) { if (string.IsNullOrEmpty(loopName.APA_Name)) { continue; } usedAutoPartsNameStr += loopName.APA_Name + SysConst.Comma_DBC; } //配件名称已经被使用,不能删除 MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { usedAutoPartsNameStr, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //已选checkedAutoPartsNameList.Count 条数据,确定删除?\r\n单击【确定】删除,【取消】返回。 DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedAutoPartsNameList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return; } _bll.CopyModelList(checkedAutoPartsNameList, deleteAutoPartsNameList); foreach (var loopDeleteAutoPartsName in deleteAutoPartsNameList) { loopDeleteAutoPartsName.WHERE_APN_ID = loopDeleteAutoPartsName.APN_ID; } #endregion } #endregion #region 除数据 if (deleteAutoPartsNameList.Count > 0) { var deleteAutoPartsNameResult = _bll.DeleteAutoPartsName(deleteAutoPartsNameList); if (!deleteAutoPartsNameResult) { //删除失败 MessageBoxs.Show(Trans.BS, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //删除成功 MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion //3.清空【详情】画面数据 InitializeDetailTabControls(); //刷新列表 RefreshList(true); //将最新的值Copy到初始UIModel SetCardCtrlsToDetailDS(); this.AcceptUIModelChanges(); }