public static cLogin GetLogged() { cLogin user = new cLogin(); if (HttpContext.Current.Session["USER"] != null) { return((cLogin)HttpContext.Current.Session["USER"]); } return(user); }
public cLogin GetLogged() { cLogin login = new cLogin(); if (HttpContext.Current.Session["USER"] != null) { login = (cLogin)HttpContext.Current.Session["USER"]; if (login.enterpriseId == _enterpriseId) { return(login); } } return(login); }
public static string Login(string email, string password) { HttpContext.Current.Session["USER"] = null; long enterpriseId = Convert.ToInt64(cWebCrypto.Decrypt(HttpContext.Current.Request.QueryString["ac"])); if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password)) { _context = cDataContextFactory.GetDataContext(); cLogin user = _context.ACAD_USUARIOS.Where(x => x.CD_ACADEMIA == enterpriseId && x.TX_EMAIL == email && x.TX_SENHA == password && x.FL_ATIVO == true) .Select(x => new cLogin() { enterpriseId = x.CD_ACADEMIA, userId = x.CD_USUARIO, userName = x.NM_USUARIO, email = x.TX_EMAIL, teacher = x.ACAD_ACADEMIAS.ACAD_CURSOS .Where(y => y.CD_PROFESSOR == x.CD_USUARIO) .Select(y => new cTeacher() { courseId = SqlFunctions.StringConvert((double)y.CD_CURSO), couseName = y.NM_CURSO }) .ToList() }).FirstOrDefault(); if (user != null) { foreach (cTeacher item in user.teacher) { item.courseId = cWebCrypto.Encrypt(item.courseId.Trim()); } HttpContext.Current.Session["USER"] = user; return(cWebCrypto.Encrypt(user.userId.ToString())); } } return(""); }
protected void BaseMaster_Init(object sender, EventArgs e) { Response.AddHeader("P3P", "CP=\"IDC DSP COR CURa ADM ADMa DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT PHY ONL COM STA\""); ACAD_ACADEMIAS academia = _business.GetAcademy(); if (academia != null) { _login = _business.GetLogged(); Page.Title = academia.NM_ACADEMIA; HtmlLink css = new HtmlLink(); css.Href = "assets/" + _enterpriseId.ToString() + "/favicon.ico"; css.Attributes["rel"] = "shortcut icon"; css.Attributes["type"] = "image/x-icon"; Page.Header.Controls.Add(css); css = new HtmlLink(); css.Href = "assets/" + _enterpriseId.ToString() + "/favicon.ico"; css.Attributes["rel"] = "icon"; css.Attributes["type"] = "image/ico"; Page.Header.Controls.Add(css); HtmlMeta meta = new HtmlMeta(); meta = new HtmlMeta(); meta.Name = "description"; meta.Content = academia.TX_META_DESCRIPTION; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "keywords"; meta.Content = academia.TX_META_KEYWORDS; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "robots"; meta.Content = academia.TX_META_ROBOTS; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "googlebot"; meta.Content = academia.TX_META_GOOGLEBOT; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "generator"; meta.Content = academia.TX_META_GENERATOR; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "revisit-after"; meta.Content = academia.TX_META_REVISITE_AFTER; Page.Header.Controls.Add(meta); meta = new HtmlMeta(); meta.Name = "date"; meta.Content = DateTime.Now.ToString("yyyy-MM-dd"); meta.Scheme = "YYYY-MM-DD"; Page.Header.Controls.Add(meta); } }
protected void BasePage_Init(object sender, EventArgs e) { _login = _business.GetLogged(); }