Db0068: Killing salary payouts
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Swarmops.Database
|
||||
/// <summary>
|
||||
/// This is the IN-CODE revision of the database. The version we expect to be running against.
|
||||
/// </summary>
|
||||
public static int DbVersionExpected => 67;
|
||||
public static int DbVersionExpected => 68;
|
||||
|
||||
|
||||
// This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti.
|
||||
|
||||
@@ -184,17 +184,33 @@ namespace Swarmops.Database
|
||||
}
|
||||
|
||||
|
||||
public void SetSalaryAttested (int salaryId, bool attested)
|
||||
public void SetSalaryAttested(int salaryId, bool attested)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand ("SetSalaryAttested", connection);
|
||||
DbCommand command = GetDbCommand("SetSalaryAttested", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName (command, "salaryId", salaryId);
|
||||
AddParameterWithName (command, "attested", attested);
|
||||
AddParameterWithName(command, "salaryId", salaryId);
|
||||
AddParameterWithName(command, "attested", attested);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSalaryOpen(int salaryId, bool attested)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand("SetSalaryOpen", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName(command, "salaryId", salaryId);
|
||||
AddParameterWithName(command, "open", attested);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
@@ -63,5 +63,6 @@
|
||||
0063 - Added DeriveUnique to HotBitcoinAddresses for ability to create unique HBAs [RF]
|
||||
0064 - Quick fix for OutboundInvoices (how did this error happen?) [RF]
|
||||
0065 - Dumb fix for 0062 (or rather, the error was dumb) [RF]
|
||||
0066 - Added OrganizationSequenceId to CashAdvances, ExpenseClaims
|
||||
0067 - Bugfix for 0066
|
||||
0066 - Added OrganizationSequenceId to CashAdvances, ExpenseClaims [RF]
|
||||
0067 - Bugfix for 0066 [RF]
|
||||
0068 - Added SetSalaryOpen [RF]
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
DROP PROCEDURE IF EXISTS `SetSalaryOpen`
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
CREATE PROCEDURE `SetSalaryOpen`(
|
||||
IN salaryId INTEGER,
|
||||
IN open BOOLEAN
|
||||
)
|
||||
BEGIN
|
||||
|
||||
UPDATE Salaries SET Salaries.Open=open
|
||||
WHERE Salaries.SalaryId=salaryId;
|
||||
|
||||
END
|
||||
@@ -125,26 +125,55 @@ namespace Swarmops.Logic.Financial
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Open
|
||||
{
|
||||
get { return base.Open; }
|
||||
set
|
||||
{
|
||||
if (base.Open != value)
|
||||
{
|
||||
SwarmDb.GetDatabaseForWriting().SetSalaryOpen(Identity, value);
|
||||
base.Open = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Attested
|
||||
{
|
||||
get { return base.Attested; }
|
||||
set
|
||||
{
|
||||
if (base.Attested != value)
|
||||
{
|
||||
SwarmDb.GetDatabaseForWriting().SetSalaryAttested(Identity, value);
|
||||
base.Attested = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region IAttestable Members
|
||||
|
||||
public void Attest (Person attester)
|
||||
{
|
||||
SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Attestation,
|
||||
FinancialDependencyType.Salary, Identity, DateTime.Now, attester.Identity, CostTotalCents/100.0);
|
||||
SwarmDb.GetDatabaseForWriting().SetSalaryAttested (Identity, true);
|
||||
this.Attested = true;
|
||||
}
|
||||
|
||||
public void Deattest (Person deattester)
|
||||
{
|
||||
SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Deattestation,
|
||||
FinancialDependencyType.Salary, Identity, DateTime.Now, deattester.Identity, CostTotalCents/100.0);
|
||||
SwarmDb.GetDatabaseForWriting().SetSalaryAttested (Identity, false);
|
||||
this.Attested = false;
|
||||
}
|
||||
|
||||
public void DenyAttestation (Person denyingPerson, string reason)
|
||||
{
|
||||
Attested = false;
|
||||
Open = false;
|
||||
this.Attested = false;
|
||||
this.Open = false;
|
||||
|
||||
SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Kill,
|
||||
FinancialDependencyType.ExpenseClaim, Identity,
|
||||
|
||||
Reference in New Issue
Block a user