public void CargarCombo(ComboBox combo, string InsertaFila) { IList ListarZonas = GetAll(); cod_zonas oZona = new cod_zonas(); oZona.id_zona = 0; oZona.zona = InsertaFila; ListarZonas.Insert(0, oZona); combo.DisplayMember = "zona"; combo.ValueMember = "id_zona"; combo.DataSource = ListarZonas; }
public void Update(cod_zonas oZona) { using (cooperativaEntities bd = new cooperativaEntities()) { var editar = (from p in bd.cod_zonas where p.id_zona == oZona.id_zona select p).Single(); editar.zona = oZona.zona; editar.imprimir = oZona.imprimir; bd.SaveChanges(); } }
private void CargarSeleccion() { cod_zonas oZona = new cod_zonas(); ZonaImplement oZonaImplement = new ZonaImplement(); DataGridViewRow row = this.dgvZona.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oZona = oZonaImplement.Get(id); this.lblCodigo.Text = oZona.id_zona.ToString(); this.txtNombre.Text = oZona.zona; this.chkImprimir.Checked = oZona.imprimir.Value; this.txtNombre.Enabled = false; Deshabilitar(); }
public cod_zonas Get(int id) { cod_zonas oZona = new cod_zonas(); using (cooperativaEntities bd = new cooperativaEntities()) { var regis = (from p in bd.cod_zonas where p.id_zona == id select p).Single(); oZona.id_zona = regis.id_zona; oZona.zona = regis.zona; oZona.imprimir = regis.imprimir; return oZona; } }
public void Save(cod_zonas oZona) { cooperativaEntities bd = new cooperativaEntities(); bd.cod_zonas.AddObject(oZona); bd.SaveChanges(); }
private void Guardar() { ZonaImplement oZonaImplement = new ZonaImplement(); cod_zonas oZona = new cod_zonas(); if (this.lblCodigo.Text == "") { oZona.zona = this.txtNombre.Text; oZona.imprimir=this.chkImprimir.Checked; oZonaImplement.Save(oZona); } else { DataGridViewRow row = this.dgvZona.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oZona = oZonaImplement.Get(id); oZona.zona = this.txtNombre.Text; oZona.imprimir = this.chkImprimir.Checked; oZonaImplement.Update(oZona); } Deshabilitar(); this.txtNombre.Text = ""; CargarGrid(); }
private void ModificarZona() { HabilitarBotones(); this.txtNombre.Enabled = true; this.chkImprimir.Enabled=true; cod_zonas oZona = new cod_zonas(); ZonaImplement oZonaImplement=new ZonaImplement(); DataGridViewRow row = this.dgvZona.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oZona = oZonaImplement.Get(id); this.lblCodigo.Text = oZona.id_zona.ToString(); this.txtNombre.Text = oZona.zona; this.chkImprimir.Checked = oZona.imprimir.Value; this.dgvZona.Enabled = false; }
/// <summary> /// Create a new cod_zonas object. /// </summary> /// <param name="id_zona">Initial value of the id_zona property.</param> public static cod_zonas Createcod_zonas(global::System.Int32 id_zona) { cod_zonas cod_zonas = new cod_zonas(); cod_zonas.id_zona = id_zona; return cod_zonas; }
/// <summary> /// Deprecated Method for adding a new object to the cod_zonas EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocod_zonas(cod_zonas cod_zonas) { base.AddObject("cod_zonas", cod_zonas); }