| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using Vbdsm.Common;
- namespace Vbdsm.Gen
- {
- public class TerminalData
- {
- public TerminalData()
- {
- CompanyId = "";
- TerminalId = "";
- }
- public TerminalData(string? companyId, string terminalId)
- {
- CompanyId = companyId;
- TerminalId = terminalId;
- }
- public string? CompanyId { get; set; }
- public string TerminalId { get; set; }
- public Dictionary<string, decimal> MonthTotal_P { get; set; } = new Dictionary<string, decimal>();
- public decimal Total_P { get; set; }
- public Dictionary<string, decimal> MonthTotal_E { get; set; } = new Dictionary<string, decimal>();
- public decimal Total_E { get; set; }
- private string Key => $"{DateTime.Now:yyyyMMdd}";
- public decimal GetCurMonthTotal_P()
- {
- if (!MonthTotal_P.TryGetValue(Key, out var d))
- {
- d = 0;
- }
- return d;
- }
- public decimal GetCurMonthTotal_E()
- {
- if (!MonthTotal_E.TryGetValue(Key, out var d))
- {
- d = 0;
- }
- return d;
- }
- public TerminalData SetTotal_P(decimal d)
- {
- Total_P = d;
- return this;
- }
- public TerminalData SetMouthTotal_P(decimal d)
- {
- if (MonthTotal_P.ContainsKey(Key))
- {
- MonthTotal_P.Remove(Key);
- }
- MonthTotal_P.Add(Key, d);
- return this;
- }
- public TerminalData SetTotal_E(decimal d)
- {
- Total_E = d;
- return this;
- }
- public TerminalData SetMouthTotal_E(decimal d)
- {
- if (MonthTotal_E.ContainsKey(Key))
- {
- MonthTotal_E.Remove(Key);
- }
- MonthTotal_E.Add(Key, d);
- return this;
- }
- public TerminalData Save()
- {
- FileHelper.SaveFileInfo(this, $"{CompanyId}@{TerminalId}");
- return this;
- }
- }
- }
|