本文整理汇总了C#中Session.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Session.ToString方法的具体用法?C# Session.ToString怎么用?C# Session.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReleaseResource
public void ReleaseResource(Session session)
{
var traderState = SessionManager.Default.GetTradingConsoleState(session);
if (traderState != null && traderState.QuotationFilterSign != null)
{
QuotationFilterSignMapping.Remove(traderState.QuotationFilterSign);
}
SessionManager.Default.RemoveAllItem(session);
SessionMapping.Remove(session.ToString());
}
示例2: AsyncGetChartData2
public static XElement AsyncGetChartData2(Session session, Guid instrumentId, DateTime from, DateTime to, string dataCycleParameter)
{
try
{
AsyncResult asyncResult = new AsyncResult("AsyncGetChartData2", session.ToString());
Application.Default.AssistantOfCreateChartData2.AddTask(asyncResult, new ChartDataArgument2(instrumentId, dataCycleParameter, from, to, asyncResult, session),CreateChartData2);
return XmlResultHelper.NewResult(asyncResult.Id.ToString());
}
catch (System.Exception exception)
{
_Logger.Error(exception);
return XmlResultHelper.NewErrorResult();
}
}
示例3: AccountSummaryForJava2
public static XElement AccountSummaryForJava2(Session session, string fromDay, string toDay, string accountIds, string rdlc)
{
Guid result = Guid.Empty;
try
{
AsyncResult asyncResult = new AsyncResult("AccountSummaryForJava2", session.ToString());
Token token = SessionManager.Default.GetToken(session);
if (ThreadPool.QueueUserWorkItem(CreateAccountSummary, new AccountSummaryArgument(fromDay,toDay, accountIds, rdlc, asyncResult, session)))
{
result = asyncResult.Id;
}
else
{
_Logger.Warn("ThreadPool.QueueUserWorkItem failed");
}
}
catch (System.Exception exception)
{
_Logger.Error(exception);
return XmlResultHelper.NewErrorResult();
}
return XmlResultHelper.NewResult(result.ToString());
}
示例4: GetParameterForJava
private XmlNode GetParameterForJava(Session session, string companyCode, string version)
{
SessionManager.Default.AddVersion(session, version);
string physicalPath = Path.Combine(LoginHelper.GetOrginazationDir(companyCode), version);
//Get xml
try
{
string xmlPath = Path.Combine(physicalPath, SettingManager.Default.GetJavaTraderSettings("parameter"));
var parameterDocument = new XmlDocument();
parameterDocument.Load(xmlPath);
XmlNode parameterXmlNode = parameterDocument.GetElementsByTagName("Parameter")[0];
xmlPath = Path.Combine(physicalPath, SettingManager.Default.GetJavaTraderSettings("login"));
var loginDocument = new System.Xml.XmlDocument();
loginDocument.Load(xmlPath);
XmlNode loginXmlNode = loginDocument.GetElementsByTagName("Login")[0];
string newsLanguage = loginXmlNode.SelectNodes("NewsLanguage").Item(0).InnerXml;
TraderState state = SessionManager.Default.GetTradingConsoleState(session) ??
new TraderState(session.ToString());
state.Language=newsLanguage.ToLower();
SessionManager.Default.AddTradingConsoleState(session, state);
XmlElement newChild = parameterDocument.CreateElement("NewsLanguage");
newChild.InnerText = loginXmlNode.SelectNodes("NewsLanguage").Item(0).InnerXml;
parameterXmlNode.AppendChild(newChild);
string agreementContent = "";
string agreementFileFullPath = Path.Combine(physicalPath, SettingManager.Default.GetJavaTraderSettings("agreement"));
if (File.Exists(agreementFileFullPath))
{
var agreementDocument = new System.Xml.XmlDocument();
agreementDocument.Load(agreementFileFullPath);
var agreementXmlNode = agreementDocument.GetElementsByTagName("Agreement")[0];
string showAgreement = agreementXmlNode.SelectNodes("ShowAgreement").Item(0).InnerXml.Trim().ToLower();
if (showAgreement == "true")
{
agreementContent = agreementXmlNode.SelectNodes("Content").Item(0).InnerXml;
}
}
XmlElement agreementXmlNode2 = parameterDocument.CreateElement("Agreement");
agreementXmlNode2.InnerText = agreementContent;
parameterXmlNode.AppendChild(agreementXmlNode2);
string columnSettings = Path.Combine(LoginHelper.GetOrginazationDir(companyCode), SettingManager.Default.GetJavaTraderSettings("column_setting"));
if (File.Exists(columnSettings))
{
var columnSettingsDocument = new XmlDocument();
columnSettingsDocument.Load(columnSettings);
XmlNode columnSettingsXmlNode = columnSettingsDocument.GetElementsByTagName("ColumnSettings")[0];
columnSettingsXmlNode = parameterDocument.ImportNode(columnSettingsXmlNode, true);
parameterXmlNode.AppendChild(columnSettingsXmlNode);
}
string integralitySettings = Path.Combine(LoginHelper.GetOrginazationDir(companyCode), SettingManager.Default.GetJavaTraderSettings("integrality_settings"));
if (File.Exists(columnSettings))
{
var integralitySettingsDocument = new XmlDocument();
integralitySettingsDocument.Load(integralitySettings);
var integralitySettingsXmlNode = integralitySettingsDocument.GetElementsByTagName("IntegralitySettings")[0];
integralitySettingsXmlNode = parameterDocument.ImportNode(integralitySettingsXmlNode, true);
parameterXmlNode.AppendChild(integralitySettingsXmlNode);
}
var node = parameterDocument.GetElementsByTagName("Parameters")[0];
return node;
}
catch (Exception ex)
{
_Logger.Error(ex);
return null;
}
}
示例5: StatementForJava2
public static XElement StatementForJava2(Session session, int statementReportType, string dayBegin, string dayTo, string IDs, string rdlc)
{
Guid result = Guid.Empty;
try
{
AsyncResult asyncResult = new AsyncResult("StatementForJava2", session.ToString());
Token token = SessionManager.Default.GetToken(session);
if (ThreadPool.QueueUserWorkItem(CreateStatement, new StatementArg(statementReportType, dayBegin, dayTo, IDs, rdlc, asyncResult, session)))
{
result = asyncResult.Id;
}
else
{
_Logger.Warn("ThreadPool.QueueUserWorkItem failed");
}
}
catch (System.Exception exception)
{
_Logger.Error(exception);
}
return XmlResultHelper.NewResult(result.ToString());
}
示例6: LedgerForJava2
public static XElement LedgerForJava2(Session session, string dateFrom, string dateTo, string ids, string rdlc)
{
Guid result = Guid.Empty;
try
{
AsyncResult asyncResult = new AsyncResult("LedgerForJava2", session.ToString());
Token token = SessionManager.Default.GetToken(session);
if (ThreadPool.QueueUserWorkItem(CreateLedger, new LedgerArgument(dateFrom, dateTo, ids, rdlc, asyncResult, session)))
{
result = asyncResult.Id;
}
else
{
_Logger.Warn("ThreadPool.QueueUserWorkItem failed");
}
}
catch (System.Exception exception)
{
_Logger.Error(exception);
}
return XmlResultHelper.NewResult(result.ToString());
}
示例7: btnConnect_Click
private void btnConnect_Click(object sender, RoutedEventArgs e)
{
Session newSession = (Session)dgSessions.SelectedItem;
if (SessionActive == newSession)
return;
//Valide si le compte actuel existe sur la nouvelle session spécifié et s'il est admins.
//Sinon l'utilisateur ce coupe la branche sous les pieds.
if (!IsAdminOnNewConnexion(newSession.ToConnexionString()))
{
MessageBox.Show("Impossible de se connecter. Est-ce que votre compte existe sur la base de données et êtes vous administrateur?",
"Erreur de connexion",
MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
SwitchActive(obsSessions.IndexOf(SessionActive), obsSessions.IndexOf(newSession));
SessionActive = newSession;
Properties.Settings.Default.ActiveSession = "{" + SessionActive.ToString() + "}";
Properties.Settings.Default.Save();
IApplicationService mainWindow = ServiceFactory.Instance.GetService<IApplicationService>();
mainWindow.Configurer();
mainWindow.ChangerVue(new MenuPrincipalConnecte());
}
示例8: Test_BasicTuple
public void Test_BasicTuple()
{
var one = new Session
{
Id = 101 ,
ClientIp = "192.168.0.1",
};
var two = new Session
{
Id = 101 ,
ClientIp = "192.168.0.1",
};
var three = new Session
{
Id = 201 ,
ClientIp = "192.168.0.2",
};
var asString = one.ToString ();
TestFor.Equality (BasicTupleAsString, asString, "Tuple.ToString must match");
TestFor.Equality (true , one.Equals(one) , "Identical tuples must match");
TestFor.Equality (false , one.Equals(two) , "Structural identical tuples must not match");
TestFor.Equality (false , two.Equals(one) , "Structural identical tuples must not match");
TestFor.Equality (false , one.Equals(three) , "Structural non-identical tuples must not match");
TestFor.Equality (false , three.Equals(one) , "Structural non-identical tuples must not match");
TestFor.Equality (true , one.GetHashCode() == one.GetHashCode() , "Identical tuples must have same hash code");
TestFor.Equality (false , one.GetHashCode() == two.GetHashCode() , "Structural identical tuples must not have same hash code");
TestFor.Equality (false , two.GetHashCode() == one.GetHashCode() , "Structural identical tuples must not have same hash code");
TestFor.Equality (false , one.GetHashCode() == three.GetHashCode() , "Structural non-identical tuples must not have same hash code");
TestFor.Equality (false , three.GetHashCode() == one.GetHashCode() , "Structural non-identical tuples must not have same hash code");
}
示例9: InternalGetQuotePolicyDetailsAndRefreshInstrumentsState
private DataSet InternalGetQuotePolicyDetailsAndRefreshInstrumentsState(Session session,Guid customerID)
{
DataSet dataSet = Application.Default.TradingConsoleServer.GetQuotePolicyDetails(customerID);
TraderState state = SessionManager.Default.GetTradingConsoleState(session);
Application.Default.TradingConsoleServer.RefreshInstrumentsState2(dataSet, ref state, session.ToString());
if (state == null) return dataSet;
TraderState traderState = new TraderState(state);
traderState.CaculateQuotationFilterSign();
SessionManager.Default.AddTradingConsoleState(session, traderState);
return dataSet;
}
示例10: GetParameterForJava
//no use
public XmlNode GetParameterForJava(Session session,string companyCode, string version)
{
//Get xml
try
{
string physicalPath = SettingManager.Default.PhysicPath + "\\" + companyCode + "\\" + version + "\\";
string xmlPath = physicalPath + "Setting\\Parameter.xml";
var doc = new System.Xml.XmlDocument();
doc.Load(xmlPath);
xmlPath = physicalPath + "Setting\\Login.xml";
var doc2 = new System.Xml.XmlDocument();
doc2.Load(xmlPath);
var node2 = doc2.GetElementsByTagName("Login")[0];
var parameterXmlNode = doc.GetElementsByTagName("Parameter")[0];
string newsLanguage = node2.SelectNodes("NewsLanguage").Item(0).InnerXml;
TraderState state = SessionManager.Default.GetTradingConsoleState(session);
if (state == null)
{
state = new TraderState(session.ToString());
}
state.Language = newsLanguage.ToLower();
SessionManager.Default.AddTradingConsoleState(session, state);
XmlElement newChild = doc.CreateElement("NewsLanguage");
newChild.InnerText = newsLanguage;
parameterXmlNode.AppendChild(newChild);
var node = doc.GetElementsByTagName("Parameters")[0];
return node;
}
catch (System.Exception ex)
{
_Logger.Error(ex);
return null;
}
}
示例11: AsyncGetTickByTickHistoryData2
public XElement AsyncGetTickByTickHistoryData2(Session session,Guid instrumentId, DateTime from, DateTime to)
{
try
{
_Logger.Info(string.Format("{0}-{1}", from, to));
var asyncResult = new AsyncResult("AsyncGetTickByTickHistoryData2", session.ToString());
if (ThreadPool.QueueUserWorkItem(this.CreateTickByTickHistoryDatas2, new TickByTickHistoryDataArgument2(instrumentId, from, to, asyncResult, session)))
{
return XmlResultHelper.NewResult(asyncResult.Id.ToString());
}
_Logger.Warn("ThreadPool.QueueUserWorkItem failed");
}
catch (Exception exception)
{
_Logger.Error(exception);
}
return XmlResultHelper.NewResult(Guid.Empty.ToString());
}
示例12: AsyncGetTickByTickHistoryData
public Guid AsyncGetTickByTickHistoryData(Session session, Guid instrumentId)
{
try
{
AsyncResult asyncResult = new AsyncResult("AsyncGetTickByTickHistoryData", session.ToString());
if (ThreadPool.QueueUserWorkItem(this.CreateTickByTickHistoryDatas, new TickByTickHistoryDataArgument(instrumentId, asyncResult, session)))
{
return asyncResult.Id;
}
_Logger.Warn("ThreadPool.QueueUserWorkItem failed");
return Guid.Empty;
}
catch (System.Exception exception)
{
_Logger.Error(exception);
return Guid.Empty;
}
}
示例13: btnConnect_Click
private void btnConnect_Click(object sender, RoutedEventArgs e)
{
//Si aucune session n'est sélectionné dans la dataGrid, fait jouer un petit beep d'erreur windows.
if (dgSessions.SelectedIndex != -1)
{
//Non-nulleable (struct), donc forced cast. Type assumé.
Session newSession = (Session)dgSessions.SelectedItem;
//Si nous voulons nous connecter à la session déjà active, il n'y a rien d'autre à faire.
if (SessionActive == newSession)
return;
//Valide si le compte actuel existe sur la nouvelle session spécifié et s'il est admins.
//Sinon l'utilisateur se coupe la branche sous les pieds.
if (!IsAdminOnNewConnexion(newSession.ToConnexionString()))
{
MessageBox.Show("Impossible de se connecter. Est-ce que votre compte existe sur la base de données et êtes vous administrateur?",
"Erreur de connexion",
MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//Lance la méthode pour faire le changement de session active dans l'UI (le mettre en gras).
//Prend comme paramètre l'index dans obsSessions de l'ancienne session et la prochaine.
SwitchActive(obsSessions.IndexOf(SessionActive), obsSessions.IndexOf(newSession));
SessionActive = newSession;
//Enregistre la nouvelle session active dans la configuration du logiciel.
Properties.Settings.Default.ActiveSession = "{" + SessionActive.ToString() + "}";
Properties.Settings.Default.Save();
//Récupère l'instance de mainWindow et lance la méthode Configurer pour reconstruire les services MySql avec la nouvelle connexion.
IApplicationService mainWindow = ServiceFactory.Instance.GetService<IApplicationService>();
mainWindow.Configurer();
//Retourne au menu principal connecté parce qu'il est déjà connecté s'il a eu accès â MenuConnexion et pour garantir un état valide si par example
//il était dans une fenêtre qui utilisait les services MySql de l'ancienne connexion.
mainWindow.ChangerVue(new MenuPrincipalConnecte());
}
else
//Beep d'erreur microsoft.
SystemSounds.Beep.Play();
}
示例14: OpenSession
/// <summary>
/// Etablie la connection avec Bloomberg
/// </summary>
private void OpenSession()
{
sessionOptions = new SessionOptions();
sessionOptions.ServerHost = "localhost";
sessionOptions.ServerPort = 8194;
session = new Session(sessionOptions);
l_title = new List<Title>();
if (!session.Start())
{
System.Console.WriteLine("Could not start session.");
Console.WriteLine(session.ToString());
Remplissage_Non_connection();
return;
}
if (!session.OpenService("//blp/refdata"))
{
System.Console.WriteLine("Could not open service " +
"//blp/refdata");
return;
}
refDataSvc = session.GetService("//blp/refdata");
if (refDataSvc == null)
{
Console.WriteLine("Cannot get service");
return;
}
else
{
request = refDataSvc.CreateRequest("ReferenceDataRequest");
}
}
示例15: SessionRemovedForExpiredOrScavenged
private static void SessionRemovedForExpiredOrScavenged(string methodName, Session sess, object[] args)
{
logger.ErrorFormat(MsgRemoveSession, methodName, sess.ToString(), ToStringTool.ToString(args));
//logger.Error("SessionCacheRemovedAction" + "::" + methodName + " Session Time Out: [" + sess.ToString() + "] , " + ToStringTool.ToString(args));
}