using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace HealthchoiceMVC.NonDbModels { [Serializable] public class UserProfileSessionData { public string SessionID { get; set; } public string UserId { get; set; } public string UserFullName { get; set; } public int pt_key { get; set; } public string pt_full_name { get; set; } public static void UpdateUserSessionVariables(string SessionID, string UserId, string UserFullName, int pt_key, string pt_full_name) { if (HttpContext.Current.Session["UserProfile"] != null) { var profileData = HttpContext.Current.Session["UserProfile"] as UserProfileSessionData; if (SessionID != null) { profileData.SessionID = SessionID; } if (UserId != null) { profileData.UserId = UserId; } if (UserFullName != null) { profileData.UserFullName = UserFullName; } if (pt_key > 0) { profileData.pt_key = pt_key; } if (pt_full_name != null) { profileData.pt_full_name = pt_full_name; } HttpContext.Current.Session["UserProfile"] = profileData; } } public static int getCurrentPatientKey() { var profileData = HttpContext.Current.Session["UserProfile"] as UserProfileSessionData; int pt_key = 0; if (profileData != null) { if (profileData.pt_key != 0) pt_key = profileData.pt_key; } return pt_key; } public static string getCurrentPatientFullName() { var profileData = HttpContext.Current.Session["UserProfile"] as UserProfileSessionData; string pt_name = null; if (profileData != null) { if (profileData.pt_full_name != null) pt_name = profileData.pt_full_name; } return pt_name; } public static string getCurrentUserName() { var profileData = HttpContext.Current.Session["UserProfile"] as UserProfileSessionData; if (profileData != null) { return profileData.UserFullName; } else { return ""; } } } }