Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnLogin.Enabled  = false;
                this.btnCancel.Enabled = false;

                if (txtAccount.Text.Length == 0)
                {
                    DXMessage.ShowTips("请输入账号!");
                    txtAccount.Focus();
                    return;
                }

                if (txtPassword.Text.Length == 0)
                {
                    DXMessage.ShowTips("请输入密码!");
                    txtPassword.Focus();
                    return;
                }

                var userCode = txtAccount.Text;
                var pwd      = txtPassword.Text;
                var info     = _userService.GetUserInfoByCode(userCode);

                if (info == null)
                {
                    DXMessage.ShowTips("账号不存在,请重新输入!");
                    txtAccount.Focus();
                    return;
                }

                if (info.IsDeleted)
                {
                    DXMessage.ShowTips("该账号已被禁用,请联系管理员!");
                    txtAccount.Focus();
                    return;
                }

                if (info.Password != pwd)
                {
                    DXMessage.ShowTips("密码不正确,请重新输入!");
                    txtPassword.Text = string.Empty;
                    txtPassword.Focus();
                    return;
                }

                SaveLoginInfo(info);

                SaveLoginLog(info);

                SaveLoginInfoToFile();

                this.DialogResult = DialogResult.OK;

                if (this.ReLogin)
                {
                    RefreshEvent?.Invoke();
                }

                this.Close();
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnLogin.Enabled  = true;
                this.btnCancel.Enabled = true;
            }
        }
