Пример #1
0
        protected void gv_active_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ctx = new QuaackEntities();
            var result = (from p in ctx.profile select p).ToList();

            //Ophalen argumenten die vanaf de browser zijn meegestuurd.
            var x = this.Request.Form["__EVENTARGUMENT"];

            //in __EVENTARGUMENT zit een regelwaarde voorgegaan door een dollarteken.
            //maw regel 1 van de gridview (en dus van de lijst result) indien erop geklikt, enz. en parse

            int regel = int.Parse(x.Substring(x.IndexOf("$") + 1));

            //JdJ: niet profile maar follower tabel kiezen. Dus eigen volger blokkeren

            var tempBlocked = result[regel].tempblocked;

            profile t = new profile();

            if (tempBlocked)
            {
                t.tempblocked = false;
              //  t.tempblockeddatetime = null;
            }
            else
            {
                t.tempblocked = true;
                t.tempblockeddatetime = DateTime.Now;
            }

            //JdJ: het doorvoeren van de wijziging lukt nog niet
            //ctx.profile.
            ctx.SaveChanges();
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string value = Request.QueryString["id"];

            if (value != null)
            {
                int myval = int.Parse(value);

                var ctx = new QuaackEntities();

                var q = (from i in ctx.profile where i.profileid == myval select i).FirstOrDefault();

                if (q != null)
                {
                    //                    if (q.verficationpendingdatetime.Value > (int)(DateTime.Now.Subtract)
                    {
                        q.verificationpending = false;
                        ctx.SaveChanges();

                        lbl_message.Text = "Uw registratie is gelukt";
                    }
                }
                else
                {
                    lbl_message.Text = "Uw registratie is niet gelukt";
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                int subjectID = Convert.ToInt32(Session["profileID"]);

                var ctx = new QuaackEntities();

               var result = (from f in ctx.follower
                              orderby f.subject
                              join p in ctx.profile on f.follower1 equals p.profileid
                              where f.subject == subjectID
                              select new { p.username, p.permblocked, p.permblockeddatetime }).ToList();
            /*
                var result = (from p in ctx.profile
                              join f in ctx.follower on subjectID ==
                              where
                              select new { p.username, p.mobilenumber, p.tempblocked, p.tempblockeddatetime }).ToList();
            */
                gv_active.DataSource = result;
                gv_active.DataBind();
            }
            else
            {
                //Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string value = Request.QueryString["id"];

            if (value != null)
            {
                int myval = int.Parse(value);
                var ctx = new QuaackEntities();
                var q = (from i in ctx.profile where i.profileid == myval where i.verificationpending == true select i).FirstOrDefault();

                if (q != null)
                {
                    var dateTimeNow = DateTime.Now;
                    var verificationDateTime = (from i in ctx.profile where i.profileid == myval select i.verficationpendingdatetime).FirstOrDefault();
                    var checkVerificatioDateTime = verificationDateTime.Value.AddMinutes(10);

                    if (checkVerificatioDateTime >= dateTimeNow)
                    {
                        q.verificationpending = false;
                        ctx.SaveChanges();

                        lbl_message.Text = "Uw registratie is gelukt";
                    }
                    else
                    {
                        lbl_message.Text = "Uw registratie is niet gelukt doordat niet binnen 10 minuten gereageerd is";
                    }
                }
                else
                {
                    lbl_message.Text = "Uw registratie is niet gelukt of is al geactiveerd";
                }
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string value = Request.QueryString["id"];

            if (value != null)
            {
                int myval = int.Parse(value);

                var ctx = new QuaackEntities();

                var q = (from i in ctx.profile where i.profileid == myval select i).FirstOrDefault();

                if (q != null)
                {
                    //                    if (q.verficationpendingdatetime.Value > (int)(DateTime.Now.Subtract)
                    {
                        q.verificationpending = false;
                        ctx.SaveChanges();

                        lbl_message.Text = "Uw registratie is gelukt";
                    }
                }
                else
                {
                    lbl_message.Text = "Uw registratie is niet gelukt";
                }
            }
        }
        protected void gv_addremovefollower_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ctx = new QuaackEntities();
            var result = (from p in ctx.profile select p).ToList();

            //Ophalen argumenten die vanaf de browser zijn meegestuurd.
            var x = this.Request.Form["__EVENTARGUMENT"];

            //in __EVENTARGUMENT zit een regelwaarde voorgegaan door een dollarteken.
            //maw regel 1 van de gridview (en dus van de lijst result) indien erop geklikt, enz. en parse

            int regel = int.Parse(x.Substring(x.IndexOf("$") + 1));

            var naam = result[regel].username;
            var id = result[regel].profileid;

            int profileID = Convert.ToInt32(Session["profileID"]);

            follower f = new follower();

            f.subject = profileID;
            f.follower1 = id;

            ctx.follower.Add(f);
            ctx.SaveChanges();

            Response.Redirect("Follower.aspx");
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ctx    = new QuaackEntities();
            var result = (from l in ctx.profile select l).ToList();

            gv_profile.DataSource = result;
            gv_profile.DataBind();
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ctx    = new QuaackEntities();
            var result = (from f in ctx.follower select f).ToList();

            gv_follower.DataSource = result;
            gv_follower.DataBind();
        }
Пример #9
0
 public profile getProfile(int userId)
 {
     var qe = new QuaackEntities();
     var profileResult =
         (from q in qe.profile
          where q.profileid == userId
          select q).First();
     return profileResult;
 }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int subjectID = Convert.ToInt32(Session["profileID"]);
            var ctx = new QuaackEntities();
            var result = (from f in ctx.follower
                          join p in ctx.profile on f.follower1 equals p.profileid
                          where f.subject == subjectID
                          select new {p.username}).ToList();

            gv_follower.DataSource = result;
            gv_follower.DataBind();
        }
Пример #11
0
        protected void btn_send_Click(object sender, EventArgs e)
        {
            //let op: SMSgateway kent een GSM nr. Followers van deze user of profile kunnen dit ook in OwnPage zien, dus geen persoonlijke berichten.
            if (tb_mobilenumber.Text == "")
            {

                lbl_message.Text = "Select follower for mobile number";
            }
            else
            {
                var ctx = new QuaackEntities();

                int sendID = Convert.ToInt32(Session["profileID"]);

                message m = new message();

                m.messdatetime = DateTime.Now;
                m.sender = sendID;
                m.message1 = tb_email.Text;

                ctx.message.Add(m);
                ctx.SaveChanges();

                var link = string.Format("http://Quaack.system-Engineer.nl:8080/Twitter.aspx?id={0}", m.messid.ToString());

                //indien SMS gateway zal het mobilenr ingevuld moeten worden ipv dit standaard email account.
                //MailMessage mail = new MailMessage("*****@*****.**", mobilenumber, "message", link);

                MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**", "message", link);
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient("smtp.gmail.com");
                smtp.EnableSsl = true;
                smtp.Port = 587;
                System.Net.NetworkCredential c = new System.Net.NetworkCredential();
                c.UserName = "******";
                c.Password = "******";
                smtp.Credentials = c;

                try
                {
                    smtp.Send(mail);
                }

                catch (Exception errormsg)
                {
                    Console.Write(errormsg);
                }

                Response.Redirect("OwnPage.aspx");
            }
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                var ctx = new QuaackEntities();
                var result = (from p in ctx.profile select new { p.username, p.mobilenumber }).ToList();

                gv_addremovefollower.DataSource = result;
                gv_addremovefollower.DataBind();
            }
            else
            {
                Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #13
0
 public List<message> getCurrentUserLast10Messages()
 {
     List<message> result = new List<message>();
     QuaackEntities qe = new QuaackEntities();
     var messages =
           (from qem in qe.message
            where qem.sender == currentUserId && qem.parentmessid == null
            orderby qem.messdatetime
            select qem).Take(10);
     foreach (var message in messages)
     {
         result.Add(message);
     }
     return result;
 }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                int subjectID = Convert.ToInt32(Session["profileID"]);

                var ctx = new QuaackEntities();

                var resultOwnMessage = (from m in ctx.message
                                        where subjectID == m.sender
                                        select new { m.messdatetime, m.message1 }).ToList();

                gv_ownmessage.DataSource = resultOwnMessage;
                gv_ownmessage.DataBind();

                //creeer lijst met id's
                var followerResults = (from f in ctx.follower
                                       where f.subject == subjectID
                                       select  f.follower1).ToList();

                //JdJ: dit gaat niet goed
                //haal dmv lijst de messages op
                /*
                var messageResults = "";

                foreach (var item in followerResults)
                {
                    messageResults += (from m in ctx.message
                                      where item == m.sender
                                      select new { m.message1 });
                }
                */

                //JdJ: nu statisch om toch het resultaat te laten zien
                var messageResults = (from m in ctx.message
                                      where m.sender == 24
                                      select new { m.messdatetime, m.message1 }).ToList();

                gv_lastmessage.DataSource = messageResults;
                //gv_lastmessage.DataSource = followerResults;

                gv_lastmessage.DataBind();
            }
            else
            {
                Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #15
0
        protected void gv_addfollower_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ctx = new QuaackEntities();

            var result = (from p in ctx.profile select p).ToList();

            //Ophalen argumenten die vanaf de browser zijn meegestuurd.
            var x = this.Request.Form["__EVENTARGUMENT"];

            //in __EVENTARGUMENT zit een regelwaarde voorgegaan door een dollarteken.
            //maw regel 1 van de gridview (en dus van de lijst result) indien erop geklikt, enz. en parse

            int regel = int.Parse(x.Substring(x.IndexOf("$") + 1));

            tb_mobilenumber.Text = result[regel].mobilenumber;
            lbl_message.Text = "Mobile number";
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                int subjectID = Convert.ToInt32(Session["profileID"]);
                var ctx = new QuaackEntities();
                var result = (from f in ctx.follower
                              join p in ctx.profile on f.follower1 equals p.profileid
                              where f.subject == subjectID
                              select new { p.username }).ToList();

                gv_follower.DataSource = result;
                gv_follower.DataBind();
            }
            else
            {
                Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                int sendID = Convert.ToInt32(Session["profileID"]);

                var ctx = new QuaackEntities();

                var result = (from l in ctx.message
                              where l.sender == sendID
                              select new { l.message1, l.messdatetime }).ToList();

                gv_message.DataSource = result;
                gv_message.DataBind();
            }
            else
            {
                Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                int profileID = Convert.ToInt32(Session["profileID"]);

                var ctx = new QuaackEntities();

                var result = (from p in ctx.profile
                              where p.profileid == profileID
                              select p).ToList();

                gv_profile.DataSource = result;
                gv_profile.DataBind();
            }
            else
            {
                Response.Redirect("/Account/Login.aspx");
            }
        }
Пример #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (User.Identity.IsAuthenticated)
     {
         QuaackEntities ctx = new QuaackEntities();
         var queryResult =
             from r in ctx.profile
             where r.username == User.Identity.Name
             select r;
         foreach (var item in queryResult)
         {
             int profileID = item.profileid;
             Session["profileID"] = profileID;
         }
     }
     else
     {
         Response.Redirect("/Account/Login.aspx");
     }
 }
Пример #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string value = Request.QueryString["id"];

            if (value != null)
            {
                int myval = int.Parse(value);
                var ctx = new QuaackEntities();
                var message = (from m in ctx.message where m.messid == myval select m.message1).FirstOrDefault();

                if (message != null)
                {
                    lbl_twitter.Text = message.ToString();
                }
                else
                {
                    lbl_twitter.Text = "Geen bericht ontvangen";
                }
            }
        }
Пример #21
0
        protected void gv_zoek_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ctx = new QuaackEntities();
            var result = (from p in ctx.profile select p).ToList();

            //Ophalen argumenten die vanaf de browser zijn meegestuurd.
            var x = this.Request.Form["__EVENTARGUMENT"];

            //in __EVENTARGUMENT zit een regelwaarde voorgegaan door een dollarteken.
            //maw regel 1 van de gridview (en dus van de lijst result) indien erop geklikt, enz. en parse

            int regel = int.Parse(x.Substring(x.IndexOf("$") + 1));

            var id = result[regel].profileid;

            Session["profileID"] = id;

            //Roy, van hier aan jou. Je id in een session gezet.

            /* oude code
                      string value = Request.QueryString["id"];

                        if (value != null)
                        {
                            int myval = int.Parse(value);

                            var ctx = new QuaackEntities();

                            var q = (from i in ctx.profile where i.profileid == myval select i).FirstOrDefault();

                            if (q != null)
                            {
                                Response.Redirect("/OwnPage.aspx?id={0}");
                            }

                            else
                            {
                            }

                         */
        }
Пример #22
0
        public void displayReactions(List<message> reactions)
        {
            pan_Messages.Controls.Add(new LiteralControl("<ul>"));
            foreach (message reaction in reactions)
            {
                QuaackEntities qe = new QuaackEntities();
                string username =
                    (from user in qe.profile
                     where user.profileid == reaction.sender
                     select user.username).First().ToString();

                pan_Messages.Controls.Add(new LiteralControl("<li>"));
                Label reactionLabel = new Label();
                HyperLink userHyperLink = new HyperLink();
                userHyperLink.Text = username;
                userHyperLink.NavigateUrl = "~/Quaacker.aspx?id=" + reaction.sender;
                pan_Messages.Controls.Add(userHyperLink);
                reactionLabel.Text = " reageert: " + reaction.message1;
                pan_Messages.Controls.Add(reactionLabel);
                pan_Messages.Controls.Add(new LiteralControl("</li>"));
            }
            pan_Messages.Controls.Add(new LiteralControl("</ul>"));
        }
Пример #23
0
        void placeReactionButtonBtn_Click(Object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            int parentMessageID = Convert.ToInt32(btn.CommandArgument);
            TextBox reactionControl = new TextBox();
            int userId = (int)Session["profileID"];

            foreach (Control c in pan_Messages.Controls)
            {
                if (c is TextBox)
                {
                    if (c.ID == parentMessageID.ToString())
                    {
                        reactionControl = (TextBox)c;
                    }
                }
            }
            message m = new message();
            m.messdatetime = DateTime.Now;
            m.sender = userId;
            m.parentmessid = parentMessageID;
            m.message1 = reactionControl.Text;
            m.removed = false;

            QuaackEntities qeB = new QuaackEntities();
            qeB.message.Add(m);
            qeB.SaveChanges();
            Response.Redirect(Request.RawUrl);
        }
Пример #24
0
 public List<message> getReactions(int messageID)
 {
     List<message> result = new List<message>();
     var qe1 = new QuaackEntities();
     var reactionMessages =
             from qerms in qe1.message
             where qerms.parentmessid == messageID
             select qerms;
     foreach (var item in reactionMessages)
     {
         result.Add(item);
     }
     return result;
 }
Пример #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Check of user ingelogd is... anders eerst redirect naar inlogpagina.
            if (User.Identity.IsAuthenticated)
            {
                ProfileId = (int)Session["profileID"];
                string verifyChanges = Request.QueryString["verified"];
                DateTime currentDate = DateTime.Now;
                DateTime verifyDate = Convert.ToDateTime(Request.QueryString["datetime"]);

                var qe = new QuaackEntities();
                var profileResult =
                    (from q in qe.profile
                    where q.profileid == ProfileId
                    select q).First();

                if(!(profileResult==null))
                {
                    if ((ProfileId == Convert.ToInt16(verifyChanges)) && verifyDate >= currentDate)
                    {
                        if (!(Request.QueryString["profile"] == null))
                        {
                            profileResult.profile1 = Server.UrlDecode(Request.QueryString["profile"]);
                        }
                        if (!(Request.QueryString["email"] == null))
                        {
                            profileResult.email = Server.UrlDecode(Request.QueryString["email"]);
                        }
                        if (!(Request.QueryString["mobilenumber"] == null))
                        {
                            profileResult.mobilenumber = Server.UrlDecode(Request.QueryString["mobilenumber"]);
                        }
                        if (!(Request.QueryString["avatar"] == null))
                        {
                            profileResult.avatarlocation = Server.UrlDecode(Request.QueryString["avatar"]);
                        }
                        if (!(Request.QueryString["delete"] == null))
                        {
                            profileResult.removed = Convert.ToBoolean(Server.UrlDecode(Request.QueryString["delete"]));
                            profileResult.removeddatetime = DateTime.Now;
                            lbl_DeleteProfile.Text = "Uw profiel is succesvol verwijderd";
                            FormsAuthentication.SignOut();
                        }
                        qe.SaveChanges();
                    }
                    var newProfileResult =
                            (from q in qe.profile
                             where q.profileid == ProfileId
                             select q).First();
                    img_Avatar.ImageUrl = newProfileResult.avatarlocation;
                    lbl_ProfileSketch.Text = newProfileResult.profile1;
                    lbl_Email.Text = newProfileResult.email;
                    lbl_MobileNumber.Text = (string)newProfileResult.mobilenumber;
                    EmailAdress = newProfileResult.email;
                }

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