Cats.Helpers.UserAccountHelper.GetCurrentUser C# (CSharp) Method

GetCurrentUser() public static method

public static GetCurrentUser ( ) : UserInfo
return Cats.Models.Security.UserInfo
        public static UserInfo GetCurrentUser()
        {
            return GetUserInfo(HttpContext.Current.User.Identity.Name);
        }

Usage Example

示例#1
0
文件: DateHelpers.cs 项目: IYoni/cats
        public static decimal ToPreferedWeightUnit(this decimal amount, string unit = "MT")
        {
            string currentUnit;

            // Get current unit setting for the user.
            // NOTE: Since we might call this method from public views where we might not have a signed-in
            //       user, we must check for possible errors.
            try
            {
                var user = UserAccountHelper.GetCurrentUser();
                currentUnit = user.PreferedWeightMeasurment;
            }
            catch (Exception)
            {
                currentUnit = unit;
            }

            // If the current unit is 'Metric Tone' then return the  value (the passed value)
            if (currentUnit.ToUpper().Trim() == "MT")
            {
                return(amount);
            }

            // For the other unit (quintal)  multiply by 10

            return(amount * 10);
        }
All Usage Examples Of Cats.Helpers.UserAccountHelper::GetCurrentUser