Ejemplo n.º 2
0
        private bool InputCheck(bool isFinancing)
        {
            if (LoginInfo.CurrentUser.IsAdmin)
            {
                if (string.IsNullOrEmpty(this.luInvestor.SelectedValue()))
                {
                    DXMessage.ShowTips("请选择投资人员!");
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(this.cbTradeType.SelectedValue()))
            {
                DXMessage.ShowTips("请选择交易类别!");
                return(false);
            }

            if (string.IsNullOrEmpty(this.luAccount.SelectedValue()))
            {
                DXMessage.ShowTips("请选择账号信息!");
                return(false);
            }

            if (isFinancing)
            {
                var repayMsg = this._isRepay ? "还资" : "融资";
                if (this.txtFinancingAmount.Text.Length == 0)
                {
                    DXMessage.ShowTips(string.Format("请输入{0}金额!", repayMsg));
                    this.txtFinancingAmount.Focus();
                    return(false);
                }

                if (decimal.Parse(this.txtFinancingAmount.Text.Trim()) <= 0)
                {
                    DXMessage.ShowTips(string.Format("{0}金额应该大于0!", repayMsg));
                    this.txtFinancingAmount.Focus();
                    return(false);
                }
            }
            else
            {
                var repayMsg = this._isRepay ? "还券" : "融券";
                if (string.IsNullOrEmpty(this.luLoanOwner.SelectedValue()))
                {
                    DXMessage.ShowTips(string.Format("请选择{0}所属人!", repayMsg));
                    return(false);
                }

                if (this.luLoanOwner.SelectedValue().Equals(this.luInvestor.SelectedValue()))
                {
                    DXMessage.ShowTips(string.Format("投资人员和{0}所属人不能相同!", repayMsg));
                    return(false);
                }

                if (string.IsNullOrEmpty(this.luStock.SelectedValue()))
                {
                    DXMessage.ShowTips("请选择股票信息!");
                    return(false);
                }

                if (this.txtLoanVolume.Text.Length == 0)
                {
                    DXMessage.ShowTips(string.Format("请输入{0}数量!", repayMsg));
                    this.txtLoanVolume.Focus();
                    return(false);
                }

                if (int.Parse(this.txtLoanVolume.Text.Trim()) < 1)
                {
                    DXMessage.ShowTips(string.Format("{0}数量应该大于0!", repayMsg));
                    this.txtLoanVolume.Focus();
                    return(false);
                }

                if (this.txtLoanAmount.Text.Length == 0)
                {
                    DXMessage.ShowTips(string.Format("请输入{0}金额!", repayMsg));
                    this.txtLoanAmount.Focus();
                    return(false);
                }

                if (decimal.Parse(this.txtLoanAmount.Text.Trim()) <= 0)
                {
                    DXMessage.ShowTips(string.Format("{0}金额应该大于0!", repayMsg));
                    this.txtLoanAmount.Focus();
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void tabPane1_SelectedPageChanged(object sender, DevExpress.XtraBars.Navigation.SelectedPageChangedEventArgs e)
        {
            try
            {
                if (e.Page.Caption == tpSearch.Caption)
                {
                    //股票信息
                    var stockCommandText = $@"SELECT DISTINCT StockCode, StockName FROM [dbo].[v_IPRDetail] ";

                    var dsStock = SqlHelper.ExecuteDataset(AppConfig._ConnString, CommandType.Text, stockCommandText);

                    if (dsStock == null || dsStock.Tables.Count == 0)
                    {
                        return;
                    }

                    var stocks = dsStock.Tables[0].AsEnumerable().Select(x => new StockInfoModel
                    {
                        FullCode      = x.Field <string>("StockCode").Trim(),
                        Name          = x.Field <string>("StockName").Trim(),
                        DisplayMember = x.Field <string>("StockCode").Trim() + " - " + x.Field <string>("StockName").Trim(),
                    }
                                                                         ).ToList();

                    var allStock = new StockInfoModel()
                    {
                        FullCode      = string.Empty,
                        Name          = "全部",
                        DisplayMember = "全部",
                    };
                    stocks.Add(allStock);
                    stocks = stocks.OrderBy(x => x.FullCode).ToList();

                    this.luStock.Initialize(stocks, "FullCode", "DisplayMember", enableSearch: true);

                    //投资人员
                    var investorCommandText = $@"SELECT DISTINCT InvestorCode , InvestorName FROM [dbo].[v_IPRDetail] ";

                    var dsInvestor = SqlHelper.ExecuteDataset(AppConfig._ConnString, CommandType.Text, investorCommandText);

                    if (dsInvestor == null || dsInvestor.Tables.Count == 0)
                    {
                        return;
                    }

                    var investors = dsInvestor.Tables[0].AsEnumerable().Select(x => new UserInfo
                    {
                        Code = x.Field <string>("InvestorCode").Trim(),
                        Name = x.Field <string>("InvestorName").Trim(),
                    }
                                                                               ).ToList();

                    var allInvestor = new UserInfo
                    {
                        Code = string.Empty,
                        Name = "全部",
                    };
                    investors.Add(allInvestor);
                    investors = investors.OrderBy(x => x.Code).ToList();

                    this.luInvestor.Initialize(investors, "Code", "Name", enableSearch: true);
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
        }
Ejemplo n.º 4
0
        private bool DataImportProcess(out int importRecordNumber)
        {
            importRecordNumber = 0;

            var startDate = CommonHelper.StringToDateTime(this.deStart.EditValue.ToString());
            var endDate   = CommonHelper.StringToDateTime(this.deEnd.EditValue.ToString());

            string query = string.Format(@"select * from EntrustRecord where (cjQty>0 or cjAmount >0)  and FData >='{0}' and FData <='{1}' ", startDate, endDate);

            var ds = SqlHelper.ExecuteDataset(_oldSystemConnectionString, CommandType.Text, query);

            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                return(true);
            }

            var tradeRecords   = new List <DailyRecord>();
            var historyRecords = ds.Tables[0];

            var dataType       = (int)EnumLibrary.DataType.History;
            var importUserCode = LoginInfo.CurrentUser.UserCode;
            var importTime     = _commonService.GetCurrentServerTime();

            foreach (DataRow row in historyRecords.Rows)
            {
                importRecordNumber++;

                var tradeRecord = new DailyRecord();

                tradeRecord.DataType   = dataType;
                tradeRecord.ImportUser = importUserCode;
                tradeRecord.ImportTime = importTime;
                tradeRecord.UpdateUser = importUserCode;
                tradeRecord.UpdateTime = importTime;

                tradeRecord.AccountId = int.Parse(row["zqzh"].ToString().Trim());

                tradeRecord.OperatorCode = GetUserCodeByName(row["Operator"].ToString().Trim());

                tradeRecord.StockName = row["zqmc"].ToString().Trim();

                tradeRecord.StockCode = GetStockFullCodeByCode(row["zqdm"].ToString().Trim());

                if (string.IsNullOrEmpty(tradeRecord.StockCode))
                {
                    DXMessage.ShowTips(string.Format("系统不存在股票信息【{0}】【{1}】,导入操作终止!", row["zqmc"].ToString().Trim(), row["zqdm"].ToString().Trim()));
                    return(false);
                }

                tradeRecord.SetTradeType(row["jyType"].ToString().Trim());

                tradeRecord.Beneficiary = GetBeneficiaryCodeByTradeType(row, tradeRecord.TradeType);

                tradeRecord.TradeDate = CommonHelper.StringToDateTime(row["FData"].ToString().Trim());

                tradeRecord.TradeTime = row["Ftime"].ToString().Trim();

                if (row["cz"].ToString().Trim().IndexOf("买") > -1)
                {
                    tradeRecord.DealFlag = true;
                }
                else
                {
                    tradeRecord.DealFlag = false;
                }

                tradeRecord.DealNo = string.Empty;

                tradeRecord.DealPrice = decimal.Parse(row["cjPrice"].ToString().Trim());

                tradeRecord.DealAmount = decimal.Parse(row["cjAmount"].ToString().Trim());

                //买入
                if (tradeRecord.DealFlag)
                {
                    tradeRecord.DealVolume = CommonHelper.ConvertToPositive(int.Parse(row["cjQty"].ToString().Trim()));

                    tradeRecord.ActualAmount = CommonHelper.ConvertToNegtive(decimal.Parse(row["fsAmount"].ToString().Trim()));
                }
                //卖出
                else
                {
                    tradeRecord.DealVolume = CommonHelper.ConvertToNegtive(int.Parse(row["cjQty"].ToString().Trim()));

                    tradeRecord.ActualAmount = CommonHelper.ConvertToPositive(decimal.Parse(row["fsAmount"].ToString().Trim()));
                }

                tradeRecord.StockHolderCode = row["gdzh"].ToString().Trim();

                tradeRecord.ContractNo = row["ContractID"].ToString().Trim();

                if (row["yj"] != DBNull.Value)
                {
                    tradeRecord.Commission = decimal.Parse(row["yj"].ToString().Trim());
                }

                if (row["yhs"] != DBNull.Value)
                {
                    tradeRecord.StampDuty = decimal.Parse(row["yhs"].ToString().Trim());
                }

                if (row["ghf"] != DBNull.Value)
                {
                    tradeRecord.Incidentals = decimal.Parse(row["ghf"].ToString().Trim());
                }

                tradeRecord.AuditFlag = row["gj"].ToString().Trim() == "1" ? true : false;

                if (row["gjtime"] != DBNull.Value)
                {
                    tradeRecord.AuditTime = CommonHelper.StringToDateTime(row["gjtime"].ToString().Trim());
                }

                tradeRecord.AuditNo = null;

                tradeRecord.Remarks = row["remark"].ToString().Trim();

                tradeRecords.Add(tradeRecord);
            }

            var tradeDateFrom = historyRecords.AsEnumerable().Select(x => x.Field <DateTime>("FData")).Min();
            var tradeDateTo   = historyRecords.AsEnumerable().Select(x => x.Field <DateTime>("FData")).Max();

            if (DeleteExistedRecords(tradeDateFrom, tradeDateTo))
            {
                _tradeRecordService.BatchInsertDailyRecords(tradeRecords);
            }

            return(true);
        }
Ejemplo n.º 5
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;
            }
        }
Ejemplo n.º 6
0
        private void wizardControl1_NextClick(object sender, DevExpress.XtraWizard.WizardCommandButtonClickEventArgs e)
        {
            try
            {
                switch (e.Page.Name.Trim())
                {
                case "PageAccount":

                    if (string.IsNullOrEmpty(this.luSecurityCompany.SelectedValue()))
                    {
                        DXMessage.ShowTips("请选择证券公司!");
                        e.Handled = true;
                        return;
                    }

                    //账户属性
                    if (this.cbAccountAttribute.SelectedIndex == -1)
                    {
                        DXMessage.ShowTips("请选择账户属性!");
                        e.Handled = true;
                        return;
                    }

                    if (this.gridViewAccount.SelectedRowsCount != 1)
                    {
                        DXMessage.ShowTips("请选择一个账户!");
                        e.Handled = true;
                        return;
                    }

                    BindDataImportInfo();
                    break;

                case "PageImport":

                    //导入的Excel文件路径
                    if (string.IsNullOrEmpty(this.txtFilePath.Text.Trim()))
                    {
                        DXMessage.ShowTips("请选择要导入的交易数据Excel文件!");
                        e.Handled = true;
                        return;
                    }

                    if (this.gridViewPreview.DataRowCount == 0)
                    {
                        DXMessage.ShowTips("该Excel文件不存在交易记录!");
                        e.Handled = true;
                        return;
                    }

                    this.esiImportResult.Text       = string.Empty;
                    this.esiImportResult.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    this.lcgSkip.Visibility         = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    this.PageFinish.AllowBack       = false;

                    break;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
                e.Handled = true;
                return;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 引导各画面的下一步按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wizardControl1_NextClick(object sender, DevExpress.XtraWizard.WizardCommandButtonClickEventArgs e)
        {
            try
            {
                switch (e.Page.Name.Trim())
                {
                case "PageAccount":

                    if (string.IsNullOrEmpty(this.luSecurityCompany.SelectedValue()))
                    {
                        DXMessage.ShowTips("请选择证券公司!");
                        e.Handled = true;
                        return;
                    }

                    //账户属性
                    if (this.cbAccountAttribute.SelectedIndex == -1)
                    {
                        DXMessage.ShowTips("请选择账户属性!");
                        e.Handled = true;
                        return;
                    }

                    if (this.gridViewAccount.SelectedRowsCount != 1)
                    {
                        DXMessage.ShowTips("请选择一个账户!");
                        e.Handled = true;
                        return;
                    }
                    else
                    {
                        var operators = this.gridViewAccount.GetRowCellValue(this.gridViewAccount.FocusedRowHandle, colOperatorNames);

                        if (operators == null || string.IsNullOrEmpty(operators.ToString()))
                        {
                            DXMessage.ShowTips("该账号未设置操作人员,请联系管理员!");
                            e.Handled = true;
                            return;
                        }
                        else
                        {
                            BindDataImportInfo();
                        }
                    }
                    break;

                case "PageImport":

                    //交易员
                    if (string.IsNullOrEmpty(this.luOperator.SelectedValue()))
                    {
                        DXMessage.ShowTips("请选择交易员!");
                        e.Handled = true;
                        return;
                    }

                    //导入的Excel文件路径
                    if (string.IsNullOrEmpty(this.txtFilePath.Text.Trim()))
                    {
                        DXMessage.ShowTips("请选择要导入的交易数据Excel文件!");
                        e.Handled = true;
                        return;
                    }

                    if (this.gridViewPreview.DataRowCount == 0)
                    {
                        DXMessage.ShowTips("该Excel文件不存在交易记录!");
                        e.Handled = true;
                        return;
                    }
                    else
                    {
                        //数据导入
                        if (!DataImportProcess())
                        {
                            e.Handled = true;
                            return;
                        }
                    }

                    this.lcgSkip.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

                    break;
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
                e.Handled = true;
                return;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 保存账户信息
        /// </summary>
        private bool SaveAccountInfo()
        {
            try
            {
                //添加账户信息
                if (!this._isEdit)
                {
                    var newAccount = new AccountInfo()
                    {
                        AttributeCode       = int.Parse(this.cbAttribute.SelectedValue()),
                        AttributeName       = this.cbAttribute.Text.Trim(),
                        Code                = this.txtCode.Text.Trim(),
                        CommissionRate      = decimal.Parse(this.txtCommissionRate.EditValue.ToString()),
                        FinancingAmount     = decimal.Parse(this.txtFinacingAmount.Text.Trim()),
                        IncidentalsRate     = decimal.Parse(this.txtIncidentalsRate.EditValue.ToString()),
                        IndustryId          = int.Parse(this.cbIndustry.SelectedValue()),
                        InvestFund          = decimal.Parse(this.txtInvestFund.Text.Trim()),
                        IsDisabled          = false,
                        Name                = this.txtAccountName.Text.Trim(),
                        NeedAccounting      = this.chkYes.Checked ? true : false,
                        PlanCode            = int.Parse(this.cbPlan.SelectedValue()),
                        PlanName            = this.cbPlan.Text.Trim(),
                        Owner               = this.luOwner.SelectedValue(),
                        Remarks             = this.memoRemarks.Text.Trim(),
                        StampDutyRate       = decimal.Parse(this.txtStampDutyRate.EditValue.ToString()),
                        SecurityCompanyCode = int.Parse(this.cbSecurity.SelectedValue()),
                        SecurityCompanyName = this.cbSecurity.Text.Trim(),
                        TypeCode            = int.Parse(this.cbType.SelectedValue()),
                        TypeName            = this.cbType.Text.Trim(),
                    };

                    var isExisted = _accountService.IsExistedAccount(newAccount.Name, newAccount.SecurityCompanyCode, newAccount.AttributeCode);

                    if (!isExisted)
                    {
                        _accountService.AddAccountInfo(newAccount);

                        this._accountId = newAccount.Id;
                    }
                    else
                    {
                        DXMessage.ShowTips("系统已经存在账户名称、开发券商和账户属性相同的账户信息,无法添加!");
                        return(false);
                    }
                }
                //修改账户信息
                else
                {
                    var account = _accountService.GetAccountInfoById(this._accountId);

                    account.IndustryId          = int.Parse(this.cbIndustry.SelectedValue());
                    account.SecurityCompanyCode = int.Parse(this.cbSecurity.SelectedValue());
                    account.SecurityCompanyName = this.cbSecurity.Text.Trim();
                    account.AttributeCode       = int.Parse(this.cbAttribute.SelectedValue());
                    account.AttributeName       = this.cbAttribute.Text.Trim();
                    account.TypeCode            = int.Parse(this.cbType.SelectedValue());
                    account.TypeName            = this.cbType.Text.Trim();
                    account.PlanCode            = int.Parse(this.cbType.SelectedValue());
                    account.PlanName            = this.cbPlan.Text.Trim();
                    account.Name            = this.txtAccountName.Text.Trim();
                    account.Code            = this.txtCode.Text.Trim();
                    account.Owner           = this.luOwner.SelectedValue();
                    account.InvestFund      = decimal.Parse(this.txtInvestFund.Text.Trim());
                    account.FinancingAmount = decimal.Parse(this.txtFinacingAmount.Text.Trim());
                    account.StampDutyRate   = decimal.Parse(this.txtStampDutyRate.EditValue.ToString());
                    account.CommissionRate  = decimal.Parse(this.txtCommissionRate.EditValue.ToString());
                    account.IncidentalsRate = decimal.Parse(this.txtIncidentalsRate.EditValue.ToString());
                    account.NeedAccounting  = this.chkYes.Checked ? true : false;
                    account.Remarks         = this.memoRemarks.Text.Trim();

                    var isExisted = _accountService.IsExistedAccount(account.Name, account.SecurityCompanyCode, account.AttributeCode, account.Id);

                    if (!isExisted)
                    {
                        _accountService.UpdateAccountInfo(account);
                    }
                    else
                    {
                        DXMessage.ShowTips("系统已经存在账户名称、开发券商和账户属性相同的账户信息,无法修改!");
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 查询交易数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnSearch.Enabled = false;
                this.btnClear.Enabled  = false;

                _searchCondition = new SearchModel();

                //股票代码
                var stockInfo = this.luStock.GetSelectedDataRow() as StockInfoModel;
                _searchCondition.StockCode = (stockInfo == null || stockInfo.Id == 0) ? string.Empty : this.luStock.SelectedValue();

                //账号ID
                _searchCondition.AccountId = luAccount.EditValue == null ? 0 : int.Parse(luAccount.EditValue.ToString());

                //导入人
                _searchCondition.ImportUser = luImport.EditValue == null ? null : luImport.EditValue.ToString();

                //买卖标志
                if (chkBuy.Checked)
                {
                    _searchCondition.DealFlag = true;
                }
                else if (chkSell.Checked)
                {
                    _searchCondition.DealFlag = false;
                }

                //导入日期
                if (deImportFrom.EditValue == null)
                {
                    _searchCondition.ImportDateFrom = null;
                }
                else
                {
                    _searchCondition.ImportDateFrom = CommonHelper.StringToDateTime(deImportFrom.EditValue.ToString());
                }

                if (deImportTo.EditValue == null)
                {
                    _searchCondition.ImportDateTo = null;
                }
                else
                {
                    _searchCondition.ImportDateTo = CommonHelper.StringToDateTime(deImportTo.EditValue.ToString());
                }

                //交易日期
                if (deTradeFrom.EditValue == null)
                {
                    _searchCondition.TradeDateFrom = null;
                }
                else
                {
                    _searchCondition.TradeDateFrom = CommonHelper.StringToDateTime(deTradeFrom.EditValue.ToString());
                }

                if (deTradeTo.EditValue == null)
                {
                    _searchCondition.TradeDateTo = null;
                }
                else
                {
                    _searchCondition.TradeDateTo = CommonHelper.StringToDateTime(deTradeTo.EditValue.ToString());
                }

                BindDeliveryRecord(_searchCondition);
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnSearch.Enabled = true;
                this.btnClear.Enabled  = true;
            }
        }
Ejemplo n.º 10
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);
            }
        }
Ejemplo n.º 11
0
        private bool InputCheck()
        {
            if (LoginInfo.CurrentUser.IsAdmin)
            {
                if (string.IsNullOrEmpty(this.luInvestor.SelectedValue()))
                {
                    DXMessage.ShowTips("请选择投资人员!");
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(this.luAccount.SelectedValue()))
            {
                DXMessage.ShowTips("请选择账号信息!");
                return(false);
            }

            if (string.IsNullOrEmpty(this.cbTradeType.SelectedValue()))
            {
                DXMessage.ShowTips("请选择交易类别!");
                return(false);
            }

            if (string.IsNullOrEmpty(this.luBeneficiary.SelectedValue()))
            {
                DXMessage.ShowTips("请选择实际收益人!");
                return(false);
            }

            if (string.IsNullOrEmpty(this.luStock.SelectedValue()))
            {
                DXMessage.ShowTips("请选择股票信息!");
                return(false);
            }

            if (this.txtDealVolume.Text.Length == 0)
            {
                DXMessage.ShowTips("请输入成交数量数量!");
                this.txtDealVolume.Focus();
                return(false);
            }

            if (int.Parse(this.txtDealVolume.Text.Trim()) < 1)
            {
                DXMessage.ShowTips("成交数量应该大于0!");
                this.txtDealVolume.Focus();
                return(false);
            }

            if (this.txtDealPrice.Text.Length == 0)
            {
                DXMessage.ShowTips("请输入成交价格!");
                this.txtDealPrice.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtDealPrice.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("成交价格应该大于0!");
                this.txtDealPrice.Focus();
                return(false);
            }

            return(true);
        }
Ejemplo n.º 12
0
        private bool SubmitProcess()
        {
            if (string.IsNullOrEmpty(this.luInvestor.SelectedValue()))
            {
                DXMessage.ShowTips("请选择投资发起人!");
                this.luInvestor.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.luStock.SelectedValue()))
            {
                DXMessage.ShowTips("请选择股票信息!");
                this.luStock.Focus();
                return(false);
            }

            if (this.txtPrice.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价!");
                this.txtPrice.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtPrice.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价应该大于0!");
                this.txtPrice.Focus();
                return(false);
            }

            if (this.txtPriceBound.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价上下限!");
                this.txtPriceBound.Focus();
                return(false);
            }

            int priceBound;

            if (!int.TryParse(txtPriceBound.Text.Trim(), out priceBound))
            {
                DXMessage.ShowTips("单价上下限应该输入数字!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (int.Parse(this.txtPriceBound.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价上下限应该大于0!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (this.txtVolume.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入数量!");
                this.txtVolume.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtVolume.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("数量应该大于0!");
                this.txtVolume.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.memoReason.Text.Trim()))
            {
                DXMessage.ShowTips("请输入申请理由!");
                this.memoReason.Focus();
                return(false);
            }

            var investorInfo = this.luInvestor.GetSelectedDataRow() as UserInfo;
            var applyDate    = CommonHelper.StringToDateTime(this.deApply.EditValue.ToString());
            var tradeType    = int.Parse(this.cbOperateType.SelectedValue());
            var price        = decimal.Parse(this.txtPrice.Text.Trim());
            var volume       = decimal.Parse(this.txtVolume.Text.Trim());
            var amount       = Math.Abs(decimal.Parse(this.txtAmount.Text.Trim()) * (int)EnumLibrary.NumericUnit.TenThousand);

            var stock = this.luStock.GetSelectedDataRow() as StockInfoModel;
            var now   = _commonService.GetCurrentServerTime();

            var form = new InvestmentDecisionForm
            {
                Amount            = this.chkBuy.Checked ? amount : -amount,
                ApplyDate         = applyDate,
                ApplyUser         = investorInfo.Code,
                CreateTime        = now,
                DealFlag          = this.chkBuy.Checked ? true : false,
                DepartmentId      = investorInfo.DepartmentId,
                Price             = price,
                PriceBound        = (decimal)priceBound / (int)EnumLibrary.NumericUnit.Hundred,
                Reason            = this.memoReason.Text.Trim(),
                RelateTradePlanNo = txtPlanNo.Text.Trim(),
                SerialNo          = string.Empty,
                Status            = (int)EnumLibrary.IDFormStatus.Submited,
                StockFullCode     = stock.FullCode,
                StockName         = stock.Name,
                TradeType         = tradeType,
                UpdateTime        = now,
                Volume            = volume,
            };

            _IDService.SubmitInvestmentDecisionApplication(form);

            return(true);
        }