Ejemplo n.º 1
0
        protected void newEvent(object sender, EventArgs e)
        {
            HttpCookie userCookie;
            userCookie = Request.Cookies["UserID"];

            User_Class myUser = new User_Class();
            myUser = myUser.getUser(userCookie.Value);
            myUser.getFriends();

            Events_Class events = new Events_Class();
            //events.Date = TextBoxDate.Text;
            //TextBoxDate.Text = "disabled";

            events.Date = Calendar1.SelectedDate.ToString();
            events.Location = TextBoxLocation.Text;
            events.Description = TextBoxDescription.Text;
            int indice = 0;

            events.Users.Add(myUser);

            foreach (ListItem li in ListBox2.Items)
            {
                indice = Int32.Parse(li.Value);
                events.Users.Add(myUser.Friends[indice]);

            }

            events.addEvent();
            Response.Redirect("Events.aspx", true);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie userCookie;
            HttpCookie passCookie;

            userCookie = Request.Cookies["UserID"];
            passCookie = Request.Cookies["UserPass"];

            if (userCookie == null || passCookie == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }
            else
            {
                User_Class usuario_sesion = new User_Class();
                usuario_sesion = usuario_sesion.getUser(userCookie.Value);

                if (usuario_sesion.Pass == passCookie.Value)
                {
                    if (!IsPostBack)
                    {
                        ListBox1.Items.Clear();
                        ListBox2.Items.Clear();
                        ListBox3.Items.Clear();
                        ListBox1.Width = 100;
                        ListBox1.Height = 60;
                        ListBox2.Width = 150;
                        ListBox3.Width = 150;

                        user = new User_Class();
                        user = user.getUser(userCookie.Value);
                        user.getFriends();

                        int i = 0;

                        ListItem l = new ListItem();
                        while (i < user.Friends.Count)
                        {
                            l = new ListItem();

                            l.Text = user.Friends[i].Nick;
                            l.Value = i.ToString();
                            ListBox2.Items.Add(l);
                            i++;
                        }

                        ListItem o = new ListItem("Public", "0");
                        ListItem p = new ListItem("Private", "1");
                        ListBox1.Items.Add(o);
                        ListBox1.Items.Add(p);

                    }
                }
                else
                {
                    Response.Redirect("../Account/Login.aspx");
                }

            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.MaintainScrollPositionOnPostBack = true;
            HttpCookie userCookie;
            userCookie = Request.Cookies["UserID"];
            if (userCookie == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    ListBox1.Items.Clear();
                    ListBox1.Width = 150;
                    ListBox1.Height = 200;
                    ListBox2.Width = 150;
                    ListBox2.Height = 200;

                    user = new User_Class();
                    user = user.getUser(userCookie.Value);

                    user.getFriends();

                    int i = 0;

                    ListItem l = new ListItem();
                    while (i < user.Friends.Count)
                    {
                        l = new ListItem();

                        l.Text = user.Friends[i].Nick;
                        l.Value = i.ToString();
                        ListBox1.Items.Add(l);
                        i++;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //When the page reloads keeps the cursor on the same position
            Page.MaintainScrollPositionOnPostBack = true;

            HttpCookie userCookie;
            HttpCookie passCookie;

            userCookie = Request.Cookies["UserID"];
            passCookie = Request.Cookies["UserPass"];

            if (userCookie == null || passCookie == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }
            else
            {
                User_Class usuario_sesion = new User_Class();
                usuario_sesion = usuario_sesion.getUser(userCookie.Value);

                if (usuario_sesion.Pass == passCookie.Value)
                {
                    if (!IsPostBack)
                    {
                        User_Class myUser = new User_Class();
                        myUser = myUser.getUser(userCookie.Value);

                        Events_Class events = new Events_Class();

                        myUser.getFriends();

                        ListBox1.Items.Clear();
                        ListBox1.Width = 100;
                        ListBox2.Width = 100;

                        int i = 0;

                        ListItem l = new ListItem();

                        while (i < myUser.Friends.Count)
                        {
                            l = new ListItem();

                            l.Text = myUser.Friends[i].Name;
                            l.Value = i.ToString();
                            ListBox1.Items.Add(l);
                            i++;
                        }
                    }
                }
                else
                {
                    Response.Redirect("../Account/Login.aspx");
                }
            }
        }
Ejemplo n.º 5
0
        protected void SendGroup(object sender, EventArgs e)
        {
            HttpCookie userCookie;
            userCookie = Request.Cookies["UserID"];
            user = new User_Class();
            user = user.getUser(userCookie.Value);
            user.getFriends();

            Party_Class newParty = new Party_Class();
            newParty.Name = TextBox1.Text;

            Label3.Text = ListBox2.Items.Count.ToString();
            int indice=0;

            newParty.Users.Add(user);

            foreach (ListItem li in ListBox2.Items)
            {
                indice = Int32.Parse(li.Value);
                newParty.Users.Add(user.Friends[indice]);
            }

            if (ListBox2.Items.Count == 0 || TextBox1.Text == "")
            {
                Label3.Text = "Add users and set Name.";
            }
            else
            {
                if (newParty.createParty())
                    Response.Redirect("..//Asp_forms/Groups.aspx");
                else
                    Label3.Text = "error";
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie userCookie;
            HttpCookie passCookie;

            userCookie = Request.Cookies["UserID"];
            passCookie = Request.Cookies["UserPass"];

            if (userCookie == null || passCookie == null)
            {
                Response.Redirect("../Account/Login.aspx");
            }
            else
            {
                User_Class usuario_sesion = new User_Class();
                usuario_sesion = usuario_sesion.getUser(userCookie.Value);

                if (usuario_sesion.Pass == passCookie.Value)
                {
                    if (Request.QueryString["all"] == "yes") RadioButtonList1.Items[1].Selected = true;
                    else RadioButtonList1.Items[0].Selected = true;

                    if (RadioButtonList1.Text == "Only my friends")
                    {
                        List<User_Class> lista = new List<User_Class>();
                        usuario_sesion.getFriends();

                        if (Request.QueryString["cadena"] != null)
                        {
                            lista = filterFriends(Request.QueryString["cadena"], usuario_sesion.Friends);
                        }
                        else
                        {
                            lista = usuario_sesion.Friends;
                        }

                        if (lista.Count() == 0)
                        {
                            Label label = new Label();
                            label.Attributes.Add("style", "float:center; margin-left:50px;");
                            label.ID = "LabelX";
                            label.Text = "<h2> No friends found! </h2>";
                            Panel2.Controls.Add(label);
                        }

                        HyperLink link = new HyperLink();

                        for (int j = 0; j < lista.Count(); j++)
                        {
                            link=new HyperLink();
                            link.Text=lista.ElementAt(j).Name;
                            link.NavigateUrl="~//Asp_forms/UserTable.aspx/?ID="+lista.ElementAt(j).Id.ToString();
                            link.Attributes.Add("style", "clear:both; margin-left:50px;");
                            Panel p = createPanel();
                            Panel2.Controls.Add(p);
                            p.Controls.Add(createImage(lista.ElementAt(j).Image_url));
                            p.Controls.Add(link);
                            p.Controls.Add(createPrfButton(lista.ElementAt(j).Id));
                            p.Controls.Add(createDelButton(lista.ElementAt(j).Id));
                        }
                    }

                    else if (RadioButtonList1.Text == "All Users")
                    {
                        List<User_Class> lista = new List<User_Class>();
                        if (Request.QueryString["cadena"] != null)
                        {
                            lista = filterFriends(Request.QueryString["cadena"], usuario_sesion.getAllUser());
                        }
                        else
                        {
                            lista = usuario_sesion.getAllUser();
                        }

                        HyperLink link = new HyperLink();

                        for (int j = 0; j < lista.Count(); j++)
                        {
                            link = new HyperLink();
                            link.Text = lista.ElementAt(j).Name;
                            link.NavigateUrl = "~//Asp_forms/UserTable.aspx/?ID=" + lista.ElementAt(j).Id.ToString();
                            link.Attributes.Add("style", "clear:both; margin-left:50px;");

                            Panel p = createPanel();
                            Panel2.Controls.Add(p);
                            p.Controls.Add(createImage(lista.ElementAt(j).Image_url));
                            p.Controls.Add(link);

                            if (usuario_sesion.isFriend(lista.ElementAt(j).Id))
                            {
                                p.Controls.Add(createPrfButton(lista.ElementAt(j).Id));
                            }

                            if (!usuario_sesion.isFriend(lista.ElementAt(j).Id))
                            {
                                p.Controls.Add(createAddButton(lista.ElementAt(j).Id));
                            }
                            else
                            {
                                p.Controls.Add(createDelButton(lista.ElementAt(j).Id));
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("../Account/Login.aspx");
                }
            }
        }
Ejemplo n.º 7
0
        protected void Send(object sender, EventArgs e)
        {
            HttpCookie userCookie;
            userCookie = Request.Cookies["UserID"];
            user = new User_Class();
            user = user.getUser(userCookie.Value);
            user.getFriends();

            Note_Class note = new Note_Class();

            note.Text = TextBox1.Text;
            note.Date = DateTime.Now.ToShortDateString();

            foreach (ListItem li in ListBox1.Items)
            {
                if (li.Selected == true)
                {
                    if (Int32.Parse(li.Value) == 0)
                    {
                        note.Type = 'O';
                    }
                    else if (Int32.Parse(li.Value) == 1)
                    {
                        note.Type = 'P';
                    }

                }
            }

            Category_Class category = new Category_Class();
            if (TextBox2.Text != null && TextBox2.Text != "")
            {
                category.Nombre = TextBox2.Text;
                note.Category = category.getCategoryId();
            }
            else
                note.Category = -1;

            List<User_Class> users = new List<User_Class>();
            int indice = 0;
            foreach (ListItem li in ListBox2.Items)
            {
                indice = Int32.Parse(li.Value);
                users.Add(user.Friends[indice]);
            }

            if (note.Type!=' ' && note.addNote(user.Id, users))
                Response.Redirect("../Asp_forms/Notes.aspx");
            else
                Label4.Text = "An error has occurred";
        }