public bool Check(Transacao transaction) { bool retorno = false; try { Transacao t = new Transacao(); string valorId = Identificador.GerarIdentificadorAutomatico(transaction.Type, transaction.Data.ToString("ddMMyyyy"), transaction.Amount,transaction.FitId.ToString()); t = Contexto.DBSetTransactions.FirstOrDefault(a => a.Identificador == valorId); if (t != null) { retorno = true; } return retorno; } catch (Exception) { throw; } }
public static List<Transacao> LerArquivoOFX(string url) { XElement doc = ImportacaoOFX.toXElement(url); DataSet d = new DataSet(); List<Transacao> listaTransacoes = new List<Transacao>(); var imps = (from c in doc.Descendants("STMTTRN") select new { Tipo = c.Element("TRNTYPE").Value, Amount = decimal.Parse(c.Element("TRNAMT").Value.Replace(",",".")), Data = DateTime.ParseExact(c.Element("DTPOSTED").Value, "yyyyMMdd", null), Description = c.Element("MEMO").Value, FitId = c.Element("FITID").Value }); var lista = imps.ToList(); foreach (var item in lista) { Transacao t = new Transacao(); if (item.Amount > 0) t.Type = "CREDIT"; else t.Type = "DEBIT"; t.Amount = item.Amount; t.FitId = Convert.ToInt64(item.FitId); t.Data = item.Data; t.Description = item.Description; listaTransacoes.Add(t); } return listaTransacoes; }
public void Save(Transacao transaction) { //TODO }