コード例 #1
0
 /// <summary>
 /// Agrega una instancia de proyectos_estatus
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Agregar(proyectos_estatus entidad)
 {
     try
     {
         string mess = "";
         if (Exist(entidad.estatus))
         {
             mess = "Ya existe un estatus llamado: " + entidad.estatus;
         }
         else
         {
             proyectos_estatus estatus = new proyectos_estatus
             {
                 estatus = entidad.estatus,
                 activo  = true,
                 usuario = entidad.usuario.ToUpper(),
                 fecha   = DateTime.Now
             };
             Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
             context.proyectos_estatus.Add(estatus);
             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());
     }
 }
コード例 #2
0
        private string Editar(proyectos_estatus id_proyecto_estatus)
        {
            ProyectosEstatusCOM PE = new ProyectosEstatusCOM();
            string vmensaje        = PE.Editar(id_proyecto_estatus);

            if (vmensaje == "")
            {
                return("");
            }
            else
            {
                return(vmensaje);
            }
        }
コード例 #3
0
        private proyectos_estatus GetProyectoEstatus(int id_proyecto_estatus)
        {
            proyectos_estatus dt = new proyectos_estatus();

            try
            {
                ProyectosEstatusCOM PE = new ProyectosEstatusCOM();
                dt = PE.estatus(id_proyecto_estatus);
            }
            catch (Exception)
            {
                dt = null;
            }
            return(dt);
        }
コード例 #4
0
 /// <summary>
 /// Devuelve una instancia de la clase proyectos_estatus
 /// </summary>
 /// <param name="id_proyecto_perido"></param>
 /// <returns></returns>
 public proyectos_estatus estatus(int id_proyecto_estatus)
 {
     try
     {
         Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
         proyectos_estatus         estatus = context.proyectos_estatus
                                             .First(i => i.id_proyecto_estatus == id_proyecto_estatus);
         return(estatus);
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(null);
     }
 }
コード例 #5
0
        protected void lnkguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string            vmensaje            = string.Empty;
                int               id_proyecto_estatus = Convert.ToInt32(hdfid_proyecto_estatus.Value == "" ? "0" : hdfid_proyecto_estatus.Value);
                proyectos_estatus PE = new proyectos_estatus();
                PE.estatus = txtestatus.Text;

                if (id_proyecto_estatus > 0)
                {
                    PE.id_proyecto_estatus = id_proyecto_estatus;
                }
                PE.activo  = chkactivo.Checked;
                PE.usuario = Session["usuario"] as string;
                if (PE.estatus == "")
                {
                    ModalShow("#ModalProyectoestatus");
                    Toast.Error("Error al procesar estatus : Ingrese un titulo", this);
                }
                else
                {
                    vmensaje = id_proyecto_estatus > 0 ? Editar(PE) : Agregar(PE);
                    if (vmensaje == "")
                    {
                        txtestatus.Text = "";
                        hdfid_proyecto_estatus.Value = "";
                        chkactivo.Checked            = false;
                        CargarCatalogo();
                        Toast.Success("Estatus agregado correctamente.", "Mensaje del sistema", this);
                    }
                    else
                    {
                        ModalShow("#ModalProyectoestatus");
                        Toast.Error("Error al procesar estatus : " + vmensaje, this);
                    }
                }
            }
            catch (Exception ex)
            {
                ModalShow("#ModalProyectoestatus");
                Toast.Error("Error al procesar estatus : " + ex.Message, this);
            }
        }
コード例 #6
0
 /// <summary>
 /// Elimina una instancia de proyectos_estatus
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Eliminar(int id_proyecto_estatus)
 {
     try
     {
         Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
         proyectos_estatus         periodo = context.proyectos_estatus
                                             .First(i => i.id_proyecto_estatus == id_proyecto_estatus);
         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());
     }
 }
コード例 #7
0
 /// <summary>
 /// Edita una instancia de proyectos estatus
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Editar(proyectos_estatus entidad)
 {
     try
     {
         Proyectos_ConnextEntities context = new Proyectos_ConnextEntities();
         proyectos_estatus         estatus = context.proyectos_estatus
                                             .First(i => i.id_proyecto_estatus == entidad.id_proyecto_estatus);
         estatus.estatus = entidad.estatus;
         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());
     }
 }
コード例 #8
0
 protected void btneventgrid_Click(object sender, EventArgs e)
 {
     try
     {
         int id_proyecto_estatus = Convert.ToInt32(hdfid_proyecto_estatus.Value == "" ? "0" : hdfid_proyecto_estatus.Value);
         if (id_proyecto_estatus > 0)
         {
             proyectos_estatus PE = GetProyectoEstatus(id_proyecto_estatus);
             if (PE != null)
             {
                 txtestatus.Text   = PE.estatus;
                 chkactivo.Checked = PE.activo;
                 ModalShow("#ModalProyectoestatus");
             }
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al cargar estatus : " + ex.Message, this);
     }
 }
コード例 #9
0
 protected void btneliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int id_proyecto_estatus = Convert.ToInt32(hdfid_proyecto_estatus.Value == "" ? "0" : hdfid_proyecto_estatus.Value);
         proyectos_estatus PE    = new proyectos_estatus();
         PE.id_proyecto_estatus = id_proyecto_estatus;
         string vmensaje = Eliminar(id_proyecto_estatus);
         if (vmensaje == "")
         {
             CargarCatalogo();
             Toast.Success("proyecto estus eliminado correctamente.", "Mensaje del sistema", this);
         }
         else
         {
             Toast.Error("Error al eliminar proyecto estatus: " + vmensaje, this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al eliminar proyecto estus : " + ex.Message, this);
     }
 }