private tbInfoGenero MapearAplicacion(InfoGenero infog)
 {
     return(new tbInfoGenero()
     {
         idGenero = infog.idGenero,
         genero = infog.genero,
     });
 }
 public void Insertar(InfoGenero persona)
 {
     try
     {
         BD_SIRESEPEntities entities = new BD_SIRESEPEntities();
         entities.InfoGenero.Add(persona);
         entities.SaveChanges();
     }
     catch (Exception ee)
     {
         throw;
     }
 }
 public void Eliminar(InfoGenero persona)
 {
     try
     {
         BD_SIRESEPEntities entities = new BD_SIRESEPEntities();
         var result = entities.InfoGenero.Find(persona.idGenero);
         entities.InfoGenero.Remove(result);
         entities.SaveChanges();
     }
     catch (Exception ee)
     {
         throw;
     }
 }
 public void Actualizar(InfoGenero persona)
 {
     try
     {
         using (BD_SIRESEPEntities entities = new BD_SIRESEPEntities())
         {
             entities.Entry(persona).State = System.Data.Entity.EntityState.Modified;
             entities.SaveChanges();
         }
     }
     catch (Exception ee)
     {
         throw;
     }
 }
Exemple #5
0
 public void Insertar(InfoGenero persona)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope())
         {
             SIRESEP.DAL.Clases.ManInfoGenero._Instancia.Insertar(persona);
             scope.Complete();
         }
     }
     catch (Exception ee)
     {
         throw;
     }
 }
        protected void agregarGenero_Click(object sender, EventArgs e)
        {
            string pa = (Session["pagina"].ToString());

            infogenero        = new InfoGenero();
            infogenero.genero = newGenero.Value;

            var r = new List <InfoGenero>();

            r = SIRESEP.BS.Clases.ManInfoGenero._Instancia.Mostrar();

            bool ok    = true;
            int  largo = Convert.ToInt32(r.Count.ToString());

            for (int i = 0; i < largo; i++)
            {
                String user = r[i].genero.ToString();

                String exPass = newGenero.Value;


                if (exPass.Equals(user))
                {
                    label1.Visible = true;
                    ok             = false;
                }
            }
            if (ok == true)
            {
                if (pa.Equals("agregar"))
                {
                    SIRESEP.BS.Clases.ManInfoGenero._Instancia.Insertar(infogenero);
                    Response.Redirect("FrAgregarPerfil.aspx");
                }
                else if (pa.Equals("Editar"))
                {
                    SIRESEP.BS.Clases.ManInfoGenero._Instancia.Insertar(infogenero);
                    Response.Redirect("FrEditarMiPerfil.aspx");
                }
            }
        }