-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileuploadthroughdomaincontext.txt
40 lines (35 loc) · 2.05 KB
/
fileuploadthroughdomaincontext.txt
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
if (validFile)
{
while (!file1.EndOfStream)
{
string[] splitLine = oneline.Split(delim);
_RefAdjImport.UBI = splitLine[0].Replace("\"", "");
_RefAdjImport.RetAccount = splitLine[1].Replace("\"", "");
_RefAdjImport.StandardPremium = Double.Parse(Regex.Replace(splitLine[2], "[^.0-9]", ""));
_RefAdjImport.Percent = Double.Parse(Regex.Replace(splitLine[3], "[^.0-9]", ""));
_RefAdjImport.Refund = Double.Parse(Regex.Replace(splitLine[4], "[^.0-9]", ""));
_RefAdjImport.Credit = Double.Parse(Regex.Replace(splitLine[5], "[^.0-9]", ""));
_RefAdjImport.RefAdjImportId = System.Guid.NewGuid();
_RefAdjImport.ProgramYear = Int16.Parse(progyear);
_RefAdjImport.MembershipType = membtype;
// add your newly populated entity to the collection
//_context.EntityContainer.GetEntitySet<FinancialRefundAdjustmentImport>().Add(_RefAdjImport);
_context.FinancialRefundAdjustmentImports.Add(_RefAdjImport);
//_context.SubmitChanges();
recordCount += 1;
oneline = file1.ReadLine();
int counts = _context.FinancialRefundAdjustmentImports.Count;
_RefAdjImport = null;
_RefAdjImport = new FinancialRefundAdjustmentImport();
}
}
else
{
MessageBox.Show("file is not formatted correctly"); // TODO: figure out correct verbage
return 0;
}
// write them to the database!
if (_context.HasChanges)
{
_context.SubmitChanges();
}