Exemple #1
0
 public static bool Delete(Ficheiros Estado)
 {
     try
     {
         DB.Orcamentos.DeleteOne(x => x.Id == Estado.Id);
         return(true);
     }
     catch (Exception e)
     {
         throw new Exception("Erro delete Ficheiros :" + e.ToString());
     }
 }
Exemple #2
0
 public static bool Update(Ficheiros fich)
 {
     try
     {
         DB.Ficheiros.ReplaceOne(c => c.Id == fich.Id, fich);
         return(true);
     }
     catch (Exception e)
     {
         throw new Exception("Erro Update Ficheiros :" + e.ToString());
     }
 }
Exemple #3
0
        public static bool Insert(string Namefile, string Filepath, DateTime DataCriacao, string projectoID, string orcamentoID, int TipoFicheiro)
        {
            try
            {
                Ficheiros cntr = new Ficheiros(Namefile, Filepath, DataCriacao, projectoID, orcamentoID, TipoFicheiro);
                DB.Ficheiros.InsertOne(cntr);

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Ficheiros" + e.ToString());
            }
        }
Exemple #4
0
        public static bool Insert(Ficheiros proj, out string id)
        {
            try
            {
                proj.Id = ObjectId.GenerateNewId();

                DB.Ficheiros.InsertOne(proj);
                id = proj.Id.ToString();

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Ficheiros : " + e.ToString());
            }
        }
Exemple #5
0
        public static Ficheiros download(string id)
        {
            try
            {
                Ficheiros lista  = new Ficheiros();
                ObjectId  neid   = new ObjectId(id);
                var       filter = Builders <Ficheiros> .Filter.Where(x => x.Id == neid);

                lista = DB.Ficheiros.Find(filter).FirstOrDefault();

                return(lista);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Ficheiros : " + e.ToString());
            }
        }