Beispiel #1
0
 public static object Modificar_Perfiles(SPC_GET_PERFIL_Result record)
 {
     try
     {
         using (var DB = new TPVDBEntities())
         {
             DB.SPC_GET_PERFIL(
                 record.Codigo_Perfil,
                 record.Perfil,
                 true);
         }
         return(new { Result = "OK", Record = record });
     }
     catch
     {
         return(new { Result = "ERROR", Message = "Ocurrió un inconveniente al momento de actualizar el perfil." });
     }
 }
Beispiel #2
0
        public static object Listar_Perfiles(int jtStartIndex, int jtPageSize, String nombre)
        {
            try
            {
                int total = 0;

                List <SPC_GET_PERFIL_Result> Resultado = null;
                using (var DB = new TPVDBEntities())
                {
                    Resultado = DB.SPC_GET_PERFIL(
                        null,
                        nombre,
                        true).ToList();
                    total = Resultado.Count();
                }

                return(new { Result = "OK", Records = Resultado.Skip(jtStartIndex).Take(jtPageSize), TotalRecordCount = total });
            }
            catch
            {
                return(new { Result = "ERROR", Message = "Ha ocurrido un error al cargar el listado de perfiles." });
            }
        }
Beispiel #3
0
        public static object listado_Perfiles_Combo(int Codigo_Perfil)
        {
            try
            {
                var DefaultItem = new { DisplayText = "[-Sin Perfil-]", Value = 0 };
                using (var DB = new TPVDBEntities())
                {
                    var Resultado = DB.SPC_GET_PERFIL(Codigo_Perfil, null, true).ToList()
                                    .Select(c => new
                    {
                        DisplayText = c.Perfil,
                        Value       = c.Codigo_Perfil
                    }).OrderBy(o => o.DisplayText).ToList();

                    //--
                    Resultado.Insert(0, DefaultItem);
                    return(new { Result = "OK", Options = Resultado });
                }
            }
            catch
            {
                return(new { Result = "ERROR", Message = "Ha ocurrido un error al cargar el listado de perfiles. Contacte su administrador." });
            }
        }