private void LoadMonitorUnits(int monitorUnitId) { var monitorUnits = _monitorUnitBLL.GetAll(); ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (monitorUnits != null && monitorUnits.Count > 0) { foreach (var monitorUnit in monitorUnits) { ComboOptionItem item = new ComboOptionItem { Id = string.Format("{0}", monitorUnit.MonitorUnitId), Name = monitorUnit.MonitorUnitName }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbMonitorUnit, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbMonitorUnit, monitorUnitId.ToString()); }
private void LoadAssetUnit(string assetCode) { var assetUnits = LoginManager.Instance.Assets; ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (assetUnits != null && assetUnits.Count > 0) { foreach (var assetUnit in assetUnits) { ComboOptionItem item = new ComboOptionItem { Id = string.Format("{0}", assetUnit.AssetNo), Name = assetUnit.AssetName }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbAssetUnit, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbAssetUnit, assetCode); }
private void LoadPortfolio(string portfolioCode) { var portfolios = LoginManager.Instance.Portfolios; ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (portfolios != null && portfolios.Count > 0) { foreach (var portfolio in portfolios) { ComboOptionItem item = new ComboOptionItem { Id = string.Format("{0}", portfolio.CombiNo), Name = portfolio.CombiName }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbPortfolio, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbPortfolio, portfolioCode); }
private void LoadFund(string fundCode) { var accounts = LoginManager.Instance.Accounts; ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (accounts != null && accounts.Count > 0) { foreach (var account in accounts) { ComboOptionItem item = new ComboOptionItem { Id = string.Format("{0}", account.AccountCode), Name = account.AccountName }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbFundCode, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbFundCode, fundCode); }
private void LoadTemplates(int templateId) { var templates = _templateBLL.GetTemplates(); ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (templates != null && templates.Count > 0) { foreach (var template in templates) { ComboOptionItem item = new ComboOptionItem { Id = string.Format("{0}", template.TemplateId), Name = template.TemplateName }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbTemplate, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbTemplate, templateId.ToString()); }
private void FillData(StockTemplate stockTemplate) { this.tbTemplateNo.Text = stockTemplate.TemplateId.ToString(); this.tbTemplateNo.Enabled = false; this.tbTemplateName.Text = stockTemplate.TemplateName; this.tbFutureCopies.Text = stockTemplate.FutureCopies.ToString(); this.tbMarketCapOpt.Text = stockTemplate.MarketCapOpt.ToString(); ComboBoxUtil.SetComboBoxSelect(this.cbBenchmark, stockTemplate.Benchmark); ComboBoxUtil.SetComboBoxSelect(this.cbWeightType, stockTemplate.EWeightType.ToString()); ComboBoxUtil.SetComboBoxSelect(this.cbReplaceType, stockTemplate.EReplaceType.ToString()); }
private void LoadChangeOut(ClosePositionSecurityItem closeSecuItem) { AutoItem autoItem = new AutoItem { Id = closeSecuItem.SecuCode, Name = closeSecuItem.SecuName }; this.acSecuOut.SetCurrentItem(autoItem); string longShort = string.Format("{0}", (int)closeSecuItem.PositionType); ComboBoxUtil.SetComboBoxSelect(this.cbOutDirection, longShort); //股票设置调出为卖出,调入为买入 //股指期货设置调出为买入平仓,调入为卖出开仓 EntrustDirection eOutDirection; EntrustDirection eInDirection; if (closeSecuItem.SecuType == Model.SecurityInfo.SecurityType.Stock) { eOutDirection = EntrustDirection.Sell; eInDirection = EntrustDirection.Buy; } else if (closeSecuItem.SecuType == Model.SecurityInfo.SecurityType.Futures) { eOutDirection = EntrustDirection.Buy; eInDirection = EntrustDirection.Sell; } else { eOutDirection = EntrustDirection.Sell; eInDirection = EntrustDirection.Buy; } string outDirection = string.Format("{0}", (int)eOutDirection); ComboBoxUtil.SetComboBoxSelect(this.cbOutDirection, outDirection); this.tbOutAmount.Text = string.Format("{0}", closeSecuItem.AvailableAmount); //设置调入 string inDirection = string.Format("{0}", (int)eInDirection); ComboBoxUtil.SetComboBoxSelect(this.cbInDirection, inDirection); }
private void ComboBox_FundCode_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = sender as ComboBox; if (cb == null) { return; } var fundItem = (ComboOptionItem)cb.SelectedItem; var portfolioOption = LoadPortfolio(fundItem.Id); switch (cb.Name) { case "cbSrcFundCode": { ComboBoxUtil.ClearComboBox(this.cbSrcPortfolio); ComboBoxUtil.ClearComboBox(this.cbSrcTradeInst); ComboBoxUtil.SetComboBox(this.cbSrcPortfolio, portfolioOption); if (IsSecurityTransfer()) { ComboBoxUtil.ClearComboBox(this.cbDestPortfolio); ComboBoxUtil.ClearComboBox(this.cbDestTradeInst); ComboBoxUtil.SetComboBoxSelect(this.cbDestFundCode, fundItem.Id); ComboBoxUtil.SetComboBox(this.cbDestPortfolio, portfolioOption); } } break; case "cbDestFundCode": { ComboBoxUtil.ClearComboBox(this.cbDestPortfolio); ComboBoxUtil.ClearComboBox(this.cbDestTradeInst); ComboBoxUtil.SetComboBox(this.cbDestPortfolio, portfolioOption); } break; default: break; } }
private bool Form_LoadData(object sender, object data) { if (data != null && data is MonitorUnit) { MonitorUnit monitorUnit = data as MonitorUnit; tbMonitorUnitId.Text = string.Format("{0}", monitorUnit.MonitorUnitId); tbMonitorUnitName.Text = monitorUnit.MonitorUnitName; //cbPortfolioId.SelectedValue ComboBoxUtil.SetComboBoxSelect(cbPortfolioId, monitorUnit.PortfolioId.ToString()); ComboBoxUtil.SetComboBoxSelect(cbStockTemplate, monitorUnit.StockTemplateId.ToString()); AutoItem autoItem = new AutoItem { Id = monitorUnit.BearContract, Name = monitorUnit.BearContract }; acFuturesContracts.SetCurrentItem(autoItem); } return(true); }
private bool Form_LoadData(object sender, object data) { if (data == null) { return(false); } if (!(data is OpenPositionItem)) { return(false); } _originOpenItem = data as OpenPositionItem; if (_originOpenItem == null) { return(false); } // this.tbPortfolio.Text = _originOpenItem.PortfolioName; this.tbTemlate.Text = string.Format("{0}-{1}", _originOpenItem.TemplateId, _originOpenItem.TemplateName); this.tbFutures.Text = _originOpenItem.FuturesContract; this.tbCopies.Text = string.Format("{0}", _originOpenItem.Copies); this.tbCopies.Enabled = false; this.tbBias.Text = "0"; DateTime now = DateTime.Now; DateTime startDate = new DateTime(now.Year, now.Month, now.Day, 9, 15, 0); DateTime endDate = new DateTime(now.Year, now.Month, now.Day, 15, 15, 0); this.tbStartDate.Text = DateFormat.Format(startDate, ConstVariable.DateFormat1); this.tbEndDate.Text = DateFormat.Format(endDate, ConstVariable.DateFormat1); this.tbStartTime.Text = DateFormat.Format(startDate, ConstVariable.TimeFormat1); this.tbEndTime.Text = DateFormat.Format(endDate, ConstVariable.TimeFormat1); //Initialize the instancecode var instances = _tradeInstanceBLL.GetAllInstance(); var targetInstances = instances.Where(p => p.MonitorUnitId == _originOpenItem.MonitorId && p.TemplateId == _originOpenItem.TemplateId).ToList(); ComboOption comboOption = new ComboOption { Items = new List <ComboOptionItem>() }; if (targetInstances == null || targetInstances.Find(p => p.InstanceCode.Equals(_originOpenItem.InstanceCode)) == null) { ComboOptionItem currentItem = new ComboOptionItem { Id = _originOpenItem.InstanceCode, Name = _originOpenItem.InstanceCode }; comboOption.Items.Add(currentItem); } if (targetInstances != null && targetInstances.Count > 0) { foreach (var instance in targetInstances) { ComboOptionItem item = new ComboOptionItem { Id = instance.InstanceCode, Name = instance.InstanceCode }; comboOption.Items.Add(item); } } ComboBoxUtil.SetComboBox(this.cbInstanceCode, comboOption); ComboBoxUtil.SetComboBoxSelect(this.cbInstanceCode, _originOpenItem.InstanceCode); return(true); }