private string Editar(periodicity id_periodicity)
        {
            PeriodicidadCOM Periodicidad = new PeriodicidadCOM();
            string          vmensaje     = Periodicidad.Editar(id_periodicity);

            return(vmensaje);
        }
示例#2
0
 /// <summary>
 /// Agrega una instancia de bonds_types
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Agregar(periodicity entidad)
 {
     try
     {
         string mess = "";
         if (Exist(entidad.name))
         {
             mess = "Ya existe un estatus llamado: " + entidad.name;
         }
         else
         {
             periodicity periodicidad = new periodicity
             {
                 name       = entidad.name,
                 created    = DateTime.Now,
                 created_by = entidad.created_by.ToUpper(),
                 enabled    = true,
             };
             SICOEMEntities sicoem = new SICOEMEntities();
             sicoem.periodicity.Add(periodicidad);
             sicoem.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());
     }
 }
        protected void lnkguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string      vmensaje       = string.Empty;
                int         id_periodicity = Convert.ToInt32(hdfid_periodicity.Value == "" ? "0" : hdfid_periodicity.Value);
                periodicity Periodicidad   = new periodicity();

                if (id_periodicity > 0)
                {
                    Periodicidad.id_periodicity = id_periodicity;
                }
                Periodicidad.name        = txtperiodicidad.Text;
                Periodicidad.description = txtdescripcion.Text;
                Periodicidad.created_by  = Session["usuario"] as string;
                Periodicidad.created     = DateTime.Now;
                Periodicidad.modified_by = Session["usuario"] as string;
                Periodicidad.modified    = DateTime.Now;
                if (Periodicidad.name == "")
                {
                    ModalShow("#Modalperiodicidad");
                    Toast.Error("Error al procesar periodicidad : Ingrese el nombre de la periodicidad", this);
                }
                else if (Periodicidad.description == "")
                {
                    ModalShow("#Modalperiodicidad");
                    Toast.Error("Error al procesar periodicidad : Ingrese la descripcion", this);
                }
                else
                {
                    vmensaje = id_periodicity > 0 ? Editar(Periodicidad) : Agregar(Periodicidad);
                    if (vmensaje == "")
                    {
                        txtperiodicidad.Text    = "";
                        txtdescripcion.Text     = "";
                        hdfid_periodicity.Value = "";
                        CargarCatalogo();
                        Toast.Success("Estatus agregado correctamente.", "Mensaje del sistema", this);
                    }
                    else
                    {
                        ModalShow("#ModalTipoBonos");
                        Toast.Error("Error al procesar estatus : " + vmensaje, this);
                    }
                }
            }
            catch (Exception ex)
            {
                ModalShow("#ModalTipoBonos");
                Toast.Error("Error al procesar estatus : " + ex.Message, this);
            }
        }
        private periodicity GetPeriodicidad(int id_periodicity)
        {
            periodicity dt = new periodicity();

            try
            {
                PeriodicidadCOM getbt = new PeriodicidadCOM();
                dt = getbt.Periodicidad(id_periodicity);
            }
            catch (Exception)
            {
                dt = null;
            }
            return(dt);
        }
示例#5
0
 /// <summary>
 /// Devuelve una instancia de la clase riesgos_estatus
 /// </summary>
 /// <param name="id_proyecto_perido"></param>
 /// <returns></returns>
 public periodicity Periodicidad(int id_periodicity)
 {
     try
     {
         SICOEMEntities sicoem       = new SICOEMEntities();
         periodicity    Periodicidad = sicoem.periodicity
                                       .First(i => i.id_periodicity == id_periodicity);
         return(Periodicidad);
     }
     catch (DbEntityValidationException ex)
     {
         var errorMessages = ex.EntityValidationErrors
                             .SelectMany(x => x.ValidationErrors)
                             .Select(x => x.ErrorMessage);
         var fullErrorMessage = string.Join("; ", errorMessages);
         return(null);
     }
 }
示例#6
0
 /// <summary>
 /// Elimina una instancia de riesgos_estatus
 /// </summary>
 /// <param name="entidad"></param>
 /// <returns></returns>
 public string Eliminar(int id_periodicity)
 {
     try
     {
         SICOEMEntities sicoem       = new SICOEMEntities();
         periodicity    Periodicidad = sicoem.periodicity
                                       .First(i => i.id_periodicity == id_periodicity);
         Periodicidad.enabled = false;
         sicoem.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());
     }
 }
 protected void btneventgrid_Click(object sender, EventArgs e)
 {
     try
     {
         int id_periodicity = Convert.ToInt32(hdfid_periodicity.Value == "" ? "0" : hdfid_periodicity.Value);
         if (id_periodicity > 0)
         {
             periodicity Periodicidad = GetPeriodicidad(id_periodicity);
             if (Periodicidad != null)
             {
                 txtperiodicidad.Text = Periodicidad.name;
                 txtdescripcion.Text  = Periodicidad.description;
                 ModalShow("#Modalperiodicidad");
             }
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al cargar periodicidad : " + ex.Message, this);
     }
 }
 protected void btneliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int         id_periodicity = Convert.ToInt32(hdfid_periodicity.Value == "" ? "0" : hdfid_periodicity.Value);
         periodicity Periodicidad   = new periodicity();
         Periodicidad.id_periodicity = id_periodicity;
         string vmensaje = Eliminar(id_periodicity);
         if (vmensaje == "")
         {
             CargarCatalogo();
             Toast.Success("periodicidad eliminado correctamente.", "Mensaje del sistema", this);
         }
         else
         {
             Toast.Error("Error al eliminar periodicidad: " + vmensaje, this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al eliminar periodicidad: " + ex.Message, this);
     }
 }