예제 #1
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");
            }
        }
예제 #2
0
        public void displayMessage(message message)
        {
            Label messageLabel = new Label();
            HyperLink berichtUserHyperLink = new HyperLink();
            berichtUserHyperLink.Text = currentProfile.username;
            berichtUserHyperLink.NavigateUrl = "~/Quaacker.aspx?id=" + currentProfile.profileid;
            pan_Messages.Controls.Add(berichtUserHyperLink);
            messageLabel.Text = " quaackt: " + message.message1;
            pan_Messages.Controls.Add(messageLabel);

            pan_Messages.Controls.Add(new LiteralControl("<br />"));
            Label reactionHeaderLabel = new Label();
            reactionHeaderLabel.Text = "Reacties:";
            pan_Messages.Controls.Add(reactionHeaderLabel);
        }
예제 #3
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);
        }