Ejemplo n.º 1
0
        public List <DocumentVO> FindByFileName(string fileName, bool isExact)
        {
            FileDAO       dao   = new FileDAO();
            List <FileVO> files = dao.FindFilesByName(fileName, isExact);

            dao.CloseConnection();
            NoRepeatList <DocumentVO> result = new NoRepeatList <DocumentVO>();

            foreach (FileVO file in files)
            {
                result.AddDistinct(file.Document);
            }

            FullLoadList(result);

            return(result);
        }
Ejemplo n.º 2
0
        public List <DocumentVO> FindByFileArchivingDate(Common.Search.DateRange range)
        {
            FileDAO       dao   = new FileDAO();
            List <FileVO> files = dao.FindFilesByArchivingDate(range);

            dao.CloseConnection();
            NoRepeatList <DocumentVO> result = new NoRepeatList <DocumentVO>();

            foreach (FileVO file in files)
            {
                result.AddDistinct(file.Document);
            }

            FullLoadList(result);

            return(result);
        }
Ejemplo n.º 3
0
        public void FullLoad(DocumentVO doc)
        {
            DocumentCategoryDAO dao           = new DocumentCategoryDAO();
            List <int>          categoriesIds = dao.GetAssociationsOfFirstTable(doc);

            dao.CloseConnection();

            CategoryDAO       catDao = new CategoryDAO();
            List <CategoryVO> result = new List <CategoryVO>();

            foreach (int item in categoriesIds)
            {
                result.Add(catDao.GetItem(item));
            }

            catDao.CloseConnection();
            doc.Categories = result;

            FileDAO fileDao = new FileDAO();

            doc.Files = fileDao.GetFilesOfDocument(doc);
            fileDao.CloseConnection();
        }
Ejemplo n.º 4
0
        public bool BackupDataBase(string backupFileName)
        {
            string statement = string.Format("BACKUP DATABASE {0} to disk ='{1}\\{2}'", ConfigurationManager., ConfigurationManager.FtpDirectoryOnServer, backupFileName);
            bool   result    = executer.ExecuteNonQuery(statement, null);

            if (result)
            {
                try
                {
                    StringBuilder sB = new StringBuilder();
                    sB.Append(ConfigurationManager.FtpDirectoryOnServer);
                    sB.Append("\\");
                    sB.Append(backupFileName);

                    byte[] file = FTPClient.DownloadFile(backupFileName);
                    return(FileDAO.StoreFile(file));
                }
                catch
                {
                    return(false);
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
 public bool BackupFile(string serverFilePath)
 {
     byte[] file = FTPClient.DownloadFile(serverFilePath);
     return(FileDAO.StoreFile(file));
 }
Ejemplo n.º 6
0
        private byte[] ReadStream(string filePath)
        {
            FileStream fStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);

            return(FileDAO.ReadFully(fStream));
        }