private bool RemoveFile(string sPath, int iStep)
        {
            string sFileName = "";
            bool   bRetVal   = false;

            if (iStep == 0)
            {
                try
                {
                    sFileName = sPath.Replace("I:", "C:\\P2D");
                    sFileName = sFileName.Replace("\\90104-server2", "C:\\P2D");
                    CBSolutions.ETH.Web.WEBRef.FileDownload objService = new CBSolutions.ETH.Web.WEBRef.FileDownload();
                    objService.Url = GetURL();
                    bRetVal        = objService.RemoveFile(sFileName);
                }
                catch
                {
                }
            }
            if (iStep == 1)
            {
                try
                {
                    CBSolutions.ETH.Web.WEBRef2.FileDownload objService2 = new CBSolutions.ETH.Web.WEBRef2.FileDownload();
                    objService2.Url = GetURL2();
                    sFileName       = sPath.Replace("\\90107-server3", @"C:\File Repository");
                    sFileName       = GetTrimFirstSlash(sFileName);
                    bRetVal         = objService2.RemoveFile(sFileName);
                }
                catch
                {
                }
            }
            return(bRetVal);
        }
Пример #2
0
        private byte[] ForceDownload(string ImagePath, string ArchPath, int iStep)
        {
            bool bRetVal = false;

            byte[] bytBytesFinal = null;
            string sFileName     = string.Empty;

            if (iStep == 0)
            {
                sFileName = ImagePath;
                sFileName = sFileName.Replace("I:", "C:\\P2D");
                sFileName = sFileName.Replace("\\90104-server2", "C:\\P2D");
                sFileName = GetTrimFirstSlash(sFileName);
                System.IO.FileStream fs1 = null;
                try
                {
                    CBSolutions.ETH.Web.WEBRef.FileDownload objService = new CBSolutions.ETH.Web.WEBRef.FileDownload();
                    objService.Url = GetURL();
                    byte[] bytBytes = objService.DownloadFile(sFileName);
                    if (bytBytes != null)
                    {
                        bytBytesFinal = bytBytes;
                    }
                    else
                    {
                        bytBytesFinal = ForceDownload(ImagePath, ArchPath, 1);
                    }
                }
                catch (Exception Ex)
                {
                    string Error = Ex.ToString();
                }
            }
            else if (iStep == 1)
            {
                sFileName = ArchPath;
                sFileName = sFileName.Replace("\\90107-server3", @"C:\File Repository");
                sFileName = GetTrimFirstSlash(sFileName);
                System.IO.FileStream fs1 = null;
                try
                {
                    CBSolutions.ETH.Web.WEBRef2.FileDownload objService2 = new CBSolutions.ETH.Web.WEBRef2.FileDownload();
                    objService2.Url = GetURL2();
                    byte[] bytBytes = objService2.DownloadFile(sFileName);
                    if (bytBytes != null)
                    {
                        bytBytesFinal = bytBytes;
                    }
                }
                catch (Exception Ex)
                {
                    string Error = Ex.ToString();
                }
            }
            return(bytBytesFinal);
        }
        private bool ForceDownload(string sPath, int iStep)
        {
            bool   bRetVal   = false;
            string sFileName = sPath;

            if (iStep == 0)
            {
                System.IO.FileStream fs1 = null;
                try
                {
                    CBSolutions.ETH.Web.WEBRef.FileDownload objService = new CBSolutions.ETH.Web.WEBRef.FileDownload();
                    objService.Url = GetURL();
                    byte[] bytBytes = objService.DownloadFile(sFileName);
                    if (bytBytes != null)
                    {
                        Response.AppendHeader("content-disposition", "attachment; filename=" + Path.GetFileName(sFileName));
                        Response.ContentType = "application//octet-stream";
                        Response.BinaryWrite(bytBytes);
                        Response.Flush();
                        Response.End();
                        fs1.Close();
                        fs1     = null;
                        bRetVal = true;
                    }
                }
                catch
                {
                }
            }
            else if (iStep == 1)
            {
                System.IO.FileStream fs1 = null;
                try
                {
                    CBSolutions.ETH.Web.WEBRef2.FileDownload objService2 = new CBSolutions.ETH.Web.WEBRef2.FileDownload();
                    objService2.Url = GetURL2();
                    byte[] bytBytes = objService2.DownloadFile(sFileName);
                    if (bytBytes != null)
                    {
                        Response.AppendHeader("content-disposition", "attachment; filename=" + Path.GetFileName(sFileName));
                        Response.ContentType = "application//octet-stream";
                        Response.BinaryWrite(bytBytes);
                        Response.Flush();
                        Response.End();
                        fs1.Close();
                        fs1     = null;
                        bRetVal = true;
                    }
                }
                catch
                {
                }
            }
            return(bRetVal);
        }