本文整理汇总了C#中ISession.handleSessionTimeout方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.handleSessionTimeout方法的具体用法?C# ISession.handleSessionTimeout怎么用?C# ISession.handleSessionTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.handleSessionTimeout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUser
public bool UpdateUser(IUser user, string sessionID, ISession sessionHandler)
{
try
{
XmlRpcStruct userStruct = ((User)user).toStruct();
sysLog.Info("Request: UpdateUser - Requested User: '" + user + "', Userdata: FIRSTNAME=" + user.Firstname
+ " LASTNAME=" + user.Lastname
+ " EMAIL=" + user.Email);
UserHandler privateUserHandler = HandlerHelper.getPrivateUserHandler(privateXmlRpcUrl, sessionID);
privateUserHandler.Modify("NICKNAME == '" + user.Nickname + "'", userStruct);
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when updating user '" + user.Nickname + "'", e);
return false;
}
return true;
}
示例2: CancelOrder
public void CancelOrder(int orderId, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: CancelOrder - Requested OrderId: " + orderId);
OrderHandler privateOrderHandler = HandlerHelper.getPrivateOrderHandler(privateXmlRpcUrl, sessionID);
privateOrderHandler.Cancel("ID == '" + orderId + "'");
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when cancelling Order", e);
}
}
示例3: GetUserTransactions
/******************************************************
* TRANSACTIONS
******************************************************/
public List<ITransaction> GetUserTransactions(int id, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: UserTransactions - Requested UserID: '" + id + "'");
List<ITransaction> userTransactions = new List<ITransaction>();
TransactionHandler privateTransactionHandler = HandlerHelper.getPrivateTransactionHandler(privateXmlRpcUrl, sessionID);
XmlRpcStruct[] transactionStruct = privateTransactionHandler.List("USERID == '" + id + "'");
foreach (XmlRpcStruct userTransaction in transactionStruct)
userTransactions.Add(new Transaction(userTransaction));
return userTransactions;
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when requesting UserTransactions", e);
return new List<ITransaction>();
}
}
示例4: RemoveUser
public bool RemoveUser(string nickname, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: RemoveUser - Requested User: '" + nickname + "'");
UserHandler privateUserHandler = HandlerHelper.getPrivateUserHandler(privateXmlRpcUrl, sessionID);
privateUserHandler.Remove("NICKNAME == '" + nickname + "'");
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when removing user '" + nickname + "'", e);
return false;
}
return false;
}
示例5: GetUserSecurities
public List<IUserSecurity> GetUserSecurities(int id, string sessionID, ISession session)
{
try
{
sysLog.Info("Request: UserSecurities - Requested UserID: '" + id + "'");
List<IUserSecurity> userSecurities = new List<IUserSecurity>();
PortfolioHandler privatePortfolioHandler = HandlerHelper.getPrivatePortfolioHandler(privateXmlRpcUrl, sessionID);
XmlRpcStruct[] portfolioStruct = privatePortfolioHandler.List("USERID == '" + id + "'");
foreach (XmlRpcStruct userSecurity in portfolioStruct)
userSecurities.Add(new UserSecurity(userSecurity));
return userSecurities;
}
catch (Exception e)
{
if(e.Message.Contains("Session Corrupt"))
session.handleSessionTimeout();
else
sysLog.Error("Error when requesting UserSecurities", e);
return new List<IUserSecurity>();
}
}
示例6: GetUserOrders
public List<IOrder> GetUserOrders(int id, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: UserOrders - Requested User: " + id);
List<IOrder> userOrders = new List<IOrder>();
OrderHandler privateOrderHandler = HandlerHelper.getPrivateOrderHandler(privateXmlRpcUrl, sessionID);
XmlRpcStruct[] orderStruct = privateOrderHandler.List("USERID == '" + id + "'");
foreach (XmlRpcStruct userOrder in orderStruct)
userOrders.Add(new Order(userOrder));
return userOrders;
}
catch (Exception e)
{
if(e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when requesting UserOrders", e);
return new List<IOrder>();
}
}
示例7: GetUserDetailsByNickname
public IUser GetUserDetailsByNickname(string nickname, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: UserByNickname - Requested User: '" + nickname +"'");
IUser user = null;
UserHandler privateUserHandler = HandlerHelper.getPrivateUserHandler(privateXmlRpcUrl, sessionID);
XmlRpcStruct[] userStruct = privateUserHandler.Details(); //Filter is niet nodig, deze wordt samengesteld in de backend adhv sessie
if (userStruct.Length > 0)
user = new User(userStruct[0]);
return user;
}
catch(Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when requesting user", e);
return null;
}
}
示例8: GetPointTransactions
public List<IPointsTransaction> GetPointTransactions(int userID, string sessionId, ISession sessionHandler)
{
try
{
sysLog.Info("Request: GetPointTransactions - Requested UserID: '" + userID + "'");
List<IPointsTransaction> pointTransactions = new List<IPointsTransaction>();
PointsTransactionHandler privatePointsTransactionHandler = HandlerHelper.getPrivatePointsTransactionHandler(privateXmlRpcUrl, sessionId);
XmlRpcStruct[] pointTransactionStruct = privatePointsTransactionHandler.List("USERID == '" + userID + "'");
foreach (XmlRpcStruct pointTransaction in pointTransactionStruct)
pointTransactions.Add(new PointsTransaction(pointTransaction));
return pointTransactions;
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when getting rankings", e);
return new List<IPointsTransaction>();
}
}
示例9: CreateOrder
/******************************************************
* ORDERS
******************************************************/
public void CreateOrder(int userId, string isin, int amount, double price, double alternativeOrder, string type, string sessionID, ISession sessionHandler)
{
try
{
sysLog.Info("Request: CreateOrder - Created Order: USERID=" + userId + " ISIN=" + isin + " AMOUNT=" + amount
+ " PRICE=" + price + " TYPE=" + type);
OrderHandler privateOrderHandler = HandlerHelper.getPrivateOrderHandler(privateXmlRpcUrl, sessionID);
Order order = new Order(-1, userId, isin, amount, price, alternativeOrder, type, "ACCEPTED", DateTime.Now, DateTime.MinValue, DateTime.MinValue);
privateOrderHandler.Create(order.toStruct());
}
catch (Exception e)
{
if (e.Message.Contains(corruptSession) || e.Message.Contains(invalidSession))
sessionHandler.handleSessionTimeout();
else
sysLog.Error("Error when creating Order", e);
}
}