Exemple #1
0
        protected void signin(object sender, EventArgs e)
        {
            User u = _users.login(email.Text.ToString(), pwd.Text.ToString());

            if (u.id > 0)
            {
                // you got it right
                Session["user_id"]      = u.id.ToString();
                Session["user_name"]    = u.first_name + " " + u.last_name;
                Session["company_name"] = u.company;
                Session["user_email"]   = u.email;
                Session["user_pic"]     = u.picture;
                Session["user_access"]  = u.security_desc;

                List <Event> myevents = _permissions.select_permitted_events(Convert.ToInt32(Session["user_id"].ToString()));

                if (myevents.Count > 0)
                {
                    Session["event_id"] = myevents[0].id.ToString();

                    Response.Redirect("/dashboard");
                }
                else
                {
                    pnl_no_events_assigned.Visible = true;
                }
            }
            else
            {
                pnl_error.Visible = true;
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user_id"] == null)
            {
                Response.Redirect("/login");
            }
            else
            {
                user_picture = "/uploads/" + Session["user_pic"].ToString();
                user_name    = Session["user_name"].ToString();
                company_name = Session["company_name"].ToString();
                user_email   = Session["user_email"].ToString();

                if (!Page.IsPostBack)
                {
                    List <Event> myevents = _permissions.select_permitted_events(Convert.ToInt32(Session["user_id"].ToString()));

                    if (myevents.Count > 0)
                    {
                        ddl_event.DataSource     = myevents;
                        ddl_event.DataValueField = "id";
                        ddl_event.DataTextField  = "title";
                        ddl_event.DataBind();
                        ddl_event.SelectedIndex = 0;

                        if (Session["event_id"] != null)
                        {
                            ddl_event.SelectedValue = Session["event_id"].ToString();
                        }
                        else
                        {
                            Session["event_id"] = myevents[0].id.ToString();
                        }
                    }
                    else
                    {
                        Response.Redirect("/login/no-events-allowed");
                    }
                }
            }

            List <Media> _unapproved = _media.get_unapproved(Convert.ToInt32(Session["event_id"].ToString()));

            unapproved_count = _unapproved.Count.ToString("0.#");
        }