public void Update(codene oCodene) { using (cooperativaEntities bd = new cooperativaEntities()) { var editar = (from p in bd.codene where p.id_codene == oCodene.id_codene select p).Single(); editar.fechaAlta = oCodene.fechaAlta; editar.FechaBaja = oCodene.FechaBaja; editar.id_socio = oCodene.id_socio; editar.id_codene = oCodene.id_codene; bd.SaveChanges(); } }
public codene Get(int id) { codene oCodene = new codene(); using (cooperativaEntities bd = new cooperativaEntities()) { var regis = (from p in bd.codene where p.id_codene == id select p).Single(); oCodene.id_codene = regis.id_codene; oCodene.id_socio = regis.id_socio; oCodene.fechaAlta = regis.fechaAlta; oCodene.FechaBaja = regis.FechaBaja; return oCodene; } }
public void Save(codene oCodene) { cooperativaEntities bd = new cooperativaEntities(); bd.codene.AddObject(oCodene); bd.SaveChanges(); }
private void ModificarCodene() { HabilitarBotonesCO(); this.gbCodene.Enabled = true; codene oCodene = new codene(); CodeneImplement oCodeneImplement = new CodeneImplement(); DataGridViewRow row = this.dgvCOCodene.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oCodene = oCodeneImplement.Get(id); this.lblCOCodigo.Text = oCodene.id_codene.ToString(); this.dtpCoFechaAlta.Value = oCodene.fechaAlta.Value; this.dtpCOFechaResolucion.Value = oCodene.FechaBaja.Value; this.dgvCOCodene.Enabled = false; }
private void GuardarCodene() { codene oCodene = new codene(); CodeneImplement oCodeneImplement = new CodeneImplement(); if (this.lblCOCodigo.Text == "") { oCodene.fechaAlta = dtpCoFechaAlta.Value; oCodene.FechaBaja = dtpCOFechaResolucion.Value; oCodene.id_socio = _idSocio; oCodeneImplement.Save(oCodene); } else { DataGridViewRow row = this.dgvCOCodene.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oCodene = oCodeneImplement.Get(id); oCodene.id_socio = _idSocio; oCodene.fechaAlta = dtpCoFechaAlta.Value; oCodene.FechaBaja = dtpCOFechaResolucion.Value; oCodeneImplement.Update(oCodene); } DeshabilitarCodene(); LimpiarCodene(); CargarGridCodene(); }
private void CargarSeleccionCodene() { if (!_eliminoC) { codene oCodene = new codene(); CodeneImplement oCodeneImplement = new CodeneImplement(); DataGridViewRow row = this.dgvCOCodene.CurrentRow; int id = Convert.ToInt32(row.Cells[0].Value); oCodene = oCodeneImplement.Get(id); this.lblCOCodigo.Text = oCodene.id_codene.ToString(); this.dtpCoFechaAlta.Text = oCodene.fechaAlta.ToString(); this.dtpCOFechaResolucion.Text = oCodene.FechaBaja.ToString(); this.gbCodene.Enabled = false; DeshabilitarCodene(); } }
/// <summary> /// Create a new codene object. /// </summary> /// <param name="id_codene">Initial value of the id_codene property.</param> public static codene Createcodene(global::System.Int32 id_codene) { codene codene = new codene(); codene.id_codene = id_codene; return codene; }
/// <summary> /// Deprecated Method for adding a new object to the codene EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocodene(codene codene) { base.AddObject("codene", codene); }