protected void FillDicoseList() { IRepoEstablecimiento repoEst = new RepoEstablecimiento(); List <Int64> activos = repoEst.All(); // Create a table to store data for the DropDownList control. DataTable dt = new DataTable(); // Define the columns of the table. dt.Columns.Add(new DataColumn("TextField", typeof(String))); dt.Columns.Add(new DataColumn("ValueField", typeof(String))); foreach (Int64 dicose in activos) { // Populate the table with sample values. dt.Rows.Add(CreateRow(Convert.ToString(dicose), Convert.ToString(dicose), dt)); } // Create a DataView from the DataTable to act as the data source // for the DropDownList control. listEstablecimientos.DataSource = new DataView(dt); listEstablecimientos.DataTextField = "TextField"; listEstablecimientos.DataValueField = "ValueField"; // Bind the data to the control. listEstablecimientos.DataBind(); // Set the default selected item, if desired. listEstablecimientos.SelectedIndex = 0; }
protected void removeDicoseDestino() { IRepoEstablecimiento repoEst = new RepoEstablecimiento(); List <Int64> activos = repoEst.All(); // Create a table to store data for the DropDownList control. DataTable dt = new DataTable(); // Define the columns of the table. dt.Columns.Add(new DataColumn("TextField", typeof(String))); dt.Columns.Add(new DataColumn("ValueField", typeof(String))); Int64 dicoseVendedor = Convert.ToInt64(listEstablecimientos.SelectedItem.Value); foreach (Int64 dicose in activos) { // Populate the table with sample values. if (dicoseVendedor != dicose) { dt.Rows.Add(CreateRow(Convert.ToString(dicose), Convert.ToString(dicose), dt)); } } listEstablecimientosDestino.DataSource = new DataView(dt); listEstablecimientosDestino.DataTextField = "TextField"; listEstablecimientosDestino.DataValueField = "ValueField"; // Bind the data to the control. listEstablecimientosDestino.DataBind(); // Set the default selected item, if desired. listEstablecimientosDestino.SelectedIndex = 0; }
protected void btnDocumento_Click(object sender, EventArgs e) { IRepoEstablecimiento repo = new RepoEstablecimiento(); Establecimiento est = new Establecimiento(); est.DICOSE = Convert.ToInt64(Session["dicose"].ToString()); est.Responsable = Convert.ToInt32(txtDocumento.Text); repo.Res(est); Response.Redirect("home.aspx"); }
protected void Page_Load(object sender, EventArgs e) { IRepoEstablecimiento repo = new RepoEstablecimiento(); if (!IsPostBack) { lstPendientes.DataSource = repo.Sby(); lstPendientes.DataBind(); lstActivos.DataSource = repo.All(); lstActivos.DataBind(); } }
protected void btnDesactivar_Click(object sender, EventArgs e) { IRepoEstablecimiento repo = new RepoEstablecimiento(); Establecimiento est; try { //CREO EL ESTABLECIMIENTO est = new Establecimiento( Convert.ToInt64(lstActivos.SelectedItem.Text) ); //ACTUALIZO EL ESTABLECIMIENTO, SETEANDO SU ESTADO COMO INACTIVO repo.Rem(est); lblError.Visible = false; Response.Redirect("home.aspx"); } catch { lblError.Visible = true; } }
protected void AddEstablecimiento(object sender, EventArgs e) { IRepoEstablecimiento repo = new RepoEstablecimiento(); SACG_BLL.Establecimiento est; SACG_BLL.Persona per; try { //CREO EL ESTABLECIMIENTO est = new Establecimiento( Convert.ToInt64(txtDicose.Text), Convert.ToInt64(txtRut.Text), Convert.ToInt64(txtBps.Text), txtRazonSocial.Text, Convert.ToInt64(txtDocumento.Text), txtDepartamento.Text, Convert.ToInt32(txtSPolicial.Text), txtParaje.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text, Convert.ToInt32(txtSuperficie.Text)); //CREO EL RESPONSABLE per = new Persona( Convert.ToInt64(txtDocumento.Text), txtNombre.Text, txtApellido.Text, txtTelefono.Text ); //AGREGO EL ESTABLECIMIENTO Y SU RESPONSABLE repo.Add(est, per); } catch { throw; } }