public static bool Delete(ReportFornecedores Cambio) { try { DB.ReportFornecedores.DeleteOne(x => x.Id == Cambio.Id); return(true); } catch (Exception e) { throw new Exception("Erro delete ReportFornecedores :" + e.ToString()); } }
public static bool Insert(ReportFornecedores cambio) { try { DeleteByProjecto(cambio.ProjectoId, cambio.FornecedorId); DB.ReportFornecedores.InsertOne(cambio); return(true); } catch (Exception e) { throw new Exception("Erro Inserir ReportFornecedores" + e.ToString()); } }
public static bool Insert(string _FornecedorId, string _FornecedorName, string FornecedorNameCliente, string _NomeFile, string Nomeorcamento, string _ProjectoId, string _OrcamentoId, List <Servicos> _servicos, double _Total, bool _ative, string _TipoMovimento, int Ano) { try { ReportFornecedores cntr = new ReportFornecedores(_FornecedorId, _FornecedorName, FornecedorNameCliente, _NomeFile, Nomeorcamento, _ProjectoId, _OrcamentoId, _servicos, _Total, _ative, _TipoMovimento, Ano); DB.ReportFornecedores.InsertOne(cntr); return(true); } catch (Exception e) { throw new Exception("Erro Inserir ReportFornecedores" + e.ToString()); } }
public static bool Update(JObject ReportFornecedores) { try { ObjectId otalId = ObjectId.Parse(ReportFornecedores.GetValue("_id").ToString()); ReportFornecedores aux = ReportFornecedores.ToObject <ReportFornecedores>(); aux.Id = otalId; DB.ReportFornecedores.ReplaceOne(x => x.Id == aux.Id, aux); return(true); } catch (Exception e) { throw new Exception("Erro Update ReportFornecedores :" + e.ToString()); } }