Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validação de data do Nó <DTSERVER> #3

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 22 additions & 69 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand All @@ -7,21 +14,11 @@
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
node_modules/
pub/
x64/
build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
Expand All @@ -37,24 +34,17 @@ build/
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

*.exe

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
Expand All @@ -65,21 +55,14 @@ ipch/
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/
# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
Expand All @@ -92,14 +75,13 @@ DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
packages

# Windows Azure Build Output
csx
Expand All @@ -109,50 +91,21 @@ csx
AppPackages/

# Others
#sql/
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin/
ClientBin
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store
/.vs/OfxSharp/v15/Server/sqlite3
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Travis CI Integration

language: c

install:
- sudo apt-get install mono-devel mono-gmcs nunit-console
- curl -O --location https://www.nuget.org/nuget.exe
- curl -O --location https://dl.dropbox.com/u/103746479/Microsoft.Build.dll
- mozroots --import --sync
script:
- mono --runtime=v4.0.30319 nuget.exe restore
- xbuild OfxSharp.sln
- nunit-console Tests/bin/Debug/OfxSharp.Tests.dll
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Afonso França, Antônio Milesi Bastos, James Hollingworth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 20 additions & 21 deletions source/OFXSharp/Account.cs → Lib/Account.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
using OFXSharp;
using System;
using System.Xml;

namespace OFXSharp
namespace OfxSharpLib
{
public class Account
{
public string AccountID { get; set; }
public string AccountId { get; set; }
public string AccountKey { get; set; }
public AccountType AccountType { get; set; }

#region Bank Only

private BankAccountType _BankAccountType = BankAccountType.NA;
private BankAccountType _bankAccountType = BankAccountType.NA;

public string BankID { get; set; }
public string BankId { get; set; }

public string BranchID { get; set; }
public string BranchId { get; set; }


public BankAccountType BankAccountType
{
get
{
if (AccountType == AccountType.BANK)
return _BankAccountType;
if (AccountType == AccountType.Bank)
return _bankAccountType;

return BankAccountType.NA;
}
set
{
_BankAccountType = AccountType == AccountType.BANK ? value : BankAccountType.NA;
_bankAccountType = AccountType == AccountType.Bank ? value : BankAccountType.NA;
}
}

Expand All @@ -39,22 +40,20 @@ public Account(XmlNode node, AccountType type)
{
AccountType = type;

AccountID = node.GetValue("//ACCTID");
AccountId = node.GetValue("//ACCTID");
AccountKey = node.GetValue("//ACCTKEY");

switch (AccountType)
{
case AccountType.BANK:
case AccountType.Bank:
InitializeBank(node);
break;
case AccountType.AP:
case AccountType.Ap:
InitializeAP(node);
break;
case AccountType.AR:
case AccountType.Ar:
InitializeAR(node);
break;
default:
break;
}
}

Expand All @@ -63,30 +62,30 @@ public Account(XmlNode node, AccountType type)
/// </summary>
private void InitializeBank(XmlNode node)
{
BankID = node.GetValue("//BANKID");
BranchID = node.GetValue("//BRANCHID");
BankId = node.GetValue("//BANKID");
BranchId = node.GetValue("//BRANCHID");

//Get Bank Account Type from XML
//Get Bank Account Type from XML
string bankAccountType = node.GetValue("//ACCTTYPE");

//Check that it has been set
if (String.IsNullOrEmpty(bankAccountType))
throw new OFXParseException("Bank Account type unknown");
throw new OfxParseException("Bank Account type unknown");

//Set bank account enum
_BankAccountType = bankAccountType.GetBankAccountType();
_bankAccountType = bankAccountType.GetBankAccountType();
}

#region Account types not supported

private void InitializeAP(XmlNode node)
{
throw new OFXParseException("AP Account type not supported");
throw new OfxParseException("AP Account type not supported");
}

private void InitializeAR(XmlNode node)
{
throw new OFXParseException("AR Account type not supported");
throw new OfxParseException("AR Account type not supported");
}

#endregion
Expand Down
12 changes: 6 additions & 6 deletions source/OFXSharp/AccountType.cs → Lib/AccountType.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System.ComponentModel;

namespace OFXSharp
namespace OfxSharpLib
{
public enum AccountType
{
[Description("Bank Account")]
BANK,
Bank,
[Description("Credit Card")]
CC,
Cc,
[Description("Accounts Payable")]
AP,
Ap,
[Description("Accounts Recievable")]
AR,
NA,
Ar,
Na,
}
}
7 changes: 4 additions & 3 deletions source/OFXSharp/Balance.cs → Lib/Balance.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using OFXSharp;
using System;
using System.Globalization;
using System.Xml;

namespace OFXSharp
namespace OfxSharpLib
{
public class Balance
{
Expand Down Expand Up @@ -31,7 +32,7 @@ public Balance(XmlNode ledgerNode, XmlNode avaliableNode)
}
else
{
throw new OFXParseException("Ledger balance has not been set");
throw new OfxParseException("Ledger balance has not been set");
}

// ***** OFX files from my bank don't have the 'avaliableNode' node, so i manage a null situation
Expand All @@ -56,7 +57,7 @@ public Balance(XmlNode ledgerNode, XmlNode avaliableNode)
}
else
{
throw new OFXParseException("Avaliable balance has not been set");
throw new OfxParseException("Avaliable balance has not been set");
}
AvaliableBalanceDate = avaliableNode.GetValue("//DTASOF").ToDate();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;

namespace OFXSharp
namespace OfxSharpLib
{
public enum BankAccountType
{
Expand Down
Loading