public int conciliarCheques(ExtratoContaBancoDTO extrato) { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { int resultado = -1; NHibernateDAL <ExtratoContaBancoDTO> extratoDAL = new NHibernateDAL <ExtratoContaBancoDTO>(session); extrato.historico = "Cheque Compensado"; IList <ExtratoContaBancoDTO> listaCheques = extratoDAL.select(extrato); NHibernateDAL <ChequeDTO> chequeDAL = new NHibernateDAL <ChequeDTO>(session); foreach (ExtratoContaBancoDTO chequeExtrato in listaCheques) { ChequeDTO filtroCheque = new ChequeDTO { numero = int.Parse(chequeExtrato.documento) }; IList <ChequeDTO> listaChequeCompensado = chequeDAL.select(filtroCheque); chequeExtrato.conciliado = "N"; if (listaChequeCompensado.Count > 0) { chequeExtrato.conciliado = "S"; } } foreach (ExtratoContaBancoDTO extratoCheque in listaCheques) { extratoDAL.saveUpdate(extratoCheque); } resultado = 0; session.Flush(); return(resultado); } }
public int SaveCheque(ChequeDTO cheque) { _logger.LogInformation("New check : {cheque}", cheque); var reply = _dbConnection.Execute("save_cheques", cheque, commandType: CommandType.StoredProcedure); _logger.LogInformation("Reply : {reply}", reply); return(reply); }
public static Cheque ToModel(ChequeDTO chequeDTO) { return(new Cheque() { Guid = chequeDTO.Guid, Date = chequeDTO.Date, Money = chequeDTO.Money, CheckFlag = chequeDTO.CheckFlag, }); }
public int SaveCheque(ChequeDTO cheque) { _logger.LogInformation("New check : {cheque}", cheque); var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), cheque.Id.ToString() + ".txt"); File.WriteAllText(path, JsonConvert.SerializeObject(cheque)); var reply = 1; _logger.LogInformation("Reply : {reply}", reply); return(reply); }
private void StartMethod() { var chequeDTO = new ChequeDTO() { Guid = new Guid(), Date = DateTime.Now, Money = 300, CheckFlag = false, }; _sqlRepository.SetValueWithResult(chequeDTO); }
public (bool IsError, string Message) SetValueWithResult(ChequeDTO cheque) { _db = new DbDataContext(); try { _db.Add(ChequeDTOExtention.ToModel(cheque)); _db.SaveChanges(); return(false, ""); } catch (Exception ex) { return(true, ex.Source); } finally { _db?.Dispose(); } }
public int SendCheque(ChequeDTO cheque) { _logger.LogInformation("Send cheque"); return(_chequeRepository.SaveCheque(cheque)); }