Example #1
0
        public Object getDir([FromBody] DirModulos dm)
        {
            try
            {
                if (HttpContext.Current.Session["token"] == null)
                {
                    return(Redirect(Request.RequestUri.GetLeftPart(UriPartial.Authority)));
                }

                var dirVo = Path.Combine(ProcessMsg.Utils.GetPathSetting(HttpContext.Current.Server.MapPath("~/VersionOficial")));
                if (dm.Directorio.StartsWith(dirVo))
                {
                    //dm.Directorio = dm.Directorio.Replace(dirVo, "");
                }
                var path = Path.Combine(dirVo, dm.Directorio);
                if (Directory.Exists(path))
                {
                    return(Content(HttpStatusCode.OK, new DirectoryInfo(path).GetDirectories()));
                }
                return(Content(HttpStatusCode.BadRequest, (object)path));
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message));
            }
        }
Example #2
0
 public Object getModulosByComponente([FromBody] DirModulos filename)
 {
     try
     {
         if (HttpContext.Current.Session["token"] == null)
         {
             return(Redirect(Request.RequestUri.GetLeftPart(UriPartial.Authority)));
         }
         return(Content(HttpStatusCode.OK, ProcessMsg.Modulo.GetModulosByComponente(filename.Directorio)));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message));
     }
 }
Example #3
0
 public Object GetExisteDirModulo([FromBody] DirModulos dm)
 {
     try
     {
         if (HttpContext.Current.Session["token"] == null)
         {
             return(Redirect(Request.RequestUri.GetLeftPart(UriPartial.Authority)));
         }
         if (dm == null)
         {
             return(false);
         }
         var path = Path.Combine(ProcessMsg.Utils.GetPathSetting(HttpContext.Current.Server.MapPath("~/VersionOficial")), "N+1", dm.Directorio);
         return(Directory.Exists(path));
     }
     catch (Exception ex)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message));
     }
 }