-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileControlRecord.cs
64 lines (48 loc) · 1.8 KB
/
FileControlRecord.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
64
using Newtonsoft.Json;
namespace NACHAParser
{
public class FileControlRecord
{
#region Properties
[JsonProperty("fileControlId")]
public string FileControlId { get; set; } = string.Empty;
[JsonProperty("recType")]
public RecordType RecType { get; set; }
[JsonProperty("bchCnt")]
public string BchCnt { get; set; } = string.Empty;
[JsonProperty("blockCnt")]
public string BlockCnt { get; set; } = string.Empty;
[JsonProperty("entAddendaCnt")]
public string EntAddendaCnt { get; set; } = string.Empty;
[JsonProperty("entHash")]
public string EntHash { get; set; } = string.Empty;
[JsonProperty("totFileDrEntAmt")]
public string TotFileDrEntAmt { get; set; } = string.Empty;
[JsonProperty("totFileCrEntAmt")]
public string TotFileCrEntAmt { get; set; } = string.Empty;
[JsonProperty("reserved")]
public string Reserved { get; set; } = string.Empty;
#endregion
#region Constructors
public FileControlRecord()
{
FileControlId = Guid.NewGuid().ToString();
Console.WriteLine($"FileControlId: '{FileControlId}'");
}
#endregion
#region Methods
public FileControlRecord ParseFileControl(string line)
{
RecType = (RecordType)int.Parse(line.Substring(0, 1));
BchCnt = line.Substring(1, 6);
BlockCnt = line.Substring(7, 6);
EntAddendaCnt = line.Substring(13, 8);
EntHash = line.Substring(21, 10);
TotFileDrEntAmt = line.Substring(31, 12);
TotFileCrEntAmt = line.Substring(43, 12);
Reserved = line.Substring(55, 39).Trim();
return this;
}
#endregion
}
}