-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkerComission.cs
63 lines (51 loc) · 1.66 KB
/
WorkerComission.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Text;
namespace Csharp_labs
{
class WorkerComission : Worker
{
private uint totalSoldSum;
private readonly uint standardSalary;
private readonly double salaryRate;
public WorkerComission(string fcs, Sex sex, uint standardSalary, double salaryRate)
:base(ref fcs, sex)
{
if (standardSalary <= 0)
throw new Exception("ERROR\npayment == 0\n");
if (salaryRate < 0)
throw new Exception("ERROR\npaymentRate < 0\n");
this.standardSalary = standardSalary;
this.salaryRate = salaryRate;
}
public override void DoWork(uint value)
{
this.totalSoldSum += value * 100;
}
public override uint CalculateSalary()
{
uint priceSum = ((uint)Convert.ToInt32(Math.Round(this.standardSalary + (this.totalSoldSum * this.salaryRate))));
this.totalSoldSum = 0;
return priceSum;
}
public override string getClassType()
{
return "WorkerComission";
}
public override void ToJSON()
{
}
public override bool SaveToJsonFile(ref string filepath)
{
return true;
}
public new Dictionary<string, string> getWorkerInfo()
{
var info = base.getWorkerInfo();
info.Add("totalSoldSum", totalSoldSum.ToString());
info.Add("standardSalary", totalSoldSum.ToString());
info.Add("salaryRate", totalSoldSum.ToString());
return info;
}
}
}