110,534
社区成员
发帖
与我相关
我的任务
分享
public IEnumerable<SysFile> GetNewFiles(DateTime dtLast)
{
List<SysFile> files = new List<SysFile>();
var reader = sqlHelper.ExecuteReader("select * from Sys_Upload where EntityName <> null ", System.Data.CommandType.Text);
while (reader.Read())
{
string strPath = string.IsNullOrEmpty((string)reader["Location") ? "" : reader["Location"].ToString().Replace('/', '\\').Replace(@"\\", @"\");
string strID = reader["ID"].ToString();
string strTitle = string.IsNullOrEmpty(reader["FileName"].ToString()) ? "" : reader["FileName"].ToString();
string deptName = reader["DeptName"].ToString();
string className = GetFileClass(reader["Mode"].ToString());
string strFullPath = RootFolderPath + strPath;
string isGD = reader["EntityName"].ToString();
SysFile file = new SysFile()
{
ID = strID,
Title = strTitle,
Department = deptName,
FileClass = className,
Description = "",
FullPath = strFullPath,
FileExt = Path.GetExtension(strFullPath),
FileClassType = FileClassType.Public,
Content = "",
User = reader["Promulgator"].ToString(),
Reserve = isGD,
Size = 0,
CreationTime = DateTime.Now
};
try
{
file.CreationTime = (DateTime)reader["UpLoadTime"];
}
catch { }
if (File.Exists(strFullPath))
file.Size = new FileInfo(strFullPath).Length;
files.Add(file);
}
reader.Close();
return files;
}
]