Converted Session to Stateless Session in the ManagementBI as State Session

would randomly give a stale state error.
Fixed numerous bugs in the ManagementBI. Needs testing, but should be working now.
This commit is contained in:
tanshu
2016-04-21 17:25:14 +05:30
parent 57f3f7e08d
commit 5124347d1b
2 changed files with 311 additions and 160 deletions

View File

@ -85,20 +85,6 @@ namespace Tanshu.Accounts.Management
bwGo.ReportProgress(++count, "Starting on " + startDate.ToShortDateString() + " to " + finishDate.ToShortDateString());
using (var bi = new ManagementBI())
{
bi.DeleteVoid(sDate, fDate);
bwGo.ReportProgress(++count, "Voids Deleted");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bi.MoveStaffToNc(sDate, fDate);
bwGo.ReportProgress(++count, "Staff Moved");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bi.ClearModifiers(sDate, fDate);
bwGo.ReportProgress(++count, "Modifiers Cleared");
if (bwGo.CancellationPending == true)
@ -106,6 +92,27 @@ namespace Tanshu.Accounts.Management
e.Cancel = true;
return;
}
bi.DeleteTobacco(sDate, fDate);
bwGo.ReportProgress(++count, "Tobacco Deleted");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bi.DeleteReprints(sDate, fDate);
bwGo.ReportProgress(++count, "Reprints Deleted");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bi.DeleteVoid(sDate, fDate);
bwGo.ReportProgress(++count, "Voids Deleted");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bi.CombineKots(sDate, fDate);
bwGo.ReportProgress(++count, "Kots Combined");
if (bwGo.CancellationPending == true)
@ -120,6 +127,13 @@ namespace Tanshu.Accounts.Management
e.Cancel = true;
return;
}
bi.MoveStaffToNc(sDate, fDate);
bwGo.ReportProgress(++count, "Staff Moved");
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
bwGo.ReportProgress(++count, "Starting beer");
foreach (var beerDate in beer)
{
@ -140,12 +154,15 @@ namespace Tanshu.Accounts.Management
e.Cancel = true;
return;
}
bi.MoveToNc(sDate, fDate, item.Sale.Where(x => x.IsLiq).Sum(x => x.Amount) / .75M); // Do not put all in NC this will allow for about 25% discount on the rest of non nc liqour
bwGo.ReportProgress(++count, "Moved to Nc");
if (bwGo.CancellationPending == true)
foreach (var saleItem in item.Sale.Where(x => x.IsLiq))
{
e.Cancel = true;
return;
bi.LiqNcSwap(saleItem.Rate, saleItem.Amount, sDate, fDate);
bwGo.ReportProgress(++count, "Liq NC Swap " + saleItem.Rate.ToString());
if (bwGo.CancellationPending == true)
{
e.Cancel = true;
return;
}
}
IList<CreditJson> creditJ = credit.Where(x => x.Date >= startDate && x.Date <= finishDate).ToList();
bi.SetQuantityAndDiscount(item.Sale, creditJ, startDate, finishDate);