public CheckLoginDTO CheckLogin()
        {
            var payload = new CheckLoginDTO();

            payload.Username = User.FindFirst(System.Security.Claims.ClaimTypes.Name)?.Value;
            return(payload);
        }
Beispiel #2
0
        public ResultDTO CheckLogin(CheckLoginDTO obj)
        {
            ResultDTO accInfo = new ResultDTO();

            try
            {
                accInfo = _repository.CheckLogin(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("CheckLogin", ActionType.GetData, ex.Message.ToString(), obj.SessionKey);
                accInfo.StatusCode = Utilities.Common.ConvertErrorCodeToInt(RetCode.ECS9999);
                accInfo.StatusMsg  = ex.Message.ToString();
            }

            return(accInfo);
        }
        public static ResultDTO CheckLogin(this IEntityBaseRepository <Account> repository, CheckLoginDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

            var errorCode = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };

            if (string.IsNullOrEmpty(obj.UserName) || string.IsNullOrEmpty(obj.SessionKey))
            {
                result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            }
            else
            {
                result.Details = dbContext.Database.ExecuteSqlCommand("EXEC [dbo].[CheckLogin] @UserName, @SessionKey, @errorCode out",
                                                                      new SqlParameter("FullName", DB.SafeSQL(obj.UserName)),
                                                                      new SqlParameter("UserName", DB.SafeSQL(obj.SessionKey)),
                                                                      errorCode);
                result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
                result.SetContentMsg();
            }
            return(result);
        }