private void BuildVm()
 {
     try
     {
         if (CacheProvider.Exist("Usuarios"))
         {
             Usuarios = (List <SelectListItem>)CacheProvider.Get("Usuarios");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Usuarios = _serviceUsuario.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.AccountName), Value = Convert.ToString(x.Id)
             }).ToList();
             CacheProvider.Set("Usuarios", Usuarios);
         }
         if (CacheProvider.Exist("Passwords"))
         {
             Passwords = (List <SelectListItem>)CacheProvider.Get("Passwords");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Passwords = _servicePassword.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Password1), Value = Convert.ToString(x.Id)
             }).ToList();
             CacheProvider.Set("Passwords", Passwords);
         }
     }
     catch (Exception ex)
     {
         //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - InitializeVMUserPasswords ERROR"), ex);
     }
 }
Beispiel #2
0
 private void BuildVm()
 {
     try
     {
         if (CacheProvider.Exist("Recetas"))
         {
             Recetas = (List <SelectListItem>)CacheProvider.Get("Recetas");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Recetas = _serviceReceta.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             CacheProvider.Set("Recetas", Recetas);
         }
         if (CacheProvider.Exist("Alims"))
         {
             Alims = (List <SelectListItem>)CacheProvider.Get("Alims");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Alims = _serviceAlim.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             CacheProvider.Set("Alims", Alims);
         }
     }
     catch (Exception ex)
     {
         //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - InitializeVMRecProd ERROR"), ex);
     }
 }
 private void BuildVm()
 {
     try
     {
         if (CacheProvider.Exist("Nt_Grp_Cants"))
         {
             Nt_Grp_Cants = (List <SelectListItem>)CacheProvider.Get("Nt_Grp_Cants");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Nt_Grp_Cants = _serviceNt_Grp_Cant.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             Nt_Grp_Cants.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("Nt_Grp_Cants", Nt_Grp_Cants);
         }
     }
     catch (Exception ex)
     {
         //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - InitializeVMNt_Grp ERROR"), ex);
     }
 }
Beispiel #4
0
 private void BuildVm()
 {
     try
     {
         if (CacheProvider.Exist("UniMeds"))
         {
             UniMeds = (List <SelectListItem>)CacheProvider.Get("UniMeds");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             UniMeds = _serviceUniMed.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Descripcion), Value = Convert.ToString(x.Id)
             }).ToList();
             UniMeds.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("UniMeds", UniMeds);
         }
         if (CacheProvider.Exist("Alim_Grps"))
         {
             Alim_Grps = (List <SelectListItem>)CacheProvider.Get("Alim_Grps");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Alim_Grps = _serviceAlim_Grp.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             Alim_Grps.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("Alim_Grps", Alim_Grps);
         }
         if (CacheProvider.Exist("Alim_Fuentes"))
         {
             Alim_Fuentes = (List <SelectListItem>)CacheProvider.Get("Alim_Fuentes");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Alim_Fuentes = _serviceAlim_Fuente.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             Alim_Fuentes.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("Alim_Fuentes", Alim_Fuentes);
         }
     }
     catch (Exception ex)
     {
         //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - InitializeVMAlim ERROR"), ex);
     }
 }
Beispiel #5
0
        public IEnumerable <Province> GetProvinces()
        {
            if (CacheProvider.Exist("GetProvinces"))
            {
                return(CacheProvider.Get("GetProvinces") as IEnumerable <Province>);
            }
            var estados = _service.GetProvinces();

            CacheProvider.Set("GetProvinces", estados, 12000);
            return(estados);
        }
Beispiel #6
0
        public IEnumerable <City> GetCities(string province)
        {
            if (CacheProvider.Exist("GetCities" + province))
            {
                return(CacheProvider.Get("GetCities" + province) as IEnumerable <City>);
            }

            var cities = _service.GetCities(province);

            CacheProvider.Set("GetCities" + province, cities, 12000);
            return(cities);
        }
 private void BuildVm()
 {
     try
     {
         if (CacheProvider.Exist("Usuarios"))
         {
             Usuarios = (List <SelectListItem>)CacheProvider.Get("Usuarios");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             Usuarios = _serviceUsuario.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.AccountName), Value = Convert.ToString(x.Id)
             }).ToList();
             Usuarios.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("Usuarios", Usuarios);
         }
         if (CacheProvider.Exist("RolUsuarios"))
         {
             RolUsuarios = (List <SelectListItem>)CacheProvider.Get("RolUsuarios");
         }
         else
         {
             // TODO: Modify TEXT (SelectList)
             RolUsuarios = _serviceRolUsuario.GetAll(null, null).Select(x => new SelectListItem {
                 Text = Convert.ToString(x.Nombre), Value = Convert.ToString(x.Id)
             }).ToList();
             RolUsuarios.Insert(0, new SelectListItem {
                 Text = string.Empty, Value = string.Empty
             });
             CacheProvider.Set("RolUsuarios", RolUsuarios);
         }
     }
     catch (Exception ex)
     {
         //LoggerFactory.CreateLog().Error(string.Format(CultureInfo.InvariantCulture, "Presentation Layer - InitializeVMPermisosUsuario ERROR"), ex);
     }
 }