Skip to content

Commit

Permalink
* Changed sync logic to prevent addition of new transaction type from…
Browse files Browse the repository at this point in the history
… affecting application.

* Now application will show Item Sales Count instead of Total Sales Count to avoid confusion.
  • Loading branch information
ravibpatel committed Jun 11, 2018
1 parent 05255de commit 0eb04c9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sales Manager/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sales Manager/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ private void dateTimePicker_ValueChanged(object sender, EventArgs e)
int count = 0;
foreach (var transaction in transactions)
{
if (transaction.ReceivedAmount >= 0 && !transaction.Product.ID.Equals(2))
if (transaction.ReceivedAmount > 0 && !transaction.Product.ID.Equals(2))
{
if (cancelledTransactions.ContainsKey(transaction.OrderID + transaction.Product.ID))
{
Expand Down
8 changes: 4 additions & 4 deletions Sales Manager/Sales Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<AssemblyOriginatorKeyFile>Sales Manager.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdater.NET, Version=1.4.9.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.4.9\lib\net452\AutoUpdater.NET.dll</HintPath>
<Reference Include="AutoUpdater.NET, Version=1.4.10.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.4.10\lib\net452\AutoUpdater.NET.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=2.0.1.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.2.0.1\lib\net452\Costura.dll</HintPath>
Expand Down Expand Up @@ -299,11 +299,11 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SQLite.3.13.0\build\net45\SQLite.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLite.3.13.0\build\net45\SQLite.props'))" />
<Error Condition="!Exists('..\packages\Fody.3.0.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.0.3\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.3.0.4\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.0.4\build\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.3.0.3\build\Fody.targets" Condition="Exists('..\packages\Fody.3.0.3\build\Fody.targets')" />
<Import Project="..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.2.0.1\build\Costura.Fody.targets')" />
<Import Project="..\packages\Fody.3.0.4\build\Fody.targets" Condition="Exists('..\packages\Fody.3.0.4\build\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
13 changes: 10 additions & 3 deletions Sales Manager/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ private void GetPartnerShare()

public static bool GetSales(DateTime fromDate, DateTime toDate, Account account, BackgroundWorker backgroundWorker)
{
String[] transactionTypes = {
"Author Fee",
"Author Fee Reversal",
"Author Fee Refund",
"Sale",
"Sale Reversal",
"Sale Refund",
"Referral Cut"
};
List<Transaction> transactions = new List<Transaction>();
JArray jOrderInfoArray = new JArray();
var i = 0;
Expand Down Expand Up @@ -140,9 +149,7 @@ public static bool GetSales(DateTime fromDate, DateTime toDate, Account account,
{
var jToken = jOrderInfoArray[count];
var type = jToken["type"].ToString();
if (type.Equals("Withdrawal Request") || type.Equals("Skrill Fee") || type.Equals("Refund") || type.Equals("Payout") ||
type.Equals("Withdrawal Cancellation") || type.Equals("Skrill Fee Reversal") ||
type.Equals("Purchase") || type.Equals("Agreement Change") || type.Equals("Manual Adjustment") || type.Equals("Withdrawal Rejection"))
if (!transactionTypes.Contains(type))
{
backgroundWorker.ReportProgress(count + 1, jOrderInfoArray.Count, 1);
continue;
Expand Down
4 changes: 2 additions & 2 deletions Sales Manager/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autoupdater.NET.Official" version="1.4.9" targetFramework="net452" />
<package id="Autoupdater.NET.Official" version="1.4.10" targetFramework="net452" />
<package id="Costura.Fody" version="2.0.1" targetFramework="net452" developmentDependency="true" />
<package id="Fody" version="3.0.3" targetFramework="net452" developmentDependency="true" />
<package id="Fody" version="3.0.4" targetFramework="net452" developmentDependency="true" />
<package id="Ix-Async" version="1.2.5" targetFramework="net452" />
<package id="Microsoft.Data.Sqlite" version="1.1.1" targetFramework="net452" />
<package id="Microsoft.EntityFrameworkCore" version="1.1.2" targetFramework="net452" />
Expand Down

0 comments on commit 0eb04c9

Please sign in to comment.