Example #1
0
 protected void btnEntra_Click(object sender, EventArgs e)
 {
     if (HttpContext.Current.Request.QueryString["id"] != null)
     {
         d.btnEntra(txtUsu, txtPass, ckbLogin, lblMsg, "~/View/carrinho.aspx?id=" + HttpContext.Current.Request.QueryString["id"]);
     }
     else
     {
         d.btnEntra(txtUsu, txtPass, ckbLogin, lblMsg, "~/View/escolher-pagamento.aspx");
     }
     SCPanel.Update();
 }
Example #2
0
 protected void btnEntra_Click(object sender, EventArgs e)
 {
     d.btnEntra(txtUsu, txtPass, ckbLogin, lblMsg, "~/View/galeria.aspx");
     SCPanel.Update();
 }
 protected void Update_Text(object sender, EventArgs e)
 {
     txtDFS.Text = txtStocked.Text;
     SCPanel.Update();
 }
Example #4
0
        protected void btnEntra_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtUsu.Text) && !string.IsNullOrEmpty(txtPass.Text))
            {
                if (!txtUsu.Text.Contains("@"))
                {
                    try
                    {
                        if (sql.selectHasRows("*", "tblCliente", "usuario='" + txtUsu.Text + "'"))
                        {
                            txtUsu.Attributes.Add("style", "border-color:#0093ff");

                            if (sql.selectHasRows("usuario", "tblCliente", "senha='" + txtPass.Text + "' and usuario='" + txtUsu.Text + "'"))
                            {
                                Session["logado"]  = "1";
                                Session["usuario"] = txtUsu.Text;
                                if (ckbLogin.Checked)
                                {
                                    HttpCookie cookie = new HttpCookie("credenciais");
                                    cookie.Values["usuario"] = txtUsu.Text;
                                    cookie.Values["senha"]   = txtPass.Text;
                                    cookie.Expires           = DateTime.Now.AddDays(365);
                                    Response.Cookies.Add(cookie);
                                }
                                Response.Redirect("galeria.aspx");
                                txtPass.Attributes.Add("style", "border-color:#0093ff");
                            }
                            else
                            {
                                lblMsg.Text      = "Senha incorreta";
                                lblMsg.ForeColor = System.Drawing.Color.Red;
                                txtPass.Attributes.Add("style", "border-color:red");
                                Session["logado"] = "0";
                            }
                        }
                        else
                        {
                            lblMsg.Text      = "Usuário e senha incorretos";
                            lblMsg.ForeColor = System.Drawing.Color.Red;
                            txtUsu.Attributes.Add("style", "border-color:red");
                            txtPass.Attributes.Add("style", "border-color:red");
                            Session["logado"] = "0";
                        }
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        if (sql.selectHasRows("*", "tblCliente", "email='" + txtUsu.Text + "'"))
                        {
                            txtUsu.Attributes.Add("style", "border-color:#0093ff");

                            if (sql.selectHasRows("usuario", "tblCliente", "senha='" + txtPass.Text + "' and email='" + txtUsu.Text + "'"))
                            {
                                Session["logado"] = "1";

                                Session["usuario"] = sql.selectCampos("usuario", "tblCliente", "email= '" + txtUsu.Text + "'")[0];
                                if (ckbLogin.Checked)
                                {
                                    HttpCookie cookie = new HttpCookie("credenciais");
                                    cookie.Values["usuario"] = Session["usuario"].ToString();
                                    cookie.Values["senha"]   = txtPass.Text;
                                    cookie.Expires           = DateTime.Now.AddDays(365);
                                    Response.Cookies.Add(cookie);
                                }
                                Response.Redirect("galeria.aspx");
                                txtPass.Attributes.Add("style", "border-color:#0093ff");
                            }
                            else
                            {
                                lblMsg.Text      = "Senha incorreta";
                                lblMsg.ForeColor = System.Drawing.Color.Red;
                                txtPass.Attributes.Add("style", "border-color:red");
                                Session["logado"] = "0";
                            }
                        }
                        else
                        {
                            lblMsg.Text      = "Usuário e senha incorretos";
                            lblMsg.ForeColor = System.Drawing.Color.Red;
                            txtUsu.Attributes.Add("style", "border-color:red");
                            txtPass.Attributes.Add("style", "border-color:red");
                            Session["logado"] = "0";
                        }
                    }
                    catch { }
                }
            }
            else
            {
                lblMsg.Text      = "Campo vazio";
                lblMsg.ForeColor = System.Drawing.Color.Red;
                if (string.IsNullOrEmpty(txtUsu.Text))
                {
                    txtUsu.Attributes.Add("style", "border-color:red");
                }
                else
                {
                    txtUsu.Attributes.Remove("style");
                }
                if (string.IsNullOrEmpty(txtPass.Text))
                {
                    txtPass.Attributes.Add("style", "border-color:red");
                }
                else
                {
                    txtPass.Attributes.Remove("style");
                }
                Session["logado"] = "0";
            }
            SCPanel.Update();
        }