Пример #1
0
        /// <summary>
        /// 删除股票信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (DXMessage.ShowYesNoAndTips("确定删除该股票吗?") == DialogResult.No)
                {
                    return;
                }

                var myView = this.gridView1;

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

                var stockIds = new List <int>();

                foreach (var rowHandle in selectedHandles)
                {
                    stockIds.Add(int.Parse(myView.GetRowCellValue(rowHandle, colId).ToString()));
                }

                _stockService.DeleteStockInfoByIds(stockIds.ToArray());

                RefreshForm();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        private bool VoteProcess(EnumLibrary.IDVoteFlag voteFlag)
        {
            if (voteFlag == EnumLibrary.IDVoteFlag.None)
            {
                if (DXMessage.ShowYesNoAndTips("确定撤销上次投票结果么?") == System.Windows.Forms.DialogResult.No)
                {
                    return(false);
                }
            }
            else
            {
                var dialog = this.CreateDialog <_dialogInputVoteReason>();
                dialog.ReturnEvent += new _dialogInputVoteReason.ReturnContentToParentForm(GetVoteReason);
                dialog.ContentTitle = CTMHelper.GetIDVoteFlagName((int)voteFlag) + "理由";
                if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return(false);
                }
            }

            _IDService.IDOperationVoteProcess(LoginInfo.CurrentUser.UserCode, ApplyNo, OperateNo, voteFlag, _reasonCategoryId, _reasonContent, this.chkAdminVeto.Checked);

            this._reasonCategoryId = -1;
            this._reasonContent    = null;

            RefreshForm();

            return(true);
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        /// <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();
                }
            }
        }
Пример #6
0
        public static void ExportToExcelAndOpen(this GridView gv, string fileName)
        {
            SaveFileDialog saveFile = new SaveFileDialog();

            saveFile.Title    = "请选择文件存放路径";
            saveFile.Filter   = "Excel文档(*.xlsx)|*.xlsx";
            saveFile.FileName = fileName;
            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsxExportOptions options = new DevExpress.XtraPrinting.XlsxExportOptions();
                options.TextExportMode    = DevExpress.XtraPrinting.TextExportMode.Text;
                options.SheetName         = fileName;
                gv.OptionsPrint.AutoWidth = false;
                gv.OptionsPrint.AllowCancelPrintExport = false;
                gv.AppearancePrint.Row.Font            = new System.Drawing.Font("宋体", 9);
                try
                {
                    gv.ExportToXlsx(saveFile.FileName, options);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                if (DXMessage.ShowYesNoAndTips("导出成功,是否打开文件?") == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(saveFile.FileName);
                }
            }
        }
Пример #7
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;
            }
        }
Пример #8
0
 private void wizardControl1_CancelClick(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DXMessage.ShowYesNoAndTips("确定取消本次数据导入操作么?") == DialogResult.Yes)
     {
         this.Close();
     }
 }
Пример #9
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;
            }
        }
Пример #10
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);
     }
 }
Пример #11
0
 /// <summary>
 /// 窗体关闭X按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmMain_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     if (DXMessage.ShowYesNoAndTips("确认退出吗?") == DialogResult.Yes)
     {
         Dispose();
         Application.Exit();
     }
     else
     {
         e.Cancel = true;
     }
 }
Пример #12
0
 private void wizardControl1_FinishClick(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.wizardControl1.SelectedPage == PageFinish)
     {
         this.Close();
     }
     else
     {
         if (DXMessage.ShowYesNoAndTips("确定取消本次数据导入操作么?") == DialogResult.Yes)
         {
             this.Close();
         }
     }
 }
Пример #13
0
        private bool VoteProcess(string formSerialNo, string buttonTag)
        {
            EnumLibrary.IDVoteFlag voteFlag = EnumLibrary.IDVoteFlag.None;

            switch (buttonTag)
            {
            case "Approval":
                voteFlag = EnumLibrary.IDVoteFlag.Approval;
                break;

            case "Oppose":
                voteFlag = EnumLibrary.IDVoteFlag.Oppose;
                break;

            case "Abstain":
                voteFlag = EnumLibrary.IDVoteFlag.Abstain;
                break;

            case "Revoke":
                voteFlag = EnumLibrary.IDVoteFlag.None;
                break;

            default:
                voteFlag = EnumLibrary.IDVoteFlag.None;
                break;
            }

            if (voteFlag == EnumLibrary.IDVoteFlag.Approval || voteFlag == EnumLibrary.IDVoteFlag.Oppose || voteFlag == EnumLibrary.IDVoteFlag.Abstain)
            {
                var dialog = this.CreateDialog <_dialogInputContent>();
                dialog.ReturnEvent += new _dialogInputContent.ReturnContentToParentForm(GetVoteReason);
                dialog.ContentTitle = CTMHelper.GetIDVoteFlagName((int)voteFlag) + "理由";
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
            }
            else
            {
                if (DXMessage.ShowYesNoAndTips("确定撤销上次投票结果么?") == DialogResult.No)
                {
                    return(false);
                }
            }

            _IDService.InvestmentDecisionVoteProcess(LoginInfo.CurrentUser.UserCode, formSerialNo, voteFlag, _voteReason);

            return(true);
        }
Пример #14
0
        /// <summary>
        /// 加入、移出股票池
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPool_Click(object sender, EventArgs e)
        {
            var myView = this.gridView1;

            var selectedHandles = myView.GetSelectedRows();

            if (selectedHandles.Length != 1)
            {
                DXMessage.ShowTips("请选择一支要操作的股票!");
                return;
            }

            if (bool.Parse(myView.GetRowCellValue(selectedHandles[0], colIsInPool).ToString()))
            {
                if (DXMessage.ShowYesNoAndTips("确定将该股票移出股票池吗?") == DialogResult.Yes)
                {
                    var stockId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colId).ToString());

                    _stockService.DeleteStockPoolInfoByStockId(stockId);

                    BindStockInfo();

                    var logModel = new StockPoolLog
                    {
                        StockId      = stockId,
                        Type         = (int)EnumLibrary.OperateType.Add,
                        OperatorCode = LoginInfo.CurrentUser.UserCode,
                        OperateTime  = _commonService.GetCurrentServerTime(),
                    };

                    _stockService.AddStockPoolLog(logModel);
                }
            }
            else
            {
                var stockId = int.Parse(myView.GetRowCellValue(selectedHandles[0], colId).ToString());

                DisplayPoolEditDialog(stockId);
            }
        }
Пример #15
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            this.btnImport.Enabled = false;
            this.btnCancel.Enabled = false;

            if (DXMessage.ShowYesNoAndTips("导入操作将清除系统中该时间段内的已有数据,是否确定继续导入?") == DialogResult.No)
            {
                return;
            }

            try
            {
                Stopwatch myWatch = new Stopwatch();
                myWatch.Start();

                var importRecordNumer = 0;
                var result            = DataImportProcess(out importRecordNumer);

                myWatch.Stop();

                long proceedTime = myWatch.ElapsedMilliseconds;

                if (result)
                {
                    DXMessage.ShowTips(string.Format("历史数据导入成功!共导入{0}条数据,耗时:{1}", importRecordNumer, CommonHelper.FormatMillisecondsToString(proceedTime)));
                }

                this.Close();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnImport.Enabled = true;
                this.btnCancel.Enabled = true;
            }
        }
Пример #16
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnDelete.Enabled = false;

                var myView          = this.gridView1;
                var selectedHandles = myView.GetSelectedRows();

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

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

                if (DXMessage.ShowYesNoAndTips("确定移除所选的信息么?") == System.Windows.Forms.DialogResult.Yes)
                {
                    var ids = new List <int>();
                    foreach (var rowhandle in selectedHandles)
                    {
                        ids.Add(int.Parse(myView.GetRowCellValue(selectedHandles[rowhandle], colId).ToString()));
                    }

                    this._marginService.DeleteMarginTradingInfo(ids);

                    DisplaySearchResult();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnDelete.Enabled = true;
            }
        }
Пример #17
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnDelete.Enabled = false;

                if (DXMessage.ShowYesNoAndTips("确认删除选择的股票持仓信息么?") == System.Windows.Forms.DialogResult.Yes)
                {
                    IList <int> positionIds = null;
                    foreach (var handle in this.gridView2.GetSelectedRows())
                    {
                        positionIds.Add(Convert.ToInt32(this.gridView2.GetRowCellValue(handle, this.colPositionId)));
                    }
                    _statementService.DeleteMIAccountPosition(positionIds);

                    BindAMIPosition();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Пример #18
0
        private void barBtnDeleteCurrent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                TreeListNode currentNode = this.tlCategory.FocusedNode;
                if (currentNode == null)
                {
                    return;
                }

                if (DXMessage.ShowYesNoAndTips("确定删除当前分类么?") == DialogResult.Yes)
                {
                    var id = Convert.ToInt32(currentNode.GetValue(tcId));
                    _IDService.DeleteIDReasonCategory(id);
                    this.tlCategory.Nodes.Remove(currentNode);
                    this.tlCategory.RefreshDataSource();
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Пример #19
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnOk.Enabled = false;
                var source = gridControl1.DataSource as DataTable;
                if (source == null)
                {
                    return;
                }

                if (DXMessage.ShowYesNoAndTips("是否确定导入?") == System.Windows.Forms.DialogResult.Yes)
                {
                    IList <DailyRecord> dailyRecords = new List <DailyRecord>();
                    var deliveryRecord = _deliveryService.GetDeliveryRecordById(DeliveryId);
                    foreach (DataRow dr in source.Rows)
                    {
                        var dailyRecord = new DailyRecord
                        {
                            AccountCode     = deliveryRecord.AccountCode,
                            AccountId       = deliveryRecord.AccountId,
                            ActualAmount    = CommonHelper.SetDecimalDigits(decimal.Parse(dr[this.colRate.FieldName].ToString()) * deliveryRecord.ActualAmount),
                            Beneficiary     = dr[this.colBeneficiary.FieldName].ToString(),
                            Commission      = deliveryRecord.Commission,
                            ContractNo      = deliveryRecord.ContractNo,
                            DataType        = deliveryRecord.DataType,
                            DealAmount      = 0,
                            DealFlag        = deliveryRecord.DealFlag,
                            DealNo          = deliveryRecord.DealNo,
                            DealPrice       = deliveryRecord.DealPrice,
                            DealVolume      = 0,
                            ImportTime      = DateTime.Now,
                            ImportUser      = LoginInfo.CurrentUser.UserCode,
                            Incidentals     = deliveryRecord.Incidentals,
                            OperatorCode    = dr[this.colBeneficiary.FieldName].ToString(),
                            Remarks         = "财务交割单利息分配",
                            StampDuty       = deliveryRecord.StampDuty,
                            StockCode       = deliveryRecord.StockCode,
                            StockHolderCode = deliveryRecord.StockHolderCode,
                            StockName       = deliveryRecord.StockName,
                            TradeDate       = deliveryRecord.TradeDate,
                            TradeTime       = deliveryRecord.TradeTime,
                            TradeType       = int.Parse(dr[this.colTradeType.FieldName].ToString()),
                            UpdateTime      = DateTime.Now,
                            UpdateUser      = LoginInfo.CurrentUser.UserCode
                        };

                        dailyRecords.Add(dailyRecord);
                    }
                    _dailyService.InsertDailyRecords(dailyRecords);
                    this.SplitFlag = true;
                    this.Close();
                    this.RefreshEvent?.Invoke();
                }
                else
                {
                    this.btnOk.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Пример #20
0
        private void AddMarginInfo(bool isFinancing)
        {
            if (!InputCheck(isFinancing))
            {
                return;
            }

            var source = this.gridControl1.DataSource as List <MarginTradingEntity>;

            var investorInfo = this.luInvestor.GetSelectedDataRow() as UserInfo;

            var marginModel = new MarginTradingInfo
            {
                IsRepay      = _isRepay,
                IsFinancing  = isFinancing,
                AccountId    = int.Parse(this.luAccount.SelectedValue()),
                DepartmentId = investorInfo.DepartmentId,
                InvestorCode = investorInfo.Code,
                MarginDate   = CommonHelper.StringToDateTime(this.deTradeDate.EditValue.ToString()),
                TradeType    = int.Parse(cbTradeType.SelectedValue()),
            };

            if (isFinancing)
            {
                marginModel.Amount = Math.Abs(decimal.Parse(this.txtFinancingAmount.Text.Trim()));
            }
            else
            {
                var stockInfo = this.luStock.GetSelectedDataRow() as StockInfoModel;
                marginModel.StockFullCode = stockInfo.FullCode;
                marginModel.StockName     = stockInfo.Name;
                marginModel.LoanOwnerCode = this.luLoanOwner.SelectedValue();
                marginModel.LoanVolume    = Math.Abs(int.Parse(this.txtLoanVolume.Text.Trim()));
                marginModel.Amount        = Math.Abs(decimal.Parse(this.txtLoanAmount.Text.Trim()));
                if (source != null && source.Any())
                {
                    var existedInfo = source.SingleOrDefault(x =>
                                                             x.TradeType == marginModel.TradeType &&
                                                             x.IsRepay == _isRepay &&
                                                             x.InvestorCode == marginModel.InvestorCode &&
                                                             x.MarginDate == marginModel.MarginDate &&
                                                             x.AccountId == marginModel.AccountId &&
                                                             x.StockFullCode == marginModel.StockFullCode);

                    if (existedInfo != null)
                    {
                        DXMessage.ShowTips("该信息已经存在,请核对后重新输入!");
                        return;
                    }
                }
            }

            if (DXMessage.ShowYesNoAndTips("确定添加该信息么?") == System.Windows.Forms.DialogResult.Yes)
            {
                this._marginService.InsertMarginTradingInfo(marginModel);

                BindTodayMarginInfo();

                this.txtFinancingAmount.Text = null;

                this.luLoanOwner.EditValue = null;
                this.luStock.EditValue     = null;
                this.txtLoanVolume.Text    = null;
                this.txtLoanAmount.Text    = null;
            }
        }