public int Save(intimacion oIntimacion) { int i; cooperativaEntities bd = new cooperativaEntities(); bd.intimacion.AddObject(oIntimacion); i = bd.SaveChanges(); return(i); }
public void Update(intimacion oIntimacion) { using (cooperativaEntities bd = new cooperativaEntities()) { var editar = (from p in bd.intimacion where p.id_intimacion == oIntimacion.id_intimacion select p).Single(); editar.fecha = oIntimacion.fecha; editar.id_intimacion = oIntimacion.id_intimacion; editar.id_socio = oIntimacion.id_socio; editar.tipo = oIntimacion.tipo; bd.SaveChanges(); } }
public intimacion Get(int id) { intimacion oIntimacion = new intimacion(); using (cooperativaEntities bd = new cooperativaEntities()) { var regis = (from p in bd.intimacion where p.id_intimacion == id select p).Single(); oIntimacion.fecha = regis.fecha; oIntimacion.id_intimacion = regis.id_intimacion; oIntimacion.id_socio = regis.id_socio; oIntimacion.tipo = regis.tipo; return(oIntimacion); } }
private void Guardar() { intimacion oIntimacion = new intimacion(); IntimacionImplement oIntimacionImplement = new IntimacionImplement(); string Mensaje; Mensaje = ""; if (this.txtFecha.Text.Length == 0) { Mensaje += "Falta ingresar fecha." + Environment.NewLine; } ; if (int.Parse(cmbTipoIntimacion.SelectedValue.ToString()) == 0) { Mensaje += "Falta tipo de intimacion." + Environment.NewLine; } ; if (Mensaje.Length > 0) { frmVentanaInformativa ofrmVentanaInformativa = new frmVentanaInformativa(Mensaje); ofrmVentanaInformativa.ShowDialog(); } else { oIntimacion.fecha = DateTime.Parse(this.txtFecha.Text); oIntimacion.id_socio = _idSocio; oIntimacion.tipo = int.Parse(this.cmbTipoIntimacion.SelectedValue.ToString()); oIntimacionImplement.Save(oIntimacion); CargarGrilla(_idSocio); this.panelAdd.Visible = false; //Asigno Marca para el Socio socios_varios oSocioVarios = new socios_varios(); SocioVariosImplement oSocioVarioImplement = new SocioVariosImplement(); oSocioVarios = oSocioVarioImplement.Get(_idSocio); oSocioVarios.intimado = true; oSocioVarioImplement.Update(oSocioVarios); this.panelAdd.Visible = false; } }