protected void Page_Load(object sender, EventArgs e) { if (Session["usuarioNovo"] != null) { Session["usuario"] = Session["usuarioNovo"]; } if (Session["logado"].ToString() != "1") { Response.Redirect("default.aspx"); } else { lblUser.Text = Session["usuario"].ToString(); } profilePicture.ImageUrl = "data:image/png;base64," + Convert.ToBase64String((byte[])sql.selectImagem("imagem_cliente", "tblCliente", "usuario = '" + Session["usuario"] + "'")); if (sql.selectHasRows("quantidade_teclados", "tblCliente", "usuario = '" + Session["usuario"] + "'")) { string qtde = sql.selectCampos("quantidade_teclados", "tblCliente", "usuario = '" + Session["usuario"] + "'")[0]; if (qtde == "1") { blueLine.Attributes.Add("style", "transform:translateX(-240px)"); } else if (qtde == "2") { blueLine.Attributes.Add("style", "transform:translateX(-180px)"); } else if (qtde == "3") { blueLine.Attributes.Add("style", "transform:translateX(-120px)"); } else if (qtde == "4") { blueLine.Attributes.Add("style", "transform:translateX(-60px)"); } else if (qtde == "5") { blueLine.Attributes.Add("style", "transform:translateX(0px)"); } } if (sql.selectHasRows("tipoConta", "tblCliente", "usuario = '" + Session["usuario"] + "'")) { if (sql.selectCampos("tipoConta", "tblCliente", "usuario = '" + Session["usuario"] + "'")[0] == "p") { blueLine.Attributes.Add("style", "transform:translateX(0px)"); lblPlan.Text = "Plano Premium"; } } }
public static double calcularFrete(string cep, string id) { List <string> teclado = sql.selectCampos("*", "tblProdutoDaLoja", "id_produto = " + id + ""); var correios = new AcroniWeb_4._5.WSCorreiosFrete.CalcPrecoPrazoWSSoapClient(); var resposta = correios.CalcPrecoPrazo(string.Empty, string.Empty, "40010", "01101010", cep, teclado[3].ToString(), 1, decimal.Parse(teclado[6]), decimal.Parse(teclado[4]), decimal.Parse(teclado[5]), 0, "N", decimal.Parse(teclado[7]), "N"); var respostaReal = resposta.Servicos.FirstOrDefault(); return(double.Parse(respostaReal.Valor)); }
protected void Page_Load(object sender, EventArgs e) { string urlFotoPerfil = ""; List <string> campos = new List <string>(); if (Session["usuarioNovo"] != null) { campos = sql.selectCampos("nome, cpf, cep, email, usuario, senha", "tblCliente", "usuario = '" + Session["usuarioNovo"] + "'"); object imgObj = sql.selectImagem("imagem_cliente", "tblCliente", "usuario = '" + Session["usuarioNovo"] + "'"); if (!(imgObj == System.DBNull.Value)) { urlFotoPerfil = Convert.ToBase64String((byte[])imgObj); } } else { campos = sql.selectCampos("nome, cpf, cep, email, usuario, senha", "tblCliente", "usuario = '" + Session["usuario"] + "'"); object imgObj = sql.selectImagem("imagem_cliente", "tblCliente", "usuario = '" + Session["usuario"] + "'"); if (!(imgObj == System.DBNull.Value)) { urlFotoPerfil = Convert.ToBase64String((byte[])imgObj); } } Nome.Attributes["placeholder"] = campos[0]; CPF.Attributes["placeholder"] = campos[1]; CEP.Attributes["placeholder"] = campos[2]; Email.Attributes["placeholder"] = campos[3]; Usuario.Attributes["placeholder"] = campos[4]; Senha.Attributes["placeholder"] = campos[5]; if (urlFotoPerfil == "") { fotoPerfil.ImageUrl = "assets/img/imgperf.jpeg"; } else { fotoPerfil.ImageUrl = "data:image/jpg;base64," + urlFotoPerfil; } }
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(); }