Fix selezione ordini WeekPlan

This commit is contained in:
Samuele Locatelli
2021-06-24 12:21:49 +02:00
parent 9cdece8482
commit 4082e2f1d2
2 changed files with 21 additions and 23 deletions
+8 -13
View File
@@ -68,6 +68,14 @@
}
}
protected void Edit(WeekPlanModel selRecord)
{
selRecordChanged.InvokeAsync(selRecord.WeekPlanId);
}
[Parameter]
public EventCallback<int> selRecordChanged { get; set; }
private WeekPlanModel _currRecord = null;
private WeekPlanModel currRecord
@@ -82,20 +90,7 @@
if (doReport)
{
_currRecord = value;
reportChange();
}
}
}
protected void Edit(WeekPlanModel selRecord)
{
currRecord = selRecord;
}
private void reportChange()
{
selRecordChanged.InvokeAsync(_currRecord.WeekPlanId);
}
[Parameter]
public EventCallback<int> selRecordChanged { get; set; }
}
+13 -10
View File
@@ -15,8 +15,8 @@ namespace GWMS.UI.Pages
{
#region Private Fields
private int _endHour = 21;
private int _startHour = 9;
private int _endHour = 22;
private int _startHour = 8;
private WeekPlanModel currRecord = null;
private List<WeekPlanModel> ListRecords;
private List<PlantDTO> PlantsList;
@@ -115,8 +115,7 @@ namespace GWMS.UI.Pages
if (_selSuppId != value)
{
_selSuppId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
checkHourRange();
}
}
}
@@ -129,8 +128,7 @@ namespace GWMS.UI.Pages
if (_selTraspId != value)
{
_selTraspId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
checkHourRange();
}
}
}
@@ -182,15 +180,20 @@ namespace GWMS.UI.Pages
#region Private Methods
private void checkHourRange()
{
int minHour = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
int maxHour = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
_startHour = _startHour < minHour ? _startHour : minHour;
_endHour = _endHour > maxHour ? _endHour : maxHour;
}
private async Task ReloadData()
{
isLoading = true;
ListRecords = await DataService.WeekPlanGet();
// calcolo min/max...
int minHour = ListRecords.OrderBy(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
int maxHour = ListRecords.OrderByDescending(x => x.DeliveryHour).FirstOrDefault().DeliveryHour;
startHour = startHour < minHour ? startHour : minHour;
endHour = endHour > maxHour ? endHour : maxHour;
checkHourRange();
isLoading = false;
}