R1/R2 refactor
This commit is contained in:
@@ -179,18 +179,23 @@ public class T1R1Processor(
|
||||
controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
|
||||
db.SaveChanges();
|
||||
|
||||
UpdateReport();
|
||||
var sheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName")?.Desc1;
|
||||
if (sheetName == null)
|
||||
{
|
||||
throw new Exception("GoogleSheetName record not found");
|
||||
}
|
||||
|
||||
UpdateReport(processedLayer.Id, sheetName);
|
||||
}
|
||||
|
||||
private void UpdateReport()
|
||||
private void UpdateReport(Guid sourceId, string sheetName)
|
||||
{
|
||||
const string sheetId = "1pph-XowjlK5CIaCEV_A5buK4ceJ0Z0YoUlDI4VMkhhA";
|
||||
const string sheetName = "Raport_R1_Eksport";
|
||||
var request = googleSheetValues.Get(sheetId, $"{sheetName}!C4:CQ4");
|
||||
var response = request.Execute();
|
||||
|
||||
var r1 = db.Layers
|
||||
.Where(x => x.Number == 2286)
|
||||
.Where(x => x.Id == sourceId)
|
||||
.Include(x => x.Records)
|
||||
.FirstOrDefault();
|
||||
|
||||
|
||||
@@ -193,19 +193,28 @@ public class T4R2Processor(
|
||||
controller.SaveRecords(processedLayer.Id, newRecords, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
|
||||
db.SaveChanges();
|
||||
|
||||
UpdateReport();
|
||||
var reportSheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName")?.Desc1;
|
||||
if (reportSheetName == null)
|
||||
{
|
||||
throw new Exception("GoogleSheetName record not found");
|
||||
}
|
||||
|
||||
var invoicesSheetName = processWorker.Records?.SingleOrDefault(x => x.Code == "GoogleSheetName-Invoices")?.Desc1;
|
||||
if (invoicesSheetName == null)
|
||||
{
|
||||
throw new Exception("GoogleSheetName-Invoices record not found");
|
||||
}
|
||||
UpdateReport(processedLayer.Id, reportSheetName, invoicesSheetName);
|
||||
}
|
||||
|
||||
private void UpdateReport()
|
||||
private void UpdateReport(Guid sourceId, string reportSheetName, string invoicesSheetName)
|
||||
{
|
||||
const string sheetId = "1FsUmk_YRIeeGzFCX9tuUJCaLyRtjutX2ZGAEU1DMfJQ";
|
||||
const string reportSheetName = "Raport_R2_Sprzedaz";
|
||||
const string invoicesSheetName = "Raport_R2_Faktury";
|
||||
var request = googleSheetValues.Get(sheetId, "C4:Z4");
|
||||
var response = request.Execute();
|
||||
|
||||
var r2 = db.Layers
|
||||
.Where(x => x.Number == 1501)
|
||||
.Where(x => x.Id == sourceId)
|
||||
.Include(x => x.Records)
|
||||
.FirstOrDefault();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user