Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                List<Aspect.Domain.User> list = new List<Aspect.Domain.User>();
                using (Aspect.Model.UserDomain.UserProvider provider = new Aspect.Model.UserDomain.UserProvider())
                {
                    list = provider.GetUsers();
                    UsersDropDown.DataSource = list;
                }
                try
                {
                    HttpCookie cookie = this.Request.Cookies["LastLogin"];
                    if (cookie != null && !string.IsNullOrEmpty(cookie.Value))
                    {
                        if (list.Where(l => l.ID == new Guid(cookie.Value)).Count() > 0)
                        {
                            UsersDropDown.SelectedValue = cookie.Value;
                            //LastLogin.Text = UsersDropDown.SelectedItem.Text;
                        }

                    }
                }
                catch (Exception)
                {
                }
                Page.DataBind();
            }
        }
Ejemplo n.º 2
0
 protected void AddToFavorites_Click(object sender, EventArgs e)
 {
     using (Aspect.Model.UserDomain.UserProvider provider = new Aspect.Model.UserDomain.UserProvider())
     {
         provider.AddToFavorites(selectedNodeID, this.User.ID, selectedNodeText, string.Format("/Grid.aspx?cid={0}&pid={0}", selectedNodeID));
     }
 }
Ejemplo n.º 3
0
        public void Authenticate(Guid userID /*, string[] roles*/)
        {
            Session["userID"] = userID;

            string[] roles = new string[] { };
            string roleString = String.Join(",", roles);
            bool isPersistent = true;
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userID.ToString(), DateTime.Now, DateTime.Now.AddHours(12), isPersistent, roleString, FormsAuthentication.FormsCookiePath);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
            Response.Cookies.Add(cookie);
            FormsIdentity identity = new FormsIdentity(ticket);
            HttpContext.Current.User = new GenericPrincipal(identity, roles);

            if (!String.IsNullOrEmpty(Request["ReturnUrl"]))
            {
                Response.Redirect(Request["ReturnUrl"]);
            }
            else
            {
                using (Aspect.Model.UserDomain.UserProvider provider = new Aspect.Model.UserDomain.UserProvider())
                {
                    List<Aspect.Domain.UserMenuItem> list = provider.GetLastViewed(userID);
                    if (list.Count > 0) Response.Redirect(string.Format("~{0}", list[0].Url ));
                    else Response.Redirect("/Grid.aspx?cid=55c7b455-0638-4acb-ac2e-5b4992e48462&pid=55c7b455-0638-4acb-ac2e-5b4992e48462");
                }
                //Response.Redirect(FormsAuthentication.DefaultUrl);

            }
        }
Ejemplo n.º 4
0
 public override void AddVisitHistory()
 {
     using (Aspect.Model.UserDomain.UserProvider provider = new Aspect.Model.UserDomain.UserProvider())
     {
         provider.AddToLastViewed(selectedNodeID, this.User.ID, selectedNodeText, string.Format("/Grid.aspx?cid={0}&pid={0}", selectedNodeID));
     }
 }