예제 #1
0
 public VMSistema ObtenerInfoSistemaApp(int idSistema)
 {
     try
     {
         IDAOSistemaApp iDaoSis = new DAOSistemaApp();
         RespuestaBD    resp    = iDaoSis.ObtenerSistemasApp(idSistema);
         if (resp.EXISTE_ERROR)
         {
             throw new Exception(resp.MENSAJE);
         }
         else
         {
             DataTable datos = resp.dataSet.Tables[0];
             VMSistema sis   = (from x in datos.AsEnumerable()
                                select new VMSistema()
             {
                 Activo = x.Field <bool>("fl_estatus_sistema"),
                 Embebido = x.Field <bool>("fl_embebido"),
                 IdSistema = x.Field <int>("fi_id_sistema"),
                 Logo = x.Field <string>("fc_logo"),
                 NombreSistema = x.Field <string>("fc_nombre_sistema"),
                 UrlHome = x.Field <string>("fc_url_home"),
             }).FirstOrDefault();
             return(sis);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public VMSistema RegistrarSistema(string nombre, string logo, string urlhome, bool sistemaEmbebido, bool estatus)
        {
            try
            {
                VMSistema sis   = new VMSistema();
                string    error = string.Empty;
                if (string.IsNullOrEmpty(nombre))
                {
                    error += "- Debes registrar un Nombre." + "<br />";
                }

                if (string.IsNullOrEmpty(error))
                {
                    IDAOSistemaApp iDaoSistemaApp = new DAOSistemaApp();
                    RespuestaBD    resp           = iDaoSistemaApp.RegistrarSistemaApp(nombre, logo, urlhome, sistemaEmbebido, estatus);
                    if (resp.EXISTE_ERROR)
                    {
                        throw new Exception(resp.MENSAJE);
                    }
                    else
                    {
                        sis = new VMSistema() //mapea modelo
                        {
                            NombreSistema = nombre,
                            Logo          = logo,
                            UrlHome       = urlhome,
                            Embebido      = sistemaEmbebido,
                            Activo        = estatus,
                            IdSistema     = (int)resp.dataSet.Tables[0].Rows[0]["fi_id_sistema"]
                        };
                    }
                    return(sis);
                }
                else
                {
                    throw new Exception(error);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(new Util().ObtenerMsjExcepcion(ex));
            }
        }
예제 #3
0
        public void EditarSistema(int idSistema,
                                  string nombre, string logo, string urlhome, bool sistemaEmbebido, bool estatus)
        {
            try
            {
                VMSistema sis   = new VMSistema();
                string    error = string.Empty;
                if (idSistema <= 0)
                {
                    error += "- Indica que sistema se actualizara." + "<br />";
                }

                if (string.IsNullOrEmpty(nombre))
                {
                    error += "- Debes registrar un Nombre." + "<br />";
                }

                if (string.IsNullOrEmpty(error))
                {
                    IDAOSistemaApp iDaoSistemaApp = new DAOSistemaApp();
                    RespuestaBD    resp           = iDaoSistemaApp.EditarSistemaApp(idSistema, nombre, logo, urlhome, sistemaEmbebido, estatus);
                    if (resp.EXISTE_ERROR)
                    {
                        throw new Exception(resp.MENSAJE);
                    }
                }
                else
                {
                    throw new Exception(error);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(new Util().ObtenerMsjExcepcion(ex));
            }
        }