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;
     }
 }
 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();
            }
        }
Example #4
0
        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;
            }
        }
 /// <summary>
 /// Create a new intimacion object.
 /// </summary>
 /// <param name="id_intimacion">Initial value of the id_intimacion property.</param>
 public static intimacion Createintimacion(global::System.Int32 id_intimacion)
 {
     intimacion intimacion = new intimacion();
     intimacion.id_intimacion = id_intimacion;
     return intimacion;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the intimacion EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTointimacion(intimacion intimacion)
 {
     base.AddObject("intimacion", intimacion);
 }