private void btnExcelTemplate_Click(object sender, EventArgs e) { try { this.btnExcelTemplate.Enabled = false; var targetDirectoryName = "DataTemplate\\AccountingDelivery"; var fileName = _securityAccount.ToString() + ".xlsx"; var templateFilePath = Path.Combine(Application.StartupPath, targetDirectoryName, fileName); if (!File.Exists(templateFilePath)) { DXMessage.ShowTips("Sorry!未找到对应的Excel模板文件!"); return; } //弹出显示模板Excel DisplayTemplateDialog(templateFilePath); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnExcelTemplate.Enabled = true; } }
private void btnOk_Click(object sender, EventArgs e) { try { this.btnOk.Enabled = false; if (this.txtSplitVolume.Text.Trim().Length == 0 || int.Parse(this.txtSplitVolume.Text.Trim()) < 1 || int.Parse(this.txtSplitVolume.Text.Trim()) >= Math.Abs(this._record.DealVolume)) { DXMessage.ShowTips(string.Format("拆单数量应该为 0 ~ {0} 之间!", Math.Abs(this._record.DealVolume))); this.txtSplitVolume.Focus(); return; } if (DXMessage.ShowYesNoAndTips("确定进行本次拆单操作么?") == System.Windows.Forms.DialogResult.Yes) { //交易记录拆单处理 SplitProcess(); this.RefreshEvent?.Invoke(); this.Close(); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnOk.Enabled = true; } }
private void btnEdit_Click(object sender, EventArgs e) { try { this.btnEdit.Enabled = false; var myView = this.gvContent; var selectedHandles = myView.GetSelectedRows(); if (selectedHandles.Any()) { selectedHandles = selectedHandles.Where(x => x > -1).ToArray(); } if (selectedHandles.Length != 1) { DXMessage.ShowTips("请选择一个要编辑的行!"); return; } var categoryId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colCategoryId).ToString()); var contentId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colId).ToString()); DisplayEditDialog(categoryId, contentId); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnEdit.Enabled = true; } }
private void btnTransfer_Click(object sender, EventArgs e) { try { this.btnTransfer.Enabled = false; var myView = this.gridView1; var selectedHandles = myView.GetSelectedRows(); if (selectedHandles.Length != 1) { DXMessage.ShowTips("请选择要转移的股票信息!"); return; } var record = myView.GetRow(selectedHandles[0]) as StockPositionModel; if (record.StockHoldingVolume == 0) { DXMessage.ShowTips("持仓数量为0的股票无法进行转移操作!"); return; } DisplayEditDialog(record); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnTransfer.Enabled = true; } }
private void btnExportDetail_Click(object sender, EventArgs e) { try { this.btnExportDetail.Enabled = false; if (this.gcStockProfit.DataSource != null) { string curDate = this.gvInvestorProfit.GetFocusedDataRow()?["TradeDate"].ToString().Replace("-", ""); string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string fileName = "股票收益明细_" + curDate + "_" + this._investorName + ".xlsx"; string destinyFilePath = Path.Combine(filePath, fileName); if (File.Exists(destinyFilePath)) { File.Delete(destinyFilePath); } this.gvStockProfit.ExportToXlsx(destinyFilePath); DXMessage.ShowTips($@"报表[{fileName}]已成功导出至桌面!"); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnExportDetail.Enabled = true; } }
private void ExecuteComfirmProcess() { this._succeedFlag = false; if (this.chkNo.Checked) { DataTable dtRecords = this.gridControl1.DataSource as DataTable; if (dtRecords != null && dtRecords.Rows.Count > 0) { if (DXMessage.ShowYesNoAndWarning("该决策操作已经关联交易记录,继续处理将取消关联!") == System.Windows.Forms.DialogResult.No) { return; } } } var executeFlag = this.chkNo.Checked ? (int)EnumLibrary.IDOperationExecuteStatus.Unexecuted : (int)EnumLibrary.IDOperationExecuteStatus.Executed; var connString = System.Configuration.ConfigurationManager.ConnectionStrings["CTMContext"].ToString(); var commandText = $@"EXEC [dbo].[sp_IDOperationExecuteProcess] @ApplyNo = '{ApplyNo}',@OperateNo = '{OperateNo}' , @ExecuteFlag = {executeFlag}"; SqlHelper.ExecuteNonQuery(connString, CommandType.Text, commandText); DXMessage.ShowTips("执行状态更新成功!"); this._succeedFlag = true; }
private bool InputCheck() { if (string.IsNullOrEmpty(this.txtCode.Text.Trim())) { DXMessage.ShowTips("用户编码不能为空!"); this.txtCode.Focus(); return(false); } if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { DXMessage.ShowTips("用户名称不能为空!"); this.txtName.Focus(); return(false); } if (this.cbPosition.SelectedIndex == -1) { DXMessage.ShowTips("请选择职位!"); return(false); } if (this.luDepartment.EditValue == null || this.luDepartment.EditValue.ToString() == "nulltext") { DXMessage.ShowTips("请选择部门!"); return(false); } return(true); }
private void btnExportFlow_Click(object sender, EventArgs e) { try { this.btnExportFlow.Enabled = false; if (this.gcInvestorProfit.DataSource != null) { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string fileName = "交易员收益流水_" + DateTime.Now.ToString("yyyyMMdd") + "_" + this._investorName + ".xlsx"; string destinyFilePath = Path.Combine(filePath, fileName); if (File.Exists(destinyFilePath)) { File.Delete(destinyFilePath); } this.gvInvestorProfit.ExportToXlsx(destinyFilePath); DXMessage.ShowTips($@"报表[{fileName}]已成功导出至桌面!"); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnExportFlow.Enabled = true; } }
/// <summary> /// 编辑账户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, EventArgs e) { try { var myView = this.gridView1; var selectedHandles = myView.GetSelectedRows(); if (selectedHandles.Any()) { selectedHandles = selectedHandles.Where(x => x > -1).ToArray(); } if (selectedHandles.Length != 1) { DXMessage.ShowTips("请选择一个要编辑的账户!"); return; } //账户Id var accountId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colAccountId).ToString()); DisplayEditDialog(accountId); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } }
/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { var tradeDate = this.deTradeDate.Text.Trim(); var accountId = string.IsNullOrEmpty(luAccount.SelectedValue()) ? 0 : int.Parse(this.luAccount.SelectedValue()); var tradeType = this.cbTradeType.SelectedValue(); var beneficiary = this.luBeneficiary.SelectedValue(); if (CommonHelper.IsDate(tradeDate) || accountId > 0 || !string.IsNullOrEmpty(tradeType) || !string.IsNullOrEmpty(beneficiary)) { this.btnSave.Enabled = false; UpdateGridView(tradeDate, accountId, tradeType, beneficiary); UpdateRecords(tradeDate, accountId, tradeType, beneficiary); this._saveSucceed = true; DXMessage.ShowTips("交易数据修改成功!"); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); return; } finally { this.btnSave.Enabled = true; } }
private void btnOk_Click(object sender, EventArgs e) { try { btnOk.Enabled = false; var myView = this.gridView1; var selectedHandles = myView.GetSelectedRows().Where(x => x > -1).ToArray(); if (DXMessage.ShowYesNoAndWarning("确定将选择的交易记录关联到决策操作记录吗?") == System.Windows.Forms.DialogResult.Yes) { var recordIds = new List <int>(); for (var rowhandle = 0; rowhandle < selectedHandles.Length; rowhandle++) { recordIds.Add(int.Parse(myView.GetRowCellValue(selectedHandles[rowhandle], "RecordId").ToString())); } this._IDService.AddIDOperationRelatedRecords(ApplyNo, OperateNo, recordIds); DXMessage.ShowTips("交易记录关联操作成功!"); this.RefreshEvent?.Invoke(); this.Close(); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); btnOk.Enabled = true; } }
/// <summary> /// 绑定账户信息 /// </summary> private void BindAccountInfo() { //证券公司 var securityCompanyName = this.luSecurityCompany.Text.Trim(); var securityCompanyCode = int.Parse(this.luSecurityCompany.EditValue.ToString().Trim()); //账户属性 var accountAttribute = this.cbAccountAttribute.SelectedItem as ComboBoxItemModel; var accountAttributeName = accountAttribute.Text.Trim(); var accountAttributeCode = int.Parse(accountAttribute.Value.Trim()); //检查选中的证券公司和账户属性是否支持导入处理 _securityAccount = _dataImportCommonService.GetSelectedSecurityCompanyEnum(securityCompanyName, accountAttributeName); if (_securityAccount == EnumLibrary.SecurityAccount.Unknown) { DXMessage.ShowTips($"证券公司【{securityCompanyName}】的【{accountAttributeName}】账户暂不支持数据导入功能,请联系管理员!"); return; } var accounts = _accountService.GetAccountDetails(securityCompanyCode: securityCompanyCode, attributeCode: accountAttributeCode).OrderBy(x => x.Name).ToList(); this.gridControlAccount.DataSource = accounts; if (accounts.Count == 0) { DXMessage.ShowTips($"证券公司【{securityCompanyName}】没有账户属性为【{accountAttributeName}】的账户信息,请重新选择!"); } else if (accounts.Count > 1) { this.gridViewAccount.ClearSelection(); _accountViewFirstDisplay = true; } }
private void btnCopy_Click(object sender, EventArgs e) { try { btnCopy.Enabled = false; if (string.IsNullOrEmpty(this.luBeneficiary.SelectedValue())) { DXMessage.ShowTips("请选择实际受益人!"); return; } if (string.IsNullOrEmpty(this.cbTradeType.SelectedValue())) { DXMessage.ShowTips("请选择交易类别!"); return; } if (DXMessage.ShowYesNoAndTips("是否确定导入?") == System.Windows.Forms.DialogResult.Yes) { CopyProcess(); BindTradeData(); this._modifiedFlag = true; } else { btnCopy.Enabled = true; } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton3_Click(object sender, EventArgs e) { var selectedNode = this.treeList1.FocusedNode; if (selectedNode == null) { DXMessage.ShowTips("请选择要删除的部门。"); return; } var department = _departmentService.GetDepartmentInfoById(int.Parse(selectedNode.GetValue(colId).ToString())); if (department != null) { // department.IsDeleted = true; var childDepts = _departmentService.GetChildDepartmentsById(department.Id); if (childDepts != null && childDepts.Count > 0) { DXMessage.ShowWarning(string.Format("部门【{0}】存在下级部门,无法删除!", department.Name)); return; } var result = DXMessage.ShowYesNoAndTips(string.Format("确定删除部门【{0}】么?", department.Name)); if (result == DialogResult.Yes) { _departmentService.DeleteDepartmentInfo(department); BindDepartment(); } } }
private void btnSearch_Click(object sender, EventArgs e) { try { this._isSearched = true; this.btnSearch.Enabled = false; if (string.IsNullOrEmpty(this.luAccount.SelectedValue())) { DXMessage.ShowTips("请选择账号信息!"); return; } BindDiffInfo(); } catch (Exception ex) { DXMessage.ShowError(ex.Message); this.gridControl1.DataSource = null; } finally { this.btnSearch.Enabled = true; } }
private void btnOK_Click(object sender, EventArgs e) { try { this.btnOK.Enabled = false; var content = this.memoContent.Text.Trim(); if (string.IsNullOrEmpty(content)) { DXMessage.ShowTips($"{ContentTitle}不能为空!"); this.memoContent.Focus(); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; ReturnEvent?.Invoke(content); this.Close(); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnOK.Enabled = true; } }
/// <summary> /// 加入股票池 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { try { this.btnAdd.Enabled = false; if (string.IsNullOrEmpty(this.luStockLeft.SelectedValue())) { DXMessage.ShowTips("请选择要添加的股票信息!"); return; } var stockCode = luStockLeft.SelectedValue(); DisplayPoolEditDialog(stockCode); this.luStockLeft.EditValue = null; } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnAdd.Enabled = true; } }
private void btnResetPwd_Click(object sender, EventArgs e) { try { this.btnResetPwd.Enabled = false; var myView = this.gridView1; var selectedHandles = myView.GetSelectedRows(); if (DXMessage.ShowYesNoAndWarning("确定重置选择的用户密码吗?") == DialogResult.Yes) { var userIds = new List <int>(); for (var rowhandle = 0; rowhandle < selectedHandles.Length; rowhandle++) { userIds.Add(int.Parse(myView.GetRowCellValue(selectedHandles[rowhandle], colId).ToString())); myView.UnselectRow(selectedHandles[rowhandle]); } this._userService.ResetPwd(userIds.ToArray()); DXMessage.ShowTips("密码重置成功!【新密码为用户编码】"); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } }
private void SaveAMIFund() { if (string.IsNullOrEmpty(txtTotalAsset.Text.Trim())) { DXMessage.ShowTips("请输入总资产!"); txtTotalAsset.Focus(); return; } if (string.IsNullOrEmpty(txtAvailableFund.Text.Trim())) { DXMessage.ShowTips("请输入可用资金!"); txtAvailableFund.Focus(); return; } if (string.IsNullOrEmpty(txtPositionValue.Text.Trim())) { DXMessage.ShowTips("请输入持仓市值!"); txtPositionValue.Focus(); return; } if (string.IsNullOrEmpty(txtFinancingLimit.Text.Trim())) { DXMessage.ShowTips("请输入可融资额!"); txtFinancingLimit.Focus(); return; } if (string.IsNullOrEmpty(txtFinancedAmount.Text.Trim())) { DXMessage.ShowTips("请输入已融资额!"); txtFinancedAmount.Focus(); return; } var fundInfo = new MIAccountFund { AccountCode = _currentAccountCode, AccountId = _currentAccountId, YearMonth = _currentYear * 100 + _currentMonth, AvailableFund = Convert.ToDecimal(this.txtAvailableFund.Text.Trim()), FinancedAmount = Convert.ToDecimal(this.txtFinancedAmount.Text.Trim()), FinancingLimit = Convert.ToDecimal(this.txtFinancingLimit.Text.Trim()), PositionValue = Convert.ToDecimal(this.txtPositionValue.Text.Trim()), TotalAsset = Convert.ToDecimal(this.txtTotalAsset.Text.Trim()), }; _statementService.SaveMIAccountFund(fundInfo); DXMessage.ShowTips("保存成功!"); BindAMIFund(); }
private bool CheckInput() { if (string.IsNullOrEmpty(this.luReceiver.SelectedValue())) { DXMessage.ShowTips("请选择接收人员!"); return(false); } if (string.IsNullOrEmpty(this.luReceivedAccount.SelectedValue())) { DXMessage.ShowTips("请选择接收账户!"); return(false); } if (this.txtTransferVolume.Text.Length == 0) { DXMessage.ShowTips("请输入转移数量!"); return(false); } var holdingVolume = int.Parse(this.txtHoldingVolume.Text.Trim()); var transferVolume = int.Parse(this.txtTransferVolume.Text.Trim()); if (holdingVolume > 0) { if (transferVolume < 1 || transferVolume > holdingVolume) { DXMessage.ShowTips(string.Format("转移数量为 1 ~ {0} 之间!", holdingVolume)); return(false); } } else { if (transferVolume > -1 || transferVolume < holdingVolume) { DXMessage.ShowTips(string.Format("转移数量为 {0} ~ -1 之间!", holdingVolume)); return(false); } } if (this.txtTransferPrice.Text.Length == 0) { DXMessage.ShowTips("请输入转移价格!"); return(false); } if (decimal.Parse(this.txtTransferPrice.Text.Trim()) <= 0) { DXMessage.ShowTips("转移价格必须大于0!"); return(false); } return(true); }
private void btnOk_Click(object sender, EventArgs e) { if (this.luPrincipal.EditValue == null || this.luPrincipal.EditValue.ToString() == "nulltext") { DXMessage.ShowTips("请选择主要负责人!"); return; } var principal = this.luPrincipal.SelectedValue(); var logModel = new InvestmentDecisionStockPoolLog() { StockCode = StockCode, Principal = principal, OperatorCode = LoginInfo.CurrentUser.UserCode, OperateTime = _commonService.GetCurrentServerTime(), }; //修改股票池的场合 if (this._isEdit) { var stockPool = _IDService.GetIDStockPoolByCode(StockCode); stockPool.Principal = principal; stockPool.Remarks = this.memoRemarks.Text.Trim(); _IDService.UpdateIDStockPool(stockPool); logModel.Type = (int)EnumLibrary.OperateType.Edit; } //添加股票池的场合 else { var stockPool = new InvestmentDecisionStockPool { StockCode = this.txtCode.Text.Trim(), StockName = this.txtName.Text.Trim(), Principal = principal, Remarks = this.memoRemarks.Text.Trim(), }; _IDService.AddIDStockPool(stockPool); logModel.Type = (int)EnumLibrary.OperateType.Add; } //添加股票池操作日志 _IDService.AddIDStockPoolLog(logModel); RefreshEvent?.Invoke(); this.Close(); }
private void tlCategory_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (e.Column == this.tcName) { if (string.IsNullOrEmpty(e.Value.ToString().Trim())) { DXMessage.ShowTips("类别名称不能为空!"); return; } var id = Convert.ToInt32(e.Node.GetValue(tcId)); var name = e.Value.ToString().Trim(); _IDService.UpdateIDReasonCategory(id, name); } }
private void treeList1_CellValueChanged(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e) { if (e.Column == this.tcName) { if (string.IsNullOrEmpty(e.Value.ToString().Trim())) { DXMessage.ShowTips("主体名称不能为空!"); return; } var id = Convert.ToInt32(e.Node.GetValue(tcId)); var name = e.Value.ToString().Trim(); var commandText = $@"UPDATE IndustryInfo SET Name = '{name}' WHERE Id = {id }"; SqlHelper.ExecuteNonQuery(AppConfig._ConnString, CommandType.Text, commandText); } }
/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton2_Click(object sender, EventArgs e) { var selectedNode = this.treeList1.FocusedNode; if (selectedNode == null) { DXMessage.ShowTips("请选择要编辑的部门。"); return; } var deptId = int.Parse(selectedNode.GetValue(colId).ToString()); if (deptId > 0) { DisplayEditDialog(deptId); } }
private bool InputCheck() { if (string.IsNullOrEmpty(this.treeListLookUpEdit1.SelectedValue())) { DXMessage.ShowTips("请选择类别!"); return(false); } if (string.IsNullOrEmpty(this.memoContent.Text.Trim())) { DXMessage.ShowTips("内容不能为空!"); this.memoContent.Focus(); return(false); } return(true); }
private bool InputCheck() { if (string.IsNullOrEmpty(this.txtStockCode.Text.Trim())) { DXMessage.ShowTips("股票代码不能为空!"); this.txtStockCode.Focus(); return(false); } if (string.IsNullOrEmpty(this.txtStockName.Text.Trim())) { DXMessage.ShowTips("股票名称不能为空!"); this.txtStockName.Focus(); return(false); } return(true); }
private void btnDelete_Click(object sender, EventArgs e) { try { this.btnDelete.Enabled = false; var myView = this.gvContent; var selectedHandles = myView.GetSelectedRows(); if (selectedHandles.Length == 0) { DXMessage.ShowTips("请选择要删除的行!"); return; } if (DXMessage.ShowYesNoAndWarning("确定删除选择的行吗?") == DialogResult.Yes) { var contentIds = new List <int>(); for (var rowhandle = 0; rowhandle < selectedHandles.Length; rowhandle++) { contentIds.Add(int.Parse(myView.GetRowCellValue(selectedHandles[rowhandle], colId).ToString())); } this._IDService.DeleteIDReasonContent(contentIds.ToArray()); var focusedNode = this.tlCategory.FocusedNode; var categoryId = Convert.ToInt32(focusedNode.GetValue(tcId)); RefreshForm(categoryId); } } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnDelete.Enabled = true; } }
private bool InputCheck() { if (txtName.Text.Trim().Length == 0) { DXMessage.ShowTips("部门名称不能为空!"); this.txtName.Focus(); return(false); } if (this._currentDeptInfo == null || this._currentDeptId == 0) { if (_departmentService.IsDepartmentExisted(txtName.Text.Trim())) { DXMessage.ShowTips("该部门名称已经存在!"); this.txtName.Focus(); return(false); } } return(true); }
/// <summary> /// 画面输入检查 /// </summary> /// <returns></returns> private bool InputCheck() { if (string.IsNullOrEmpty(this.txtAccountName.Text.Trim())) { DXMessage.ShowTips("账户名称不能为空!"); this.txtAccountName.Focus(); return(false); } if (this.cbIndustry.SelectedIndex == -1) { DXMessage.ShowTips("请选择所属产业!"); return(false); } if (this.cbSecurity.SelectedIndex == -1) { DXMessage.ShowTips("请选择开户券商!"); return(false); } if (this.cbAttribute.SelectedIndex == -1) { DXMessage.ShowTips("请选择账户属性!"); return(false); } if (this.cbType.SelectedIndex == -1) { DXMessage.ShowTips("请选择账户分类!"); return(false); } if (this.cbType.SelectedIndex == -1) { DXMessage.ShowTips("请选择账户规划!"); return(false); } return(true); }
private void Export2ExcelCompleted(object sender, RunWorkerCompletedEventArgs e) { this.lciProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.mpbExport.Properties.Stopped = true; this.mpbExport.Enabled = false; var msg = string.Empty; if (e.Error == null && e.Result == null) { msg = "报表导出成功!已保存到桌面!"; } else { msg = e.Error == null?e.Result?.ToString() : e.Error.Message; } DXMessage.ShowTips(msg); this.btnExport.Enabled = true; }