Example #1
0
 public static CurrentUser GetCurrentUserByTuser(UserDto user)
 {
     var currentUser = new CurrentUser();
     currentUser.SystemLevel = 1;
     currentUser.LoginAccount = user.LoginAccount;
     currentUser.UserID = new Guid(user.Id);
     currentUser.UserName = user.UserName;
     return currentUser;
 }
Example #2
0
 public static string SaveSessionForLogin(CurrentUser value)
 {
     if (value == null) return "";
     try
     {
         string sessionId = CreateSessionId();
         string key = ReadonlyCollection.SERVERBEFOREKEY + sessionId;
         var expiry = DateTime.Now.AddHours(6);
         CacheHelper.Set(key, value, expiry);
         CacheHelper.Set(value.UserID.ToString(), key);
         HttpContext.Current.Response.Cookies.Add(ReadonlyCollection.CLIENTSESSIONNAME, ReadonlyCollection.CLIENTSESSIONNAMECOOKIEVALUE, sessionId);
         return sessionId;
     }
     catch (Exception exp)
     {
         Common.Log(exp.ToString());
         return "";
     }
 }