public void CargarCombo(ComboBox combo, string InsertaFila)
 {
     IList ListarEstadoSocios = GetBySeleccionable();
     cod_estados_socios oEstadoSocio = new cod_estados_socios();
     oEstadoSocio.id_estado_socio = 0;
     oEstadoSocio.facturar = false;
     oEstadoSocio.requiere_fin = false;
     oEstadoSocio.duracion_meses = 0;
     oEstadoSocio.seleccionable = false;
     oEstadoSocio.estado_socio = InsertaFila;
     ListarEstadoSocios.Insert(0, oEstadoSocio);
     combo.DisplayMember = "estado_socio";
     combo.ValueMember = "id_estado_socio";
     combo.DataSource = ListarEstadoSocios;
 }
 private void CargarSeleccion()
 {
     cod_estados_socios oEstadoSocio = new cod_estados_socios();
     EstadoSocioImplement oEstadoSocioImplement = new EstadoSocioImplement();
     DataGridViewRow row = this.dgvEstadoSocio.CurrentRow;
     int id = Convert.ToInt32(row.Cells[0].Value);
     oEstadoSocio = oEstadoSocioImplement.Get(id);
     this.lblCodigo.Text = oEstadoSocio.id_estado_socio.ToString();
     this.txtNombre.Text = oEstadoSocio.estado_socio;
     this.cmbFacturar.SelectedValue = oEstadoSocio.facturar.Value? "1":"0";
     this.chkSeleccionable.Checked = oEstadoSocio.seleccionable.Value;
     this.chkFechaFin.Checked = oEstadoSocio.requiere_fin.Value;
     this.txtMeses.Text = oEstadoSocio.duracion_meses.ToString();
     this.gbEstadoConexion.Enabled = false;
     Deshabilitar();
 }
 public cod_estados_socios Get(int id)
 {
     cod_estados_socios oEstadoSocio = new cod_estados_socios();
     using (cooperativaEntities bd = new cooperativaEntities())
     {
         var regis = (from p in bd.cod_estados_socios
                      where p.id_estado_socio == id
                      select p).Single();
         oEstadoSocio.id_estado_socio = regis.id_estado_socio;
         oEstadoSocio.estado_socio = regis.estado_socio;
         oEstadoSocio.facturar = regis.facturar;
         oEstadoSocio.requiere_fin = regis.requiere_fin;
         oEstadoSocio.seleccionable = regis.seleccionable;
         oEstadoSocio.duracion_meses = regis.duracion_meses;
         return oEstadoSocio;
     }
 }
        public void Update(cod_estados_socios oEstadoSocio)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var editar = (from p in bd.cod_estados_socios
                              where p.id_estado_socio == oEstadoSocio.id_estado_socio
                              select p).Single();

                editar.estado_socio = oEstadoSocio.estado_socio;
                editar.facturar = oEstadoSocio.facturar;
                editar.requiere_fin = oEstadoSocio.requiere_fin;
                editar.seleccionable = oEstadoSocio.seleccionable;
                editar.duracion_meses = oEstadoSocio.duracion_meses;
                bd.SaveChanges();
            }
        }
 public void Save(cod_estados_socios oEstadoSocio)
 {
     cooperativaEntities bd = new cooperativaEntities();
     bd.cod_estados_socios.AddObject(oEstadoSocio);
     bd.SaveChanges();
 }
        private void Guardar()
        {
            cod_estados_socios oEstadoSocio = new cod_estados_socios();
            EstadoSocioImplement oEstadoSocioImplement = new EstadoSocioImplement();

            if (this.lblCodigo.Text == "")
            {
                oEstadoSocio.estado_socio = this.txtNombre.Text;
                oEstadoSocio.facturar = this.cmbFacturar.SelectedValue.ToString() == "0" ? false : true;
                oEstadoSocio.seleccionable = this.chkSeleccionable.Checked;
                oEstadoSocio.requiere_fin = this.chkFechaFin.Checked;
                oEstadoSocio.duracion_meses = this.txtMeses.Text==""?0:int.Parse(this.txtMeses.Text);
                oEstadoSocioImplement.Save(oEstadoSocio);
            }
            else
            {

                DataGridViewRow row = this.dgvEstadoSocio.CurrentRow;
                int id = Convert.ToInt32(row.Cells[0].Value);
                oEstadoSocio = oEstadoSocioImplement.Get(id);
                oEstadoSocio.estado_socio = this.txtNombre.Text;
                oEstadoSocio.facturar = this.cmbFacturar.SelectedValue == "0" ? false : true;
                oEstadoSocio.seleccionable = this.chkSeleccionable.Checked;
                oEstadoSocio.requiere_fin = this.chkFechaFin.Checked;
                oEstadoSocio.duracion_meses = this.txtMeses.Text == "" ? 0 : int.Parse(this.txtMeses.Text);
                oEstadoSocioImplement.Update(oEstadoSocio);
            }
            Deshabilitar();
            Limpiar();
            CargarGrid();
        }
 private void ModificarEstadoSocio()
 {
     HabilitarBotones();
     this.gbEstadoConexion.Enabled = true;
     cod_estados_socios oEstadoSocio = new cod_estados_socios();
     EstadoSocioImplement oEstadoSocioImplement = new EstadoSocioImplement();
     DataGridViewRow row = this.dgvEstadoSocio.CurrentRow;
     int id = Convert.ToInt32(row.Cells[0].Value);
     oEstadoSocio = oEstadoSocioImplement.Get(id);
     this.lblCodigo.Text = oEstadoSocio.id_estado_socio.ToString();
     this.txtNombre.Text = oEstadoSocio.estado_socio;
     this.cmbFacturar.SelectedValue = oEstadoSocio.facturar;
     this.chkSeleccionable.Checked = oEstadoSocio.seleccionable.Value;
     this.dgvEstadoSocio.Enabled = false;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the cod_estados_socios EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTocod_estados_socios(cod_estados_socios cod_estados_socios)
 {
     base.AddObject("cod_estados_socios", cod_estados_socios);
 }
 /// <summary>
 /// Create a new cod_estados_socios object.
 /// </summary>
 /// <param name="id_estado_socio">Initial value of the id_estado_socio property.</param>
 public static cod_estados_socios Createcod_estados_socios(global::System.Int32 id_estado_socio)
 {
     cod_estados_socios cod_estados_socios = new cod_estados_socios();
     cod_estados_socios.id_estado_socio = id_estado_socio;
     return cod_estados_socios;
 }