document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using MySql.Data.MySqlClient;
  8.  
  9.  
  10. public partial class alteraCliente : System.Web.UI.Page
  11. {
  12.     protected void Page_Load(object sender, EventArgs e)
  13.     {
  14.         string id = Request.QueryString["id"];
  15.         string conexao = "Server=localhost;Database=Stonehenge;Uid=root;Pwd=\'\';Connect Timeout=30;";
  16.         MySqlConnection conn= new MySqlConnection(conexao);
  17.  
  18.         string comando = "select * from cliente where id=" + id;
  19.         MySqlCommand cmd = new MySqlCommand(comando);
  20.         cmd.Connection = conn;
  21.         conn.Open();
  22.         MySqlDataReader myLeitura = cmd.ExecuteReader();
  23.         myLeitura.Read();
  24.         Label1.Text = myLeitura["id"].ToString();
  25.         nome.Text = myLeitura["nome"].ToString();
  26.         endereco.Text = myLeitura["endereco"].ToString();
  27.         Telefone.Text = myLeitura["telefone"].ToString();
  28.         bairro.Text = myLeitura["bairro"].ToString();
  29.         Cidade.Text = myLeitura["cidade"].ToString();
  30.         estado.SelectedValue = myLeitura["estado"].ToString();
  31.         cpf.Text = myLeitura["cpf"].ToString();
  32.         myLeitura.Close();
  33.         comando = "select * from assuntos where cpf=\\"" + cpf.Text+"\\"";
  34.         cmd.CommandText = comando;
  35.         MySqlDataReader ass = cmd.ExecuteReader();
  36.         for (int i = 0; i <assuntos.Items.Count; i++) {
  37.             ass.Read();
  38.             if (assuntos.Items[i].Text == ass["assunto"].ToString()) {
  39.                 assuntos.Items.RemoveAt(i);
  40.                 prediletos.Items.Add(ass["assunto"].ToString());
  41.             }
  42.         }
  43.                    
  44.     }
  45.     protected void LtoR_click(object sender, EventArgs e)
  46.     {
  47.         for (int i = 0; i < assuntos.Items.Count; i++)
  48.         {
  49.             if (assuntos.Items[i].Selected)
  50.             {
  51.                 prediletos.Items.Add(assuntos.SelectedItem);
  52.                 assuntos.Items.RemoveAt(assuntos.SelectedIndex);
  53.             }
  54.         }
  55.     }
  56.     protected void RtoL_Click(Object sender, EventArgs e)
  57.     {
  58.         for (int i = 0; i < prediletos.Items.Count; i++)
  59.         {
  60.             if (prediletos.Items[i].Selected)
  61.             {
  62.                 assuntos.Items.Add(prediletos.SelectedItem);
  63.                 prediletos.Items.RemoveAt(prediletos.SelectedIndex);
  64.             }
  65.         }
  66.  
  67.     }
  68.  
  69.     protected void tudoL_Click(object sender, EventArgs e)
  70.     {
  71.         for (int i = 0; i < prediletos.Items.Count; i++)
  72.         {
  73.             assuntos.Items.Add(prediletos.Items[i].Text);
  74.         }
  75.         prediletos.Items.Clear();
  76.     }
  77.  
  78.     protected void tudoR_Click(object sender, EventArgs e)
  79.     {
  80.         for (int i = 0; i < assuntos.Items.Count; i++)
  81.         {
  82.             prediletos.Items.Add(assuntos.Items[i].Text);
  83.         }
  84.         assuntos.Items.Clear();
  85.     }
  86. }
');