Пример #1
0
        protected void MessageSend_Click(object sender, EventArgs e)
        {
            myDAL  objmyDAl     = new myDAL();
            String InputEmail   = Email.Text;
            String InputMessage = Comment.Text;

            bool flag = true;

            if (string.IsNullOrWhiteSpace(InputEmail))
            {
                Email.CssClass   = Email.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (flag)
            {
                int result = 0;
                int found  = 1;
                found = objmyDAl.MessageSend_DAL(InputEmail, InputMessage, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == 0)
                    {
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Your message has been sent!";
                        Response.AddHeader("REFRESH", "1;URL=/Home.aspx");
                        //Response.Redirect("./Home.aspx");
                    }
                    else if (result == 1)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Invalid email address provided.";
                    }
                }
            }
        }