Ejemplo n.º 1
0
        private void SetFilePaths(DataBaseServer srv, FormCollection form)
        {
            if (srv.DataBaseFiles.Count == 0)
            {
                DataBaseServer s = new DataBaseServer(db);
                srv.DataBaseFiles = s.DataBaseFiles;
            }

            DataBaseFile dbf = new DataBaseFile();

            foreach (var item in _app.DB.DataBaseFilesName)
            {
                dbf = srv.DataBaseFiles.FirstOrDefault(x => x.DataBaseFilesName.FileID == item.FileID);

                dbf.FilePath = form["filepath_" + item.FileName].ToString();

                if (dbf.DataBaseFilesSizes.Count > 0)
                {
                    if (dbf.DataBaseFilesSizes.OrderByDescending(x => x.DateTaken).FirstOrDefault().DateTaken.Date < DateTime.Now.Date)
                    {
                        dbf.DataBaseFilesSizes.Add(new DataBaseFilesSize {
                            DateTaken = DateTime.Now, Size = file.FileSizeMB(dbf, srv)
                        });
                    }
                }
                else
                {
                    dbf.DataBaseFilesSizes.Add(new DataBaseFilesSize {
                        DateTaken = DateTime.Now, Size = file.FileSizeMB(dbf, srv)
                    });
                }
            }
        }
Ejemplo n.º 2
0
            public decimal FileSizeMB(DataBaseFile dbf, DataBaseServer srv)
            {
                _app.Networking nt = new Networking();

                string filePath = nt.RelosveFullPath(srv, dbf.FilePath); // access admin share to file path

                return(FileSizeMB(filePath));
            }
Ejemplo n.º 3
0
 public decimal FileSizeMB(DataBaseFile dbf)
 {
     return(FileSizeMB(dbf, dbf.DataBaseServer));
 }