protected void Button4_Click(object sender, EventArgs e) { Metodos_Gerais MG = new Metodos_Gerais(); string error = " "; int id = Convert.ToInt32(Session["idlogin"]); DAL.DALEndereco aDALEndereco = new DAL.DALEndereco(); Modelo.Endereco aE = new Modelo.Endereco(0, rua.Text, numero.Text, cep.Text, bairro.Text, cidade.Text, uf.Text, id); if (MG.IsNull(rua.Text)) { if (MG.IsNull(numero.Text)) { if (MG.IsNull(cep.Text)) { if (MG.IsNull(bairro.Text)) { if (MG.IsNull(cidade.Text)) { aDALEndereco.Insert(aE); Response.Redirect(Request.Url.ToString()); } else { error = "Cidade"; Error(error); } } else { error = "Bairro"; Error(error); } } else { error = "CEP"; Error(error); } } else { error = "Numero"; Error(error); } } else { error = "Rua"; Error(error); } }
protected void Insert(object sender, EventArgs e) { DAL.DALRefeicao aDALRefeicao = new DAL.DALRefeicao(); Modelo.Refeicao aR = new Modelo.Refeicao(0, TextBoxIngredientes.Text, TextBoxModoPreparo.Text, "", TextBoxNome.Text); Metodos_Gerais MG = new Metodos_Gerais(); string error = " "; if (MG.IsNull(TextBoxIngredientes.Text)) { if (MG.IsNull(TextBoxModoPreparo.Text)) { if (MG.IsNull(TextBoxNome.Text)) { aDALRefeicao.Insert(aR); int count = aDALRefeicao.Count(); int id = aDALRefeicao.SelectAll().ElementAt(count - 1).id; if (FileUpload1.HasFile) { string filename = "Imagens\\Receitas\\Refeicao" + id + ".jpg"; FileUpload1.SaveAs(Request.PhysicalApplicationPath + filename); aR = new Modelo.Refeicao(id, TextBoxIngredientes.Text, TextBoxModoPreparo.Text, filename, TextBoxNome.Text); aDALRefeicao.UpdateImagem(aR); } Response.Redirect("~\\WebFormRefeicoes.aspx"); } else { error = "Nome"; Error(error); } } else { error = "Modo de Preparo"; Error(error); } } else { error = "Ingredientes"; Error(error); } }
protected void Button1_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Session["EditR"]); DAL.DALRefeicao aDALRefeicao = new DAL.DALRefeicao(); Modelo.Refeicao aR = new Modelo.Refeicao(id, TextBoxIngredientes.Text, TextBoxModoPreparo.Text, "", TextBoxNome.Text); Metodos_Gerais MG = new Metodos_Gerais(); string error = " "; if (MG.IsNull(TextBoxIngredientes.Text)) { if (MG.IsNull(TextBoxModoPreparo.Text)) { if (MG.IsNull(TextBoxNome.Text)) { aDALRefeicao.Update(aR); if (FileUpload1.HasFile) { string filename = "Imagens\\Receitas\\Refeicao" + id + ".jpg"; FileUpload1.SaveAs(Request.PhysicalApplicationPath + filename); aR = new Modelo.Refeicao(id, TextBoxIngredientes.Text, TextBoxModoPreparo.Text, filename, TextBoxNome.Text); aDALRefeicao.UpdateImagem(aR); } Response.Redirect("~\\WebFormRefeicoes.aspx"); } else { error = "Nome"; Error(error); } } else { error = "Modo de Preparo"; Error(error); } } else { error = "Ingredientes"; Error(error); } }
protected void Button2_Click(object sender, EventArgs e) { Modelo.Clientes aClientes; DAL.DALClientes aDALClientes; Metodos_Gerais AM = new Metodos_Gerais(); aClientes = new Modelo.Clientes( Convert.ToInt32(Session["idlogin"]), TextBoxNome.Text, TextBoxCPF.Text, TextBoxTelefone.Text, TextBoxEmail.Text, "", "", DateTime.Now, 0, ""); aDALClientes = new DAL.DALClientes(); string error = " "; if (AM.IsNull(TextBoxNome.Text)) { if (AM.VerifyCpf(TextBoxCPF.Text)) { if (AM.IsNull(TextBoxTelefone.Text)) { if (AM.IsNull(TextBoxEmail.Text)) { aDALClientes.Update(aClientes); Session["Edit"] = 0; Response.Redirect(Request.Url.ToString()); } else { error = "Email"; Error(error); } } else { error = "Telefone"; Error(error); } } else { error = "CPF"; Error(error); } } else { error = "Nome"; Error(error); } }
protected void Page_Load(object sender, EventArgs e) { int i = Convert.ToInt32(Session["idlogin"]); Metodos_Gerais aMetodos = new Metodos_Gerais(); aMetodos.VerficarL(i); DAL.DALClientes aDALClientes = new DAL.DALClientes(); //Button1.Text = Session["Nivel"].ToString(); //Button2.Text = Session["idlogin"].ToString(); if (Convert.ToInt32(Session["Nivel"]) == 3) { Button2.Text = "Funcionarios"; Button3.Text = "Pacotes"; Label1.Attributes["style"] = "display : none;"; ImageButton1.CssClass = "display"; } if (Convert.ToInt32(Session["Nivel"]) == 2) { Button3.CssClass = "display"; Label1.Attributes["style"] = "display : none;"; ImageButton1.CssClass = "display"; } if (Convert.ToInt32(Session["Nivel"]) == 1) { Label1.Text = aMetodos.VerificarDouble(aDALClientes.Select1(i).ElementAt(0).Saldo); Label1.CssClass += " txt15"; ImageButton1.ImageUrl = aDALClientes.Select1(i).ElementAt(0).Url_Imagem; //Image1.ImageUrl = aDALClientes.Select1(i).ElementAt(0).Url_Imagem; //Image1.CssClass = "img-responsive img-circle"; } }
protected void Page_Load(object sender, EventArgs e) { int count; DAL.DALPacote aDALPacote = new DAL.DALPacote(); Metodos_Gerais aMetodos = new Metodos_Gerais(); DAL.DALTransacaoPacote aDALTPacote = new DAL.DALTransacaoPacote(); count = aDALPacote.A(); int type = Convert.ToInt32(DropDownList1.SelectedValue); for (int i = 0; i <= count - 1; i++) { int id = aDALPacote.SelectAll(type).ElementAt(i).id; if (aDALTPacote.VerificarT(id, Convert.ToInt32(Session["idlogin"]))) { Panel p1, p2, p3; Image img; Label l1, l2; HtmlGenericControl h3, h5; Button b1; h3 = new HtmlGenericControl("h3"); h5 = new HtmlGenericControl("h5"); l1 = new Label(); l1.Text = aDALPacote.SelectAll(type).ElementAt(i).Nome; l1.CssClass = "txt5"; l2 = new Label(); l2.Text = aMetodos.VerificarDouble(aDALPacote.SelectAll(type).ElementAt(i).Preco); l2.CssClass = "txt6"; img = new Image(); img.ImageUrl = aDALPacote.SelectAll(type).ElementAt(i).Url_Imagem; b1 = new Button(); b1.CssClass = "login-form-btn center-block"; b1.Text = "Ver Mais"; b1.PostBackUrl = "~/WebFormPacoteDetalhar.aspx?Pacote=" + id; p2 = new Panel(); p2.CssClass = "thumbnail"; p3 = new Panel(); p3.CssClass = "caption text-center"; p1 = new Panel(); p1.CssClass = "col-sm-3"; p2.Controls.Add(img); h3.Controls.Add(l1); p3.Controls.Add(h3); h5.Controls.Add(l2); p3.Controls.Add(h5); p3.Controls.Add(b1); p2.Controls.Add(p3); p1.Controls.Add(p2); PlaceHolder1.Controls.Add(p1); } else { } } }
protected void Button7_Click1(object sender, EventArgs e) { Modelo.Nutricionista MA; DAL.DALClientes aDALClientes; DAL.DALAdministrador aDALAdministrador = new DAL.DALAdministrador(); DAL.DALNutricionista aDALNutricionista = new DAL.DALNutricionista(); aDALClientes = new DAL.DALClientes(); string error = " "; Metodos_Gerais MG = new Metodos_Gerais(); if (MG.IsNull(TextBoxNome.Text)) { if (MG.IsNull(TextBoxTelefone.Text)) { if (MG.IsNull(TextBoxEmail.Text)) { if (MG.IsNull(TextBoxLogin.Text)) { if (MG.IsNull(TextBoxSenha.Text)) { if (aDALClientes.CountLogin(TextBoxLogin.Text) <= 0 && aDALAdministrador.CountLogin(TextBoxLogin.Text) <= 0 && aDALNutricionista.CountLogin(TextBoxLogin.Text) <= 0) { if (aDALClientes.CountEmail(TextBoxEmail.Text) <= 0 && aDALAdministrador.CountEmail(TextBoxEmail.Text) <= 0 && aDALNutricionista.CountEmail(TextBoxEmail.Text) <= 0) { MA = new Modelo.Nutricionista(0, TextBoxNome.Text, TextBoxTelefone.Text, TextBoxLogin.Text, TextBoxLogin.Text, TextBoxSenha.Text, DateTime.Now); aDALNutricionista.Insert(MA); Response.Redirect("~\\WebFormClientes.aspx"); } else { error = "O Email já está cadastrado"; Error(error); } } else { error = "O Login já está cadastrado"; Error(error); } } else { error = "O campo senha está vazio"; Error(error); } } else { error = "O campo login está vazio"; Error(error); } } else { error = "O campo email está vazio"; Error(error); } } else { error = "O campo telefone está vazio"; Error(error); } } else { error = "O campo Nome está vazio"; Error(error); } }
protected void Page_Load(object sender, EventArgs e) { DAL.DALClientes DC = new DAL.DALClientes(); Metodos_Gerais aM = new Metodos_Gerais(); int count = DC.Count(); if (count > 0) { Table t1; TableRow tr1; TableCell tc1; Button b2; t1 = new Table(); tr1 = new TableRow(); tc1 = new TableCell(); tc1.Text = "Nome"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Telefone"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Email"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Login"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "CPF"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Data de Cadastro"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Saldo"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Excluir"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); t1.Controls.Add(tr1); for (int i = 0; i <= count - 1; i++) { tr1 = new TableRow(); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).Nome; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).Telefone; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).Email; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).Login; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).CPF; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aM.VerificarDouble(DC.SelectAll().ElementAt(i).Saldo); tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = DC.SelectAll().ElementAt(i).DataCadastro.ToString(); tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); t1.Controls.Add(tr1); b2 = new Button(); tc1 = new TableCell(); b2.Text = "Excluir"; b2.ID = " " + DC.SelectAll().ElementAt(i).id.ToString(); b2.Click += new EventHandler(Excluir); b2.CssClass = "login20-form-btn"; tc1.Controls.Add(b2); tr1.Controls.Add(tc1); t1.Controls.Add(tr1); } t1.CssClass = "bug table-striped"; PlaceHolder2.Controls.Add(t1); DAL.DALNutricionista DN = new DAL.DALNutricionista(); int count2 = DN.Count(); if (count > 0) { Table t2; TableRow tr2; TableCell tc2; Button b3; t2 = new Table(); tr2 = new TableRow(); tc2 = new TableCell(); tc2.Text = "Nome"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = "Telefone"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = "Email"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = "Login"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = "Data Nascimento"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = "Excluir"; tc2.CssClass = "txt16"; tr2.Controls.Add(tc2); t2.Controls.Add(tr2); for (int i = 0; i <= count2 - 1; i++) { tr2 = new TableRow(); tc2 = new TableCell(); tc2.Text = DN.SelectAll().ElementAt(i).Nome; tc2.CssClass = "txt17"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = DN.SelectAll().ElementAt(i).Telefone; tc2.CssClass = "txt17"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = DN.SelectAll().ElementAt(i).Email; tc2.CssClass = "txt17"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = DC.SelectAll().ElementAt(i).Login; tc2.CssClass = "txt17"; tr2.Controls.Add(tc2); tc2 = new TableCell(); tc2.Text = DN.SelectAll().ElementAt(i).DataNascimento.ToString(); tc2.CssClass = "txt17"; tr2.Controls.Add(tc2); t2.Controls.Add(tr2); b3 = new Button(); tc2 = new TableCell(); b3.Text = "Excluir"; b3.ID = " " + DN.SelectAll().ElementAt(i).id.ToString(); b3.Click += new EventHandler(ExcluirA); b3.CssClass = "login20-form-btn"; tc2.Controls.Add(b3); tr2.Controls.Add(tc2); t2.Controls.Add(tr2); } t2.CssClass = "bug table-striped"; PlaceHolder1.Controls.Add(t2); } } }
protected void Button1_Click(object sender, EventArgs e) { Modelo.Clientes aClientes; DAL.DALClientes aDALClientes; DAL.DALAdministrador aDALAdministrador = new DAL.DALAdministrador(); DAL.DALNutricionista aDALNutricionista = new DAL.DALNutricionista(); aDALClientes = new DAL.DALClientes(); string error = " "; Metodos_Gerais MG = new Metodos_Gerais(); if (TextBoxSenha.Text == TextBoxSenhaV.Text) { if (MG.VerifyCpf(TextBoxCPF.Text)) { if (MG.IsNull(TextBoxNome.Text)) { if (MG.IsNull(TextBoxTelefone.Text)) { if (MG.IsNull(TextBoxEmail.Text)) { if (MG.IsNull(TextBoxLogin.Text)) { if (MG.IsNull(TextBoxSenha.Text)) { if (aDALClientes.CountLogin(TextBoxLogin.Text) <= 0 && aDALAdministrador.CountLogin(TextBoxLogin.Text) <= 0 && aDALNutricionista.CountLogin(TextBoxLogin.Text) <= 0) { if (aDALClientes.CountEmail(TextBoxEmail.Text) <= 0 && aDALAdministrador.CountEmail(TextBoxEmail.Text) <= 0 && aDALNutricionista.CountEmail(TextBoxEmail.Text) <= 0) { string filename; filename = "Imagens\\user.jpg"; // Instancia um Objeto de Livro com as informações fornecidas aClientes = new Modelo.Clientes( 0, TextBoxNome.Text, TextBoxCPF.Text, TextBoxTelefone.Text, TextBoxEmail.Text, TextBoxLogin.Text, TextBoxSenha.Text, DateTime.Now, 0, filename); aDALClientes.Insert(aClientes); Response.Redirect("~\\WebForm2.aspx"); } else { error = "O Email já está cadastrado"; Error(error); } } else { error = "O Login já está cadastrado"; Error(error); } } else { error = "O campo senha está vazio"; Error(error); } } else { error = "O campo login está vazio"; Error(error); } } else { error = "O campo email está vazio"; Error(error); } } else { error = "O campo telefone está vazio"; Error(error); } } else { error = "O campo Nome está vazio"; Error(error); } } else { error = "O campo CPF não é valido"; Error(error); } } else { error = "As senhas não coincidem"; Error(error); } }
protected void Editar(object sender, EventArgs e) { if (Convert.ToInt32(Session["idpacote"]) > 0) { int pacote = Convert.ToInt32(Session["idpacote"]); DAL.DALPacote aDALPacote = new DAL.DALPacote(); Metodos_Gerais MG = new Metodos_Gerais(); string filename, error = " "; if (MG.IsNull(Nome.Text)) { if (MG.IsNull(Preco.Text)) { if (MG.IsNull(TextBox1.Text)) { if (FileUpload1.HasFile) { filename = "Imagens\\Pacote\\pacote" + pacote + ".jpg"; FileUpload1.SaveAs(Request.PhysicalApplicationPath + filename); } else { filename = "Imagens\\Pacote\\Background_default.jpg"; } Modelo.Pacote aP = new Modelo.Pacote(pacote, Nome.Text, Convert.ToDouble(Preco.Text), TextBox1.Text, filename); aDALPacote.Update(aP); aDALPacote.UpdateImagem(aP); Response.Redirect("~\\WebFormPacotesListar.aspx"); } else { error = "Campo descrição vazio"; Error(error); } } else { error = "Campo Preço vazio"; Error(error); } } else { error = "Campo Nome vazio"; Error(error); } } else { DAL.DALPacote aDALPacote = new DAL.DALPacote(); Metodos_Gerais MG = new Metodos_Gerais(); string filename, error = " "; if (MG.IsNull(Nome.Text)) { if (MG.IsNull(Preco.Text)) { if (MG.IsNull(TextBox1.Text)) { Modelo.Pacote aP = new Modelo.Pacote(0, Nome.Text, Convert.ToDouble(Preco.Text), TextBox1.Text, ""); aDALPacote.Insert(aP); int count = aDALPacote.A(); int pacote = aDALPacote.SelectAll(5).ElementAt(count - 1).id; if (FileUpload1.HasFile) { filename = "Imagens\\Pacote\\pacote" + pacote + ".jpg"; FileUpload1.SaveAs(Request.PhysicalApplicationPath + filename); } else { filename = "Imagens\\Pacote\\Background_default.jpg"; } aP = new Modelo.Pacote(pacote, Nome.Text, Convert.ToDouble(Preco.Text), TextBox1.Text, filename); aDALPacote.UpdateImagem(aP); Response.Redirect("~\\WebFormPacotesListar.aspx"); } else { error = "Campo descrição vazio"; Error(error); } } else { error = "Campo Preço vazio"; Error(error); } } else { error = "Campo Nome vazio"; Error(error); } } }
protected void Page_Load(object sender, EventArgs e) { DAL.DALTransacaoPacote aDALTPacote = new DAL.DALTransacaoPacote(); DAL.DALAvaliacao aDALAvaliacao = new DAL.DALAvaliacao(); DAL.DALPacote_Refeicao aDALPacote_Refeicao = new DAL.DALPacote_Refeicao(); DAL.DALRefeicao aDALRefeicao = new DAL.DALRefeicao(); if (Convert.ToInt32(Session["Nivel"]) == 2 || Convert.ToInt32(Session["Nivel"]) == 3) { div2.Attributes["style"] = "display : none"; divControl.Attributes["class"] = "d-flex"; divComprar.Attributes["class"] = "display"; section.Attributes["class"] = "margintop-15"; } if (Convert.ToInt32(Request.QueryString["Pacote"]) > 0) { Session["idpacote"] = Convert.ToInt32(Request.QueryString["Pacote"]); int i, id, pacote, count, countall; DAL.DALPacote aDALPacote = new DAL.DALPacote(); Metodos_Gerais aMetodos = new Metodos_Gerais(); i = Convert.ToInt32(Session["idpacote"]); id = Convert.ToInt32(Session["idlogin"]); pacote = Convert.ToInt32(Session["idpacote"]); count = aDALPacote_Refeicao.CountPacote(pacote); countall = aDALRefeicao.Count(); LabelNome.Text = aDALPacote.Select(i).ElementAt(0).Nome; LabelPreco.Text = aMetodos.VerificarDouble(aDALPacote.Select(i).ElementAt(0).Preco); if (!IsPostBack) { Rating1.CurrentRating = aDALAvaliacao.Media(pacote); Rating1.ReadOnly = true; } if (!IsPostBack) { Nome.Text = aDALPacote.Select(i).ElementAt(0).Nome; Preco.Text = aDALPacote.Select(i).ElementAt(0).Preco.ToString(); TextBox1.Text = aDALPacote.Select(i).ElementAt(0).Descricao; TextBox1.Enabled = false; } ImagePacote.ImageUrl = aDALPacote.Select(i).ElementAt(0).Url_Imagem; if (aDALTPacote.VerificarT(pacote, id)) { if (aDALAvaliacao.SelectNota(pacote, id) == 0) { if (!IsPostBack) { Rating1.ReadOnly = false; Rating1.CurrentRating = 3; Button2.CssClass = "login15-form-btn-c"; } } else { Rating1.ReadOnly = true; Rating1.CurrentRating = aDALAvaliacao.SelectNota(pacote, id); Button2.CssClass = "display"; } divComprar.Attributes["class"] = "display"; divCancel.Attributes["class"] = ""; Label8.Text = "Você tem certeza em cancelar esse pacote?"; } if (countall > 0) { for (int b = 0; b <= countall - 1; b++) { if (aDALPacote_Refeicao.CountPC(pacote, aDALRefeicao.SelectAll().ElementAt(b).id)) { ListItem List = new ListItem(); List.Text = aDALRefeicao.SelectAll().ElementAt(b).Nome; List.Value = aDALRefeicao.SelectAll().ElementAt(b).id.ToString(); DropDownList1.Items.Add(List); } } } else { section.Attributes["class"] = "margintop-15 display"; } if (count > 0) { HtmlGenericControl divm; divm = new HtmlGenericControl("div"); for (int a = 0; a <= count - 1; a++) { Image img; Label l1; HtmlGenericControl div; LiteralControl br; int refeicao; refeicao = aDALPacote_Refeicao.Select(pacote).ElementAt(a).id_Refeicao; div = new HtmlGenericControl("div"); div.Attributes["class"] = "ph-refeicao container-receita"; img = new Image(); img.ImageUrl = aDALRefeicao.Select(refeicao).ElementAt(0).Url_Imagem; img.CssClass = "Refeicao-Img pull-left"; div.Controls.Add(img); l1 = new Label(); l1.CssClass = "txt14"; l1.Text = aDALRefeicao.Select(refeicao).ElementAt(0).Nome; div.Controls.Add(l1); l1 = new Label(); l1.CssClass = "txt13"; l1.Text = "Ingredientes: "; br = new LiteralControl("<br/>"); div.Controls.Add(br); div.Controls.Add(l1); l1 = new Label(); l1.CssClass = "txt12"; l1.Text = aDALRefeicao.Select(refeicao).ElementAt(0).Ingredientes; div.Controls.Add(l1); l1 = new Label(); l1.CssClass = "txt13"; l1.Text = "Modo Preparo :"; br = new LiteralControl("<br/>"); div.Controls.Add(br); div.Controls.Add(l1); l1 = new Label(); l1.CssClass = "txt12"; l1.Text = aDALRefeicao.Select(refeicao).ElementAt(0).ModoPreparo; div.Controls.Add(l1); divm.Controls.Add(div); } PlaceHolder1.Controls.Add(divm); } } if (Convert.ToInt32(Request.QueryString["Edit"]) == 1) { ImagePacote.CssClass += " display"; divName.Attributes["class"] = "Name"; divPreco.Attributes["class"] = "Preco"; LabelPreco.CssClass += " display"; ImgInput.Attributes["class"] = "Pacote-Img-div "; LabelNome.CssClass += " display"; CancelEdit.Attributes["class"] = ""; Edit.Attributes["class"] = ""; divExcluir.Attributes["class"] = "display"; Button1.CssClass = " display"; TextBox1.Enabled = true; } }
protected void Button1_Click(object sender, EventArgs e) { string Login, senha; int idlogin = 0, nvl = 0; void Red() { Session["idlogin"] = idlogin; Session["Nivel"] = nvl; if (nvl == 1) { Response.Redirect("~/WebFormPacotesListar.aspx"); } if (nvl == 2) { Response.Redirect("~/WebFormPacotesListar.aspx"); } if (nvl == 3) { Response.Redirect("~/WebFormClientes.aspx"); } } Login = TextBoxLogin.Text; senha = TextBoxSenha.Text; DAL.DALClientes aDALClintes = new DAL.DALClientes(); DAL.DALAdministrador aDALAdm = new DAL.DALAdministrador(); DAL.DALNutricionista aDALNutri = new DAL.DALNutricionista(); Metodos_Gerais AM = new Metodos_Gerais(); string error = " "; if (AM.IsNull(Login)) { if (AM.IsNull(senha)) { try { idlogin = aDALClintes.LogarLogin(Login, senha); nvl = 1; Red(); } catch { try { idlogin = aDALClintes.LogarEmail(Login, senha); nvl = 1; Red(); } catch { try { idlogin = aDALNutri.LogarLogin(Login, senha); nvl = 2; Red(); } catch { try { idlogin = aDALNutri.LogarEmail(Login, senha); nvl = 2; Red(); } catch { try { idlogin = aDALAdm.LogarLogin(Login, senha); nvl = 3; Red(); } catch { try { idlogin = aDALAdm.LogarEmail(Login, senha); nvl = 3; Red(); } catch { divalert.Attributes["class"] = "alert alert-danger"; Label1.Text = "O Login/Senha não estão cadastrados"; } } } } } } } else { error = "Senha"; Error(error); } } else { error = "Login"; Error(error); } }
protected void EditarE(object sender, EventArgs e) { Button button = sender as Button; string error = " "; if (button.ID == "Button5") { int id = Convert.ToInt32(Session["idlogin"]); Metodos_Gerais MG = new Metodos_Gerais(); DAL.DALEndereco aDALEndereco = new DAL.DALEndereco(); Modelo.Endereco aE = new Modelo.Endereco(Convert.ToInt32(Session["EditE"]), rua.Text, numero.Text, cep.Text, bairro.Text, cidade.Text, uf.Text, id); if (MG.IsNull(rua.Text)) { if (MG.IsNull(numero.Text)) { if (MG.IsNull(cep.Text)) { if (MG.IsNull(bairro.Text)) { if (MG.IsNull(cidade.Text)) { aDALEndereco.Update(aE); Response.Redirect(Request.Url.ToString()); } else { error = "Cidade"; Error(error); } } else { error = "Bairro"; Error(error); } } else { error = "CEP"; Error(error); } } else { error = "Numero"; Error(error); } } else { error = "Rua"; Error(error); } } else { if (button.ID == "Button6") { Response.Redirect(Request.Url.ToString()); } else { DAL.DALEndereco aDALEndereco = new DAL.DALEndereco(); int id = Convert.ToInt32(button.ID); Session["EditE"] = id; rua.Text = aDALEndereco.SelectE(id).ElementAt(0).Rua; numero.Text = aDALEndereco.SelectE(id).ElementAt(0).Numero; cep.Text = aDALEndereco.SelectE(id).ElementAt(0).CEP; bairro.Text = aDALEndereco.SelectE(id).ElementAt(0).Bairro; cidade.Text = aDALEndereco.SelectE(id).ElementAt(0).Cidade; uf.Text = aDALEndereco.SelectE(id).ElementAt(0).UF; Button4.CssClass = "login25-form-btn display"; Button5.CssClass = "login25-form-btn"; Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "myFunction()", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToInt32(Session["Nivel"]) == 1) { int id = Convert.ToInt32(Session["idlogin"]); if (!IsPostBack) { DAL.DALClientes aDALClientes = new DAL.DALClientes(); Image1.ImageUrl = aDALClientes.Select1(id).ElementAt(0).Url_Imagem; LabelNome.Text = aDALClientes.Select1(id).ElementAt(0).Nome; TextBoxNome.Text = aDALClientes.Select1(id).ElementAt(0).Nome; LabelCPF.Text = aDALClientes.Select1(id).ElementAt(0).CPF; TextBoxCPF.Text = aDALClientes.Select1(id).ElementAt(0).CPF; LabelTelefone.Text = aDALClientes.Select1(id).ElementAt(0).Telefone; TextBoxTelefone.Text = aDALClientes.Select1(id).ElementAt(0).Telefone; LabelEmail.Text = aDALClientes.Select1(id).ElementAt(0).Email; TextBoxEmail.Text = aDALClientes.Select1(id).ElementAt(0).Email; rua.Text = ""; numero.Text = ""; cep.Text = ""; bairro.Text = ""; cidade.Text = ""; uf.Text = "AC"; } if (Convert.ToInt32(Session["Edit"]) == 1) { CPF.Attributes["class"] = "display"; CPFEdit.Attributes["class"] = ""; Tel.Attributes["class"] = "display"; TelEdit.Attributes["class"] = ""; Email.Attributes["class"] = "display"; EmailEdit.Attributes["class"] = ""; Nome.Attributes["class"] = "display"; NomeEdit.Attributes["class"] = ""; btn2.Attributes["class"] = ""; btn1.Attributes["class"] = "display"; EmailL.Attributes["class"] = ""; } DAL.DALHistorico aDALHistorico = new DAL.DALHistorico(); DAL.DALPacote aDALPacote = new DAL.DALPacote(); DAL.DALEndereco aDALEndereco = new DAL.DALEndereco(); Metodos_Gerais Metodos = new Metodos_Gerais(); int count = aDALHistorico.Count(id); int countE = aDALEndereco.Count(id); if (countE > 0) { Table t1; TableRow tr1; TableCell tc1; Button b1, b2; t1 = new Table(); tr1 = new TableRow(); tc1 = new TableCell(); countE = countE - 1; tc1.Text = "Logradouro"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Numero"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "CEP"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Bairro"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Cidade"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Unidade da Federação"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Editar"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = "Excluir"; tc1.CssClass = "txt16"; tr1.Controls.Add(tc1); t1.Controls.Add(tr1); for (int i = countE; i >= 0; i--) { tr1 = new TableRow(); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).Rua; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).Numero; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).CEP; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).Bairro; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).Cidade; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Text = aDALEndereco.Select(id).ElementAt(i).UF; tc1.CssClass = "txt17"; tr1.Controls.Add(tc1); t1.Controls.Add(tr1); b1 = new Button(); b2 = new Button(); tc1 = new TableCell(); b1.Text = "Editar"; b2.Text = "Excluir"; b1.ID = aDALEndereco.Select(id).ElementAt(i).id.ToString(); b2.ID = " " + aDALEndereco.Select(id).ElementAt(i).id.ToString(); b1.Click += new EventHandler(EditarE); b2.Click += new EventHandler(ExcluirE); b1.CssClass = "login20-form-btn"; b2.CssClass = "login20-form-btn"; tc1.Controls.Add(b1); tr1.Controls.Add(tc1); tc1 = new TableCell(); tc1.Controls.Add(b2); tr1.Controls.Add(tc1); } t1.CssClass = "tablel table table-striped"; PlaceHolder2.Controls.Add(t1); } if (count > 0) { Table t; TableRow tr; TableCell tc; t = new Table(); tr = new TableRow(); tc = new TableCell(); count = count - 1; tc.Text = "Data da Compra"; tc.CssClass = "txt16"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = "Nome do Pacote"; tc.CssClass = "txt16"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = "Saldo pós-compra"; tc.CssClass = "txt16"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = "Preço"; tc.CssClass = "txt16"; tr.Controls.Add(tc); t.Controls.Add(tr); for (int i = count; i >= 0; i--) { tr = new TableRow(); tc = new TableCell(); int pacote = aDALHistorico.Select(id).ElementAt(i).id_Pacote; tc.Text = aDALHistorico.Select(id).ElementAt(i).Data_Compra.ToString(); tc.CssClass = "txt17"; tr.Controls.Add(tc); tc = new TableCell(); try { tc.Text = aDALPacote.Select(pacote).ElementAt(0).Nome; tc.CssClass = "txt17"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = Metodos.VerificarDouble(aDALHistorico.Select(id).ElementAt(i).Saldo); tc.CssClass = "txt17"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = "- " + Metodos.VerificarDouble(aDALHistorico.Select(id).ElementAt(i).Preco); tc.CssClass = "txt19"; tr.Controls.Add(tc); } catch { tc.Text = " - "; tc.CssClass = "txt17"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = Metodos.VerificarDouble(aDALHistorico.Select(id).ElementAt(i).Saldo); tc.CssClass = "txt17"; tr.Controls.Add(tc); tc = new TableCell(); tc.Text = "+ " + Metodos.VerificarDouble(aDALHistorico.Select(id).ElementAt(i).Preco); tc.CssClass = "txt18"; tr.Controls.Add(tc); } t.Controls.Add(tr); } t.CssClass = "tablel table table-striped"; PlaceHolder1.Controls.Add(t); } } if (Convert.ToInt32(Session["Nivel"]) == 2) { int id = Convert.ToInt32(Session["idlogin"]); DAL.DALNutricionista aDALNutricionista = new DAL.DALNutricionista(); LabelNome.Text = aDALNutricionista.Select(id).ElementAt(0).Nome; /*Table tb; * TableRow tr; * TableCell tc1, tc2; * Image img; * Label Nome, RG, Telefone, Email, a; * HtmlGenericControl h1, h3, h4; * * img = new Image(); * img.ImageUrl = "~/Imagens/user.jpg"; * img.CssClass = "img-responsive img-circle"; * * Nome = new Label(); * Nome.Text = aDALNutricionista.Select(id).ElementAt(0).Nome; * * //RG = new Label(); * //RG.Text = aDALNutricionista.Select(id).ElementAt(0).RG; * * Telefone = new Label(); * Telefone.Text = aDALNutricionista.Select(id).ElementAt(0).Telefone; * * Email = new Label(); * Email.Text = aDALNutricionista.Select(id).ElementAt(0).Email; * * h1 = new HtmlGenericControl("h1"); * * tb = new Table(); * * tr = new TableRow(); * * tc1 = new TableCell(); * * a = new Label(); * a.Text = "Nome :"; * a.ForeColor = System.Drawing.Color.FromArgb(34, 139, 34); * * tc2 = new TableCell(); * tc2.RowSpan = 7; * * tc2.Controls.Add(img); * h1.Controls.Add(Nome); * tc1.Controls.Add(h1); * tr.Controls.Add(tc2); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * tr = new TableRow(); * * tc1 = new TableCell(); * * h3 = new HtmlGenericControl("h3"); * * a = new Label(); * a.Text = "RG :"; * a.ForeColor = System.Drawing.Color.FromArgb(34, 139, 34); * * h3.Controls.Add(a); * tc1.Controls.Add(h3); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * //tr = new TableRow(); * * //tc1 = new TableCell(); * * //h4 = new HtmlGenericControl("h4"); * * //h4.Controls.Add(RG); * //tc1.Controls.Add(h4); * //tr.Controls.Add(tc1); * //tb.Controls.Add(tr); * * tr = new TableRow(); * * tc1 = new TableCell(); * * h3 = new HtmlGenericControl("h3"); * * a = new Label(); * a.Text = "Telefone :"; * a.ForeColor = System.Drawing.Color.FromArgb(34, 139, 34); * * h3.Controls.Add(a); * tc1.Controls.Add(h3); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * tr = new TableRow(); * * tc1 = new TableCell(); * * h4 = new HtmlGenericControl("h4"); * * * h4.Controls.Add(Telefone); * tc1.Controls.Add(h4); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * tr = new TableRow(); * * tc1 = new TableCell(); * * h3 = new HtmlGenericControl("h3"); * * a = new Label(); * a.Text = "Email :"; * a.ForeColor = System.Drawing.Color.FromArgb(34, 139, 34); * * h3.Controls.Add(a); * tc1.Controls.Add(h3); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * tr = new TableRow(); * * tc1 = new TableCell(); * * h4 = new HtmlGenericControl("h4"); * * h4.Controls.Add(Email); * tc1.Controls.Add(h4); * tr.Controls.Add(tc1); * tb.Controls.Add(tr); * * PlaceHolder1.Controls.Add(tb);*/ } }
protected void Page_Load(object sender, EventArgs e) { Metodos_Gerais aMetodos = new Metodos_Gerais(); aMetodos.VerificarUL(Convert.ToInt32(Session["idlogin"])); }