Beispiel #1
0
        public int insertarTema(CatTemas _cattemas)
        {
            int id = 0;

            try
            {
                using (SqlCommand command = new SqlCommand("spd_cat_temas_ins", cn.Connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@descripcion", _cattemas.descripcion);
                    cn.OpenConnection();
                    id = (int)command.ExecuteScalar();
                }
            }
            catch (SqlException ex)
            {
                throw new Exception("No se pudo insertar el registro del tema" + ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo insertar el registro del tema" + ex.Message);
            }
            finally
            {
                cn.CloseConnection();
            }
            return(id);
        }
Beispiel #2
0
 public void eliminarTema(CatTemas _cattemas)
 {
     try
     {
         using (SqlCommand command = new SqlCommand("spd_cat_temas_del", cn.Connection))
         {
             command.CommandType = System.Data.CommandType.StoredProcedure;
             command.Parameters.AddWithValue("@idtema", _cattemas.idtema);
             cn.OpenConnection();
             command.ExecuteNonQuery();
         }
     }
     catch (SqlException ex)
     {
         throw new Exception("No se pudo eliminar el registro del tema" + ex.Message);
     }
     catch (Exception ex)
     {
         throw new Exception("No se pudo eliminar el registro del tema" + ex.Message);
     }
     finally
     {
         cn.CloseConnection();
     }
 }
 protected void Editar_Click(object sender, EventArgs e)
 {
     if (txtDescripcionEditar.Text == String.Empty)
     {
         lblMensajeEditar.Visible = true;
         upModalEditar.Update();
     }
     else
     {
         if (Catalogo.Value == "Departamentos")
         {
             _catdepartamento             = new CatDepartamentos();
             _catdepartamento.iddepto     = Convert.ToInt32(ID.Value.ToString());
             _catdepartamento.descripcion = txtDescripcionEditar.Text;
             _catdepneg.modificarDepartamento(_catdepartamento);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEditar", "$('#ModalEditar').modal('hide');", true);
             upModalEditar.Update();
             GridViewDepartamentos.DataSource = _catdepneg.list();
             GridViewDepartamentos.DataBind();
         }
         if (Catalogo.Value == "Sedes")
         {
             _catsede             = new CatSedes();
             _catsede.idsede      = Convert.ToInt32(ID.Value.ToString());
             _catsede.descripcion = txtDescripcionEditar.Text;
             _catsedneg.modificarSede(_catsede);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEditar", "$('#ModalEditar').modal('hide');", true);
             upModalEditar.Update();
             GridViewSedes.DataSource = _catsedneg.list();
             GridViewSedes.DataBind();
         }
         if (Catalogo.Value == "Puestos")
         {
             _catpuesto             = new CatPuestos();
             _catpuesto.idpuesto    = Convert.ToInt32(ID.Value.ToString());
             _catpuesto.descripcion = txtDescripcionEditar.Text;
             _catpuesneg.modificarPuesto(_catpuesto);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEditar", "$('#ModalEditar').modal('hide');", true);
             upModalEditar.Update();
             GridViewPuestos.DataSource = _catpuesneg.list();
             GridViewPuestos.DataBind();
         }
         if (Catalogo.Value == "Temas")
         {
             _cattema             = new CatTemas();
             _cattema.idtema      = Convert.ToInt32(ID.Value.ToString());
             _cattema.descripcion = txtDescripcionEditar.Text;
             _cattemneg.modificarTema(_cattema);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEditar", "$('#ModalEditar').modal('hide');", true);
             upModalEditar.Update();
             GridViewTemas.DataSource = _cattemneg.list();
             GridViewTemas.DataBind();
         }
     }
 }
Beispiel #4
0
 public void eliminarTema(CatTemas _cattemas)
 {
     try
     {
         CatTemasDAL _cattemasDAL = new CatTemasDAL();
         _cattemasDAL.eliminarTema(_cattemas);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #5
0
 public void modificarTema(CatTemas _cattemas)
 {
     try
     {
         CatTemasDAL _cattemasDAL = new CatTemasDAL();;
         _cattemasDAL.modificarTema(_cattemas);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #6
0
 public int insertarTema(CatTemas _cattemas)
 {
     try
     {
         CatTemasDAL _cattemasDAL = new CatTemasDAL();
         return(_cattemasDAL.insertarTema(_cattemas));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 protected void Nuevo_Click(object sender, EventArgs e)
 {
     if (txtDescripcionNuevo.Text == String.Empty)
     {
         lblMensajeNuevo.Visible = true;
         upModalNuevo.Update();
     }
     else
     {
         if (Catalogo.Value == "Departamentos")
         {
             _catdepartamento             = new CatDepartamentos();
             _catdepartamento.descripcion = txtDescripcionNuevo.Text;
             _catdepneg.insertarDepartamento(_catdepartamento);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalNuevo", "$('#ModalNuevo').modal('hide');", true);
             upModalNuevo.Update();
             GridViewDepartamentos.DataSource = _catdepneg.list();
             GridViewDepartamentos.DataBind();
         }
         if (Catalogo.Value == "Sedes")
         {
             _catsede             = new CatSedes();
             _catsede.descripcion = txtDescripcionNuevo.Text;
             _catsedneg.insertarSede(_catsede);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalNuevo", "$('#ModalNuevo').modal('hide');", true);
             upModalNuevo.Update();
             GridViewSedes.DataSource = _catsedneg.list();
             GridViewSedes.DataBind();
         }
         if (Catalogo.Value == "Puestos")
         {
             _catpuesto             = new CatPuestos();
             _catpuesto.descripcion = txtDescripcionNuevo.Text;
             _catpuesneg.insertarPuesto(_catpuesto);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalNuevo", "$('#ModalNuevo').modal('hide');", true);
             upModalNuevo.Update();
             GridViewPuestos.DataSource = _catpuesneg.list();
             GridViewPuestos.DataBind();
         }
         if (Catalogo.Value == "Temas")
         {
             _cattema             = new CatTemas();
             _cattema.descripcion = txtDescripcionNuevo.Text;
             _cattemneg.insertarTema(_cattema);
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalNuevo", "$('#ModalNuevo').modal('hide');", true);
             upModalNuevo.Update();
             GridViewTemas.DataSource = _cattemneg.list();
             GridViewTemas.DataBind();
         }
     }
 }
 protected void Eliminar_Click(object sender, EventArgs e)
 {
     if (Catalogo.Value == "Departamentos")
     {
         _catdepartamento         = new CatDepartamentos();
         _catdepartamento.iddepto = Convert.ToInt32(ID.Value.ToString());
         _catdepneg.eliminarDepartamento(_catdepartamento);
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEliminar", "$('#ModalEliminar').modal('hide');", true);
         upModalEliminar.Update();
         GridViewDepartamentos.DataSource = _catdepneg.list();
         GridViewDepartamentos.DataBind();
     }
     if (Catalogo.Value == "Sedes")
     {
         _catsede        = new CatSedes();
         _catsede.idsede = Convert.ToInt32(ID.Value.ToString());
         _catsedneg.eliminarSede(_catsede);
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEliminar", "$('#ModalEliminar').modal('hide');", true);
         upModalEliminar.Update();
         GridViewSedes.DataSource = _catsedneg.list();
         GridViewSedes.DataBind();
     }
     if (Catalogo.Value == "Puestos")
     {
         _catpuesto          = new CatPuestos();
         _catpuesto.idpuesto = Convert.ToInt32(ID.Value.ToString());
         _catpuesneg.eliminarPuesto(_catpuesto);
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEliminar", "$('#ModalEliminar').modal('hide');", true);
         upModalEliminar.Update();
         GridViewPuestos.DataSource = _catpuesneg.list();
         GridViewPuestos.DataBind();
     }
     if (Catalogo.Value == "Temas")
     {
         _cattema        = new CatTemas();
         _cattema.idtema = Convert.ToInt32(ID.Value.ToString());
         _cattemneg.eliminarTema(_cattema);
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalEliminar", "$('#ModalEliminar').modal('hide');", true);
         upModalEliminar.Update();
         GridViewTemas.DataSource = _cattemneg.list();
         GridViewTemas.DataBind();
     }
 }
Beispiel #9
0
        public List <CatTemas> obtenerTemas(string filtro = null)
        {
            List <CatTemas> list = new List <CatTemas>();
            CatTemas        cat;

            try
            {
                using (SqlCommand command = new SqlCommand("spd_catalogos_get", cn.Connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    //command.Parameters.AddWithValue("@idpuesto", id == 0 ? (object)DBNull.Value : id);
                    command.Parameters.AddWithValue("@tipo", "temas");
                    command.Parameters.AddWithValue("@filtro", string.IsNullOrEmpty(filtro) ? (object)DBNull.Value : filtro);
                    cn.OpenConnection();
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        cat               = new CatTemas();
                        cat.idtema        = (int)reader["idtema"];
                        cat.descripcion   = (string)reader["descripcion"];
                        cat.fecharegistro = (DateTime)reader["fecharegistro"];
                        list.Add(cat);
                    }
                }
            }
            catch (SqlException ex)
            {
                throw new Exception("No se pudo obtener registros del catalogo de temas" + ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception("No se pudo obtener registros del catalogo de temas" + ex.Message);
            }
            finally
            {
                cn.CloseConnection();
            }
            return(list);
        }