protected void Page_Load(object sender, EventArgs e)
 {
     id = int.Parse(Request.QueryString["id"].ToString());
     DAL.DALRota p    = new DAL.DALRota();
     Modelo.Rota rota = p.Select(id);
     if (!IsPostBack)
     {
         TextBox1.Text = rota.nome;
         DAL.DALBairro dal_bairro = new DAL.DALBairro();
         ListItem      li;
         foreach (Modelo.Bairro b in dal_bairro.SelectAll())
         {
             li       = new ListItem();
             li.Text  = b.Nome;
             li.Value = (b.Id).ToString();
             if (p.HasBairro(b.Id, rota.id))
             {
                 li.Selected = true;
             }
             ListBoxBairro.Items.Add(li);
         }
         DAL.DALPonto_referencia dal_referencia = new DAL.DALPonto_referencia();
         foreach (Modelo.Ponto_referencia ponto in dal_referencia.SelectAll())
         {
             li       = new ListItem();
             li.Text  = ponto.Nome;
             li.Value = (ponto.Id).ToString();
             if (p.HasReferencia(ponto.Id, rota.id))
             {
                 li.Selected = true;
             }
             ListBoxReferencia.Items.Add(li);
         }
     }
 }
 protected void Unnamed1_Click(object sender, EventArgs e)
 {
     id = int.Parse(Request.QueryString["id"]);
     DAL.DALRota p     = new DAL.DALRota();
     Modelo.Rota ponto = p.Select(id);
     p.Delete(ponto);
     Response.Redirect("~//CadastroRota.aspx");
 }
Exemple #3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                string option = DDLSearch.Text;
                string value  = valueSearch.Text;

                DAL.DALRota aDALRota = new DAL.DALRota();

                Repeater1.DataSourceID = null;
                Repeater1.DataSource   = aDALRota.SearchSelect(value, option);
                Repeater1.DataBind();
            }
            catch { }
        }