using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using CodeCafe.Web; /// /// Summary description for clsValidate /// public class clsValidate { /**********************************************************************************************************/ /// /// Initializes a new instance of the class. /// public clsValidate() { } /**********************************************************************************************************/ /// /// Gets or sets the user ID. /// /// The user ID. public int UserID { set { if (System.Web.HttpContext.Current.Session["userid"] == null) { System.Web.HttpContext.Current.Session.Add("userid", value); } else System.Web.HttpContext.Current.Session["userid"] = value; } get { if (System.Web.HttpContext.Current.Session["userid"] == null) { System.Web.HttpContext.Current.Session.Add("userid", "0"); return 0; } else return int.Parse(System.Web.HttpContext.Current.Session["userid"].ToString()); } } /**********************************************************************************************************/ /// /// Gets or sets the admin ID. /// /// The admin ID. public int AdminID { set { if (System.Web.HttpContext.Current.Session["admin"] == null) { System.Web.HttpContext.Current.Session.Add("admin", value); } else System.Web.HttpContext.Current.Session["admin"] = value; } get { if (System.Web.HttpContext.Current.Session["admin"] == null) { System.Web.HttpContext.Current.Session.Add("admin", "0"); return 0; } else return int.Parse(System.Web.HttpContext.Current.Session["admin"].ToString()); } } /**********************************************************************************************************/ /// /// Determines whether [is active user]. /// /// /// true if [is active user]; otherwise, false. /// public bool isActiveUser() { return UserID != 0; } /**********************************************************************************************************/ /// /// Clears the user. /// public void ClearUser() { UserID = 0; } /**********************************************************************************************************/ /// /// Determines whether [is admin user]. /// /// /// true if [is admin user]; otherwise, false. /// public bool isAdminUser() { return AdminID != 0; } /**********************************************************************************************************/ }