Exemplo n.º 1
0
 /// <summary>
 /// Agrega una instancia de proyectos_tecnologias
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Agregar(proyectos_tecnologias entidad)
 {
     try
     {
         string mess = "";
         if (Exist(entidad.nombre))
         {
             mess = "Ya existe una tecnologia llamado: " + entidad.nombre;
         }
         else
         {
             proyectos_tecnologias tecnologia = new proyectos_tecnologias
             {
                 nombre  = entidad.nombre,
                 activo  = true,
                 usuario = entidad.usuario.ToUpper(),
                 fecha   = DateTime.Now
             };
             Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
             context.proyectos_tecnologias.Add(tecnologia);
             context.SaveChanges();
         }
         return(mess);
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(fullErrorMessage.ToString());
     }
 }
Exemplo n.º 2
0
        private string Editar(proyectos_tecnologias id_proyecto_tecnologia)
        {
            ProyectosTecnologiasCOM PE = new ProyectosTecnologiasCOM();
            string vmensaje            = PE.Editar(id_proyecto_tecnologia);

            return(vmensaje);
        }
Exemplo n.º 3
0
        private proyectos_tecnologias GetProyectoEstatus(int id_proyecto_tecnologia)
        {
            proyectos_tecnologias dt = new proyectos_tecnologias();

            try
            {
                ProyectosTecnologiasCOM PE = new ProyectosTecnologiasCOM();
                dt = PE.tecnologia(id_proyecto_tecnologia);
            }
            catch (Exception)
            {
                dt = null;
            }
            return(dt);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Devuelve una instancia de la clase proyectos_tecnologias
 /// </summary>
 /// <param name="id_proyecto_perido"></param>
 /// <returns></returns>
 public proyectos_tecnologias tecnologia(int id_proyecto_tecnologia)
 {
     try
     {
         Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
         proyectos_tecnologias     impacto = context.proyectos_tecnologias
                                             .First(i => i.id_proyecto_tecnologia == id_proyecto_tecnologia);
         return(impacto);
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(null);
     }
 }
Exemplo n.º 5
0
        protected void lnkguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string vmensaje = string.Empty;
                int    id_proyecto_tecnologia = Convert.ToInt32(hdfid_proyecto_tecnologia.Value == "" ? "0" : hdfid_proyecto_tecnologia.Value);
                proyectos_tecnologias PE      = new proyectos_tecnologias();
                PE.nombre = txtestatus.Text;

                if (id_proyecto_tecnologia > 0)
                {
                    PE.id_proyecto_tecnologia = id_proyecto_tecnologia;
                }
                PE.activo  = chkactivo.Checked;
                PE.usuario = Session["usuario"] as string;
                if (PE.nombre == "")
                {
                    ModalShow("#ModalProyectoestatus");
                    Toast.Error("Error al procesar Tecnologia : Ingrese un titulo", this);
                }
                else
                {
                    vmensaje = id_proyecto_tecnologia > 0 ? Editar(PE) : Agregar(PE);
                    if (vmensaje == "")
                    {
                        txtestatus.Text   = "";
                        chkactivo.Checked = true;
                        hdfid_proyecto_tecnologia.Value = "";
                        CargarCatalogo();
                        Toast.Success("Tecnologia agregada correctamente.", "Mensaje del sistema", this);
                    }
                    else
                    {
                        ModalShow("#ModalProyectoestatus");
                        Toast.Error("Error al procesar Tecnologia : " + vmensaje, this);
                    }
                }
            }
            catch (Exception ex)
            {
                ModalShow("#ModalProyectoestatus");
                Toast.Error("Error al procesar Tecnologia : " + ex.Message, this);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Elimina una instancia de proyectos_tecnologias
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Eliminar(int id_proyecto_tecnologia)
 {
     try
     {
         Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
         proyectos_tecnologias     periodo = context.proyectos_tecnologias
                                             .First(i => i.id_proyecto_tecnologia == id_proyecto_tecnologia);
         periodo.activo = false;
         context.SaveChanges();
         return("");
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(fullErrorMessage.ToString());
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Edita una instancia de proyectos_tecnologias
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Editar(proyectos_tecnologias entidad)
 {
     try
     {
         Proyectos_ConnextEntities context    = new Proyectos_ConnextEntities();
         proyectos_tecnologias     tecnologia = context.proyectos_tecnologias
                                                .First(i => i.id_proyecto_tecnologia == entidad.id_proyecto_tecnologia);
         tecnologia.nombre = entidad.nombre;
         context.SaveChanges();
         return("");
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(fullErrorMessage.ToString());
     }
 }
Exemplo n.º 8
0
 protected void btneventgrid_Click(object sender, EventArgs e)
 {
     try
     {
         int id_proyecto_tecnologia = Convert.ToInt32(hdfid_proyecto_tecnologia.Value == "" ? "0" : hdfid_proyecto_tecnologia.Value);
         if (id_proyecto_tecnologia > 0)
         {
             proyectos_tecnologias PE = GetProyectoEstatus(id_proyecto_tecnologia);
             if (PE != null)
             {
                 txtestatus.Text   = PE.nombre;
                 chkactivo.Checked = PE.activo;
                 ModalShow("#ModalProyectoestatus");
             }
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al cargar Tecnologia : " + ex.Message, this);
     }
 }
Exemplo n.º 9
0
 protected void btneliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int id_proyecto_tecnologia = Convert.ToInt32(hdfid_proyecto_tecnologia.Value == "" ? "0" : hdfid_proyecto_tecnologia.Value);
         proyectos_tecnologias PE   = new proyectos_tecnologias();
         PE.id_proyecto_tecnologia = id_proyecto_tecnologia;
         string vmensaje = Eliminar(id_proyecto_tecnologia);
         if (vmensaje == "")
         {
             CargarCatalogo();
             Toast.Success("Tecnologia eliminada correctamente.", "Mensaje del sistema", this);
         }
         else
         {
             Toast.Error("Error al eliminar tecnologia: " + vmensaje, this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al eliminar tecnologia: " + ex.Message, this);
     }
 }