Exemple #1
0
        // Methods
        public static HtzFile AddFile(string projectName, string mapName, string featureSource, long uid, string fileName, string description)
        {
            DBUploadFiles _db = new DBUploadFiles(projectName);
            if (!_db.IsExists(fileName, featureSource, uid))
            {
            HtzFile f = new HtzFile {
                UID = uid,
                Description = description,
                FeatureSource = featureSource,
                FeatureSourceId = (int) _db.GetFeatureSourceId(featureSource, false),
                FileName = fileName,
                MapName = mapName,
                UploadDate = DateTime.Now.ToString("dd/MM/yyyy"),
                ProjectName = projectName
            };

            if (_db.AddFile(fileName, description, mapName, featureSource, uid))
            {
                f.ID = _db.GetLastInsertedId();
                f.FeatureSourceId = (int) _db.GetFeatureSourceId(featureSource, false);
                return f;
            }
            }
            return null;
        }
Exemple #2
0
 public static HtzFile[] GetFiles(string projectName, string featureSource, long uid)
 {
     List<HtzFile> result = new List<HtzFile>();
     DBUploadFiles _db = new DBUploadFiles(projectName);
     IDataReader reader = _db.GetFiles(featureSource, uid);
     while (reader.Read())
     {
         HtzFile file = new HtzFile
         {
             UID = uid,
             FeatureSource = featureSource,
             FeatureSourceId = (int)_db.GetFeatureSourceId(featureSource, false),
             ID = (long)reader["Id"],
             MapName = reader["MapName"].ToString(),
             FileName = reader["FileName"].ToString(),
             Description = reader["Description"].ToString()
         };
         file.UploadDate = ((DateTime)reader["UploadDate"]).ToString("dd/MM/yyyy");
         file.ProjectName = projectName;
         result.Add(file);
     }
     return result.ToArray();
 }