Fix vari
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@using System.Globalization
|
||||
@using System.Text.RegularExpressions
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@@ -203,6 +204,8 @@
|
||||
ActivityModel = ActivityCopied.Clone();
|
||||
}
|
||||
|
||||
await LoadCommesse();
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
|
||||
@@ -255,7 +258,6 @@
|
||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
Pros = await ManageData.GetTable<PtbPros>();
|
||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
await LoadCommesse();
|
||||
}
|
||||
|
||||
private async Task LoadCommesse() =>
|
||||
@@ -281,31 +283,19 @@
|
||||
|
||||
private async Task OnClienteChanged()
|
||||
{
|
||||
string? codAnag = null;
|
||||
ActivityModel.CodJcom = null;
|
||||
|
||||
var cliente = Clienti.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
if (cliente is null)
|
||||
{
|
||||
var pros = Pros.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
if (ActivityModel.Cliente.IsNullOrEmpty()) return;
|
||||
|
||||
if (pros is not null)
|
||||
{
|
||||
codAnag = pros.CodAnag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
codAnag = cliente.CodAnag;
|
||||
}
|
||||
var match = Regex.Match(ActivityModel.Cliente!, @"^\s*(\S+)\s*-\s*(.*)$");
|
||||
if (!match.Success)
|
||||
return;
|
||||
|
||||
ActivityModel.CodAnag = match.Groups[1].Value;
|
||||
ActivityModel.Cliente = match.Groups[2].Value;
|
||||
|
||||
if (codAnag is not null)
|
||||
{
|
||||
ActivityModel.CodAnag = codAnag;
|
||||
await LoadCommesse();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
await LoadCommesse();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private async Task OnCommessaChanged()
|
||||
@@ -320,6 +310,11 @@
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
||||
}
|
||||
|
||||
if (ActivityModel.EstimatedEndtime <= ActivityModel.EstimatedTime)
|
||||
{
|
||||
ActivityModel.EstimatedEndtime = ActivityModel.EstimatedTime.Value.AddHours(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
|
||||
Reference in New Issue
Block a user