Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        private void FrmTimeSharingTradeIdentifier_Load(object sender, EventArgs e)
        {
            try
            {
                ChartInit();

                if (_tradeDate != DateTime.MinValue && _tradeInfo != null)
                {
                    lcgFilter.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                    this._chartGenerated = false;

                    GetViewData();

                    DisplayChart();

                    this._chartGenerated = true;
                }
                else
                {
                    lcgFilter.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;

                    FormInit();

                    luTradeInfo.Focus();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnOk.Enabled = false;

                if (!InputCheck())
                {
                    return;
                }

                var content    = this.memoContent.Text.Trim();
                var categoryId = int.Parse(this.treeListLookUpEdit1.SelectedValue());
                this.DialogResult = System.Windows.Forms.DialogResult.OK;

                ReturnEvent?.Invoke(categoryId, content);

                this.Close();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnOk.Enabled = true;
            }
        }
Esempio n. 4
0
        private void FrmMultiDayProfit_Load(object sender, EventArgs e)
        {
            try
            {
                if (LoginInfo.CurrentUser.IsAdmin)
                {
                    lciAccounting.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                }
                else
                {
                    lciAccounting.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }

                lblMemo.Text = @"每日收益自动核算开始时间为15:35,之后每30分钟核算一次,请确认本日交易数据已正确导入!";

                BindSearchInfo();

                this.btnExport.Enabled      = false;
                this.mpbExport.Enabled      = false;
                this.lciProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                SearchProcess();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 5
0
        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                var gv = sender as DevExpress.XtraGrid.Views.Grid.GridView;

                var row = gv.GetRow(gv.FocusedRowHandle) as AccountEntity;

                if (row == null)
                {
                    return;
                }

                _currentAccountId   = row.Id;
                _currentAccountCode = row.Code;
                _currentAccountInfo = row.DisplayMember;

                var initDate = CommonHelper.StringToDateTime(this.deInit.EditValue.ToString());
                _currentYear  = initDate.Year;
                _currentMonth = initDate.Month;

                this.luStock.EditValue = null;

                BindAMIFund();

                BindAMIPosition();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        private void btnExport2Excel_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnExport2Excel.Enabled = false;

                if (!Directory.Exists(this.txtSavePath.Text.Trim()))
                {
                    throw new DirectoryNotFoundException("保存路径不存在!");
                }

                this.lciProgress.Visibility                       = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                this.mpbUserInvestIncomeFlow.Enabled              = true;
                this.mpbUserInvestIncomeFlow.Properties.Stopped   = false;
                this.mpbUserInvestIncomeFlow.Text                 = "报表生成中...请稍后...";
                this.mpbUserInvestIncomeFlow.Properties.ShowTitle = true;

                var bw = new BackgroundWorker();
                bw.WorkerSupportsCancellation = true;
                bw.DoWork             += new DoWorkEventHandler(Export2ExcelProcess);
                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Export2ExcelCompleted);
                bw.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                GC.Collect();
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 确定按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnSubmit.Enabled = false;

                if (InputCheck())
                {
                    if (this._currentDeptId == 0)
                    {
                        AddDepartmentInfo();
                    }
                    else
                    {
                        UpdateDepartmentInfo();
                    }

                    RefreshEvent?.Invoke();

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnSubmit.Enabled = true;
            }
        }
Esempio n. 9
0
 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;
     }
 }
Esempio n. 10
0
        private void barBtnAddChild_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                TreeListNode currentNode = this.tlCategory.FocusedNode;
                if (currentNode == null)
                {
                    return;
                }
                var peer = new DecisionReasonCategoryEntity
                {
                    Name     = "新建分类",
                    ParentId = Convert.ToInt32(currentNode.GetValue(tcId)),
                    Remarks  = null,
                };
                peer.Id = _IDService.AddIDReasonCategory(peer);

                var source = this.tlCategory.DataSource as List <DecisionReasonCategoryEntity>;
                source.Add(peer);
                this.tlCategory.RefreshDataSource();
                this.tlCategory.SetFocusedNode(this.tlCategory.FocusedNode.LastNode);
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 11
0
        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;
            }
        }
Esempio n. 12
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var myView = this.gridView1;

                var selectedHandles = myView.GetSelectedRows();

                if (selectedHandles.Length == 0)
                {
                    return;
                }

                selectedHandles = myView.GetSelectedRows().Where(x => x > -1).ToArray();

                if (DXMessage.ShowYesNoAndWarning("确定删除选择的申请单吗?") == DialogResult.Yes)
                {
                    var serialNos = new List <string>();

                    for (var rowhandle = 0; rowhandle < selectedHandles.Length; rowhandle++)
                    {
                        serialNos.Add(myView.GetRowCellValue(selectedHandles[rowhandle], colSerialNo).ToString());
                    }

                    this._IDService.DeleteInvestmentDecisionForm(serialNos.ToArray());

                    BindApplicationInfo();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 13
0
 private void btnDelete_R_Click(object sender, EventArgs e)
 {
     try
     {
         btnDelete_R.Enabled = false;
         if (DXMessage.ShowYesNoAndTips("是否确定删除选择的交割单?") == System.Windows.Forms.DialogResult.Yes)
         {
             IList <int> recordIds  = new List <int>();
             var         rowHandles = gridView2.GetSelectedRows();
             foreach (var rowIndex in rowHandles)
             {
                 var curId = int.Parse(gridView2.GetRowCellValue(rowIndex, this.colId_R).ToString());
                 recordIds.Add(curId);
             }
             _dailyService.DeleteDailyRecords(recordIds.ToArray());
             BindTradeData();
             this._modifiedFlag = true;
         }
         else
         {
             btnDelete_R.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         DXMessage.ShowError(ex.Message);
     }
 }
Esempio n. 14
0
        private void gridView2_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            try
            {
                var myView          = this.gridView2;
                var selectedHandles = myView.GetSelectedRows();
                if (selectedHandles.Any())
                {
                    selectedHandles = selectedHandles.Where(x => x > -1).ToArray();
                }

                if (selectedHandles.Length == 0)
                {
                    this.btnDelete_R.Enabled = false;
                }
                else
                {
                    btnDelete_R.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 15
0
        private void FrmTradeDataVerify_Load(object sender, EventArgs e)
        {
            try
            {
                this.bandedGridView1.LoadLayout(_layoutXmlName);
                this.bandedGridView1.SetLayout(showCheckBoxRowSelect: true, showFilterPanel: true, showGroupPanel: true, showAutoFilterRow: true, rowIndicatorWidth: 50);

                BindSearchInfo();

                this.rgDisplayType.SelectedIndex = 0;

                if (IsExternalRequested)
                {
                    deFrom.EditValue    = FromDate;
                    deTo.EditValue      = ToDate;
                    luAccount.EditValue = AccountId;

                    BindDiffInfo();

                    _isSearched = true;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 16
0
        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;
            }
        }
Esempio n. 17
0
        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;
            }
        }
Esempio n. 18
0
 private void BwInvestorProfit_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         if (e.Result == null && e.Error == null)
         {
             BindInvestorProfit();
             deInvestor.Enabled = true;
         }
         else
         {
             if (e.Result != null)
             {
                 throw new Exception(e.Result.ToString());
             }
             else if (e.Error != null)
             {
                 throw e.Error;
             }
         }
     }
     catch (Exception ex)
     {
         DXMessage.ShowError(ex.Message);
     }
 }
Esempio n. 19
0
        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;
            }
        }
Esempio n. 20
0
        private void bwPosition_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                if (e.Result == null && e.Error == null)
                {
                    if (cbTradeTypePosition.EditValue == null)
                    {
                        cbTradeTypePosition.DefaultSelected("0");
                    }
                    else
                    {
                        BindPositionRelateData();
                    }

                    dePosition.Enabled          = true;
                    cbTradeTypePosition.Enabled = true;
                }
                else
                {
                    if (e.Result != null)
                    {
                        throw new Exception(e.Result.ToString());
                    }
                    else if (e.Error != null)
                    {
                        throw e.Error;
                    }
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 21
0
        private void ReDrawAxisY(ChartControl chart, RangeInfo newXRange)
        {
            try
            {
                if (string.IsNullOrEmpty(newXRange.MinValue.ToString()) || string.IsNullOrEmpty(newXRange.MaxValue.ToString()))
                {
                    return;
                }

                var minValueX        = CommonHelper.StringToDateTime(newXRange.MinValue.ToString());
                var maxValueX        = CommonHelper.StringToDateTime(newXRange.MaxValue.ToString());
                var currentKLineData = _KLineData.AsEnumerable().Where(x => x.Field <DateTime>("TradeDate") >= minValueX && x.Field <DateTime>("TradeDate") <= maxValueX);

                if (currentKLineData.Any())
                {
                    decimal minValueY = currentKLineData.Select(x => x.Field <decimal>("Low")).Min();
                    decimal maxValueY = currentKLineData.Select(x => x.Field <decimal>("High")).Max();

                    AxisY myAxisY = (chart.Diagram as XYDiagram).AxisY;
                    myAxisY.VisualRange.SetMinMaxValues(minValueY - (maxValueY - minValueY) / 10, maxValueY);
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 22
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnOk.Enabled     = false;
                this.btnReturn.Enabled = false;

                if (!CheckInput())
                {
                    return;
                }

                if (DXMessage.ShowYesNoAndTips("确定进行本次转移操作么?") == System.Windows.Forms.DialogResult.Yes)
                {
                    //股票转移处理
                    TransferProcess();

                    this.RefreshEvent?.Invoke();

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnOk.Enabled     = true;
                this.btnReturn.Enabled = true;
            }
        }
Esempio n. 23
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.bandedGridView1.DataSource == null)
                {
                    return;
                }

                btnExport.Enabled = false;

                this.lciProgress.Visibility       = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                this.mpbExport.Enabled            = true;
                this.mpbExport.Properties.Stopped = false;
                this.mpbExport.Text = "报表生成中...请稍后...";
                this.mpbExport.Properties.ShowTitle = true;

                var bw = new BackgroundWorker();
                bw.WorkerSupportsCancellation = true;
                bw.DoWork             += new DoWorkEventHandler(Export2ExcelProcess);
                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Export2ExcelCompleted);
                bw.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                GC.Collect();
            }
        }
Esempio n. 24
0
        /// <summary>
        /// 移出股票池
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnDelete.Enabled = false;

                var myView = this.gridView1;

                var selectedHandles = myView.GetSelectedRows().Where(x => x > -1).ToArray();

                if (DXMessage.ShowYesNoAndTips("确定将选择的股票移出股票池吗?") == DialogResult.Yes)
                {
                    var stockCodes = new List <string>();
                    for (int i = 0; i < selectedHandles.Length; i++)
                    {
                        stockCodes.Add(myView.GetRowCellValue(selectedHandles[i], colStockCode).ToString());
                    }

                    _IDService.DeleteIDStockPool(stockCodes, LoginInfo.CurrentUser.UserCode);

                    RefreshForm();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
                this.btnDelete.Enabled = true;
            }
        }
Esempio n. 25
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnImport.Enabled = false;

                var source = this.gridControl2.DataSource as List <MIAccountPosition>;

                bool clearExisted = false;
                if (source != null && source.Any())
                {
                    if (DXMessage.ShowYesNoAndWarning("从交割单导入持仓将会清空现有的持仓信息。是否继续?") == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        clearExisted = true;
                    }
                }

                _statementService.ImportPositionInfoFromDelivery(_currentAccountId, _currentYear, _currentMonth, clearExisted);

                BindAMIPosition();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnImport.Enabled = true;
            }
        }
Esempio n. 26
0
        /// <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;
            }
        }
Esempio n. 27
0
        private void _dialogIDReasonContentEdit_Load(object sender, EventArgs e)
        {
            try
            {
                //类别
                var categories = _IDService.GetIDReasonCategories();

                this.treeListLookUpEdit1.Properties.DisplayMember = "FullName";
                this.treeListLookUpEdit1.Properties.ValueMember   = "Id";
                this.treeListLookUpEdit1TreeList.Initialize(categories, "Id", "ParentId", editable: false, autoWidth: true, showColumns: false, showVertLines: false, showHorzLines: false);

                categories = null;

                this.treeListLookUpEdit1.EditValue = CategoryId;

                this._isEdit = ContentId > 0 ? true : false;

                if (this._isEdit)
                {
                    var reasonContent = _IDService.GetIDReasonContent(ContentId);

                    if (reasonContent == null)
                    {
                        return;
                    }

                    this.txtTitle.Text    = reasonContent.Title;
                    this.memoContent.Text = reasonContent.Content;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Esempio n. 28
0
        /// <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;
            }
        }
Esempio n. 29
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnSearch.Enabled = false;

                //查询日期
                var searchDate = CommonHelper.StringToDateTime(this.deTradeDate.EditValue.ToString());

                //部门ID
                var deptId = int.Parse(this.cbDepartment.SelectedValue());

                var investIncomes = this.DataFormat(this.CalculateUserDailyInvestIncome(searchDate, deptId)).OrderBy(x => x.Investor);

                this.gridControl1.DataSource = investIncomes;
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnSearch.Enabled = true;
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 选择导入文件路径
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFileSelect_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnFileSelect.Enabled = false;

                var myOpenFileDialog = this.openFileDialog1;
                var defaultPath      = this._iniConfigHelper.GetString("Investor", "TradeDataImportPath", null);
                myOpenFileDialog.InitialDirectory = Directory.Exists(defaultPath) ? defaultPath : Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                //myOpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                myOpenFileDialog.Filter           = "Excel文件|*.xlsx";
                myOpenFileDialog.RestoreDirectory = false;
                myOpenFileDialog.FileName         = string.Empty;

                if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
                {
                    this.txtFilePath.Text = myOpenFileDialog.FileName;
                    this._iniConfigHelper.WriteValue("Investor", "TradeDataImportPath", Path.GetDirectoryName(myOpenFileDialog.FileName));

                    //导入数据预览
                    BindPreviewData(myOpenFileDialog.FileName);
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnFileSelect.Enabled = true;
            }
        }