Example #1
0
        /*  public ResultMessage UploadFile(string Nombre, string Usuario, string Equipo, string Ip)//, string Fecha, string Extencion,string TransaccionId, int TablaId, string NroOperacion, string Archivo)
         * {*/
        // HttpContext request = HttpContext.Current;
        public ResultMessage UploadFile(ParameterFileType ParameterFile)
        {
            ResultMessage result = new ResultMessage {
            };

            try
            {
                //ParameterFileType param = new ParameterFileType();
                IIdentity       winid = HttpContext.Current.User.Identity;
                WindowsIdentity wi    = (WindowsIdentity)winid;

                NameValueCollection varServer = HttpContext.Current.Request.ServerVariables;

                ParameterFile.Usuario = varServer["HTTP_QVUSER"];// wi.Name;
                SharedFileMananger shared = new SharedFileMananger();
                result = shared.CreateFiles(ParameterFile);
                //return new ResultMessage { Status ="",  Sta   tusBody =  new ErrorMessage { Code ="o", Message ="oksks"} };// result;
                return(result);
            }
            catch (Exception ex)
            {
                result = new ResultMessage
                {
                    Status     = "ERROR",
                    StatusBody = new ErrorMessage
                    {
                        Code    = "501",
                        Message = "Message Exception:.." + ex.Message
                    }
                };
            }
            return(result);
        }
Example #2
0
        public string DownloadFile(String IdArchivo, string param, string param1, string param2)
        {
            //IIdentity winid = HttpContext.Current.User.Identity;
            //WindowsIdentity wi = (WindowsIdentity)winid;

            // string EmployeeLogin = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            //string data = HttpContext.Current.Request .ServerVariables["AUTH_USER"].ToString();

            XmlDocument         xmlSoapRequest = new XmlDocument();
            NameValueCollection varServer      = HttpContext.Current.Request.ServerVariables;

            string[] keys = varServer.AllKeys;

            string fff = "";

            for (int i = 0; i < varServer.Count; i++)
            {
                fff = fff + varServer[i];;
            }
            SharedFileMananger shared = new SharedFileMananger();
            string             path   = Server.MapPath("files");

            //string remoteUri = "https://intranet.usat.edu.pe/campusvirtual/librerianet/reglamentos/";
            //param = "USAT\\CSenmache";
            string fileName = shared.PermiteDescargarArchivo(IdArchivo, param, param1);   //varServer["HTTP_QVUSER"]
            //string fileName = "REGLAMENTO_BIBLIOTECA.pdf", myStringWebResource = null;
            WebClient myWebClient = new WebClient();

            //myStringWebResource = remoteUri + fileName;
            //myWebClient.DownloadFile(myStringWebResource, param2);
            if (fileName.Contains("Error") == true)
            {
                return(fileName);
            }
            else
            {
                //myWebClient.DownloadFile(fileName, param2);
                return(shared.GetArchivo(IdArchivo, param, param1));
            }

            //return "Descarga completa - " + fileName;
            //return shared.GetArchivo(IdArchivo, varServer["HTTP_QVUSER"], path, param1);// wi.Name);// +"::: Descargando " + fff + ":::::::: " + gg["HTTP_QVUSER:"******"  ----  " + gg["HTTP_QVUSER"] + "***** " + gg["HTTP_QVUSER:"******"===" + gg["HTTP_QVUSER"] + keys[0];
            //return shared.GetArchivo(IdArchivo, "USAT\\esaavedra", path, param1);// wi.Name);// +"::: Descargando " + fff + ":::::::: " + gg["HTTP_QVUSER:"******"  ----  " + gg["HTTP_QVUSER"] + "***** " + gg["HTTP_QVUSER:"******"===" + gg["HTTP_QVUSER"] + keys[0];
        }