Source

main / Source / WebService / Web.Admin / Helper.cs

Naethra D ba1cb57 





































using System.Web;

namespace DataUp.Web.Admin
{
    public static class Helper
    {
        public static string GetLoggedInUserName()
        {
            User user = HttpContext.Current.Session["User"] as User;
            string name = string.Empty;
            if (user != null)
            {
                if (!string.IsNullOrWhiteSpace(user.FirstName))
                {
                    name = user.FirstName + " ";
                }

                if (!string.IsNullOrWhiteSpace(user.LastName))
                {
                    name += user.LastName;
                }
            }

            return name;
        }

        public static int GetLoggedInUserID()
        {
            User user = HttpContext.Current.Session["User"] as User;
            int id = -1;
            if (user != null)
            {
                id = user.Id;
            }

            return id;
        }
    }
}