refactoring

This commit is contained in:
Meik
2025-11-13 19:04:07 +01:00
parent 7fca608a78
commit 4475997a59

View File

@@ -39,7 +39,7 @@ namespace FasdDesktopUi.Basics.UserControls
DisplayName = cMultiLanguageSupport.GetItem("Header.Create.Ticket"), DisplayName = cMultiLanguageSupport.GetItem("Header.Create.Ticket"),
Type = enumF4sdSearchResultClass.Ticket, Type = enumF4sdSearchResultClass.Ticket,
Identities = null, Identities = null,
Infos = new Dictionary<string, string> { ["Special"] = "TicketCreation" } Infos = new Dictionary<string, string> { [TicketInfoKeys.Special] = TicketSpecialValues.TicketCreation }
}; };
private readonly cF4sdApiSearchResultRelation _selectTicketRelation = new cF4sdApiSearchResultRelation() private readonly cF4sdApiSearchResultRelation _selectTicketRelation = new cF4sdApiSearchResultRelation()
@@ -48,7 +48,7 @@ namespace FasdDesktopUi.Basics.UserControls
DisplayName = cMultiLanguageSupport.GetItem("Header.Select.Ticket"), DisplayName = cMultiLanguageSupport.GetItem("Header.Select.Ticket"),
Type = enumF4sdSearchResultClass.Ticket, Type = enumF4sdSearchResultClass.Ticket,
Identities = null, Identities = null,
Infos = new Dictionary<string, string> { ["Special"] = "TicketSelect" } Infos = new Dictionary<string, string> { [TicketInfoKeys.Special] = TicketSpecialValues.TicketSelect }
}; };
private readonly cF4sdApiSearchResultRelation _noTicketRelation = new cF4sdApiSearchResultRelation() private readonly cF4sdApiSearchResultRelation _noTicketRelation = new cF4sdApiSearchResultRelation()
@@ -56,7 +56,7 @@ namespace FasdDesktopUi.Basics.UserControls
DisplayName = cMultiLanguageSupport.GetItem("Header.Skip.Ticket"), DisplayName = cMultiLanguageSupport.GetItem("Header.Skip.Ticket"),
Type = enumF4sdSearchResultClass.Ticket, Type = enumF4sdSearchResultClass.Ticket,
Identities = null, Identities = null,
Infos = new Dictionary<string, string> { ["Special"] = "NoTicket" } Infos = new Dictionary<string, string> { [TicketInfoKeys.Special] = TicketSpecialValues.NoTicket }
}; };
private readonly cF4sdApiSearchResultRelation _removeAffectedAssetEntry = new cF4sdApiSearchResultRelation() private readonly cF4sdApiSearchResultRelation _removeAffectedAssetEntry = new cF4sdApiSearchResultRelation()
@@ -64,7 +64,7 @@ namespace FasdDesktopUi.Basics.UserControls
DisplayName = cMultiLanguageSupport.GetItem("Dialog.CloseCase.RemoveAffectedAssetEntry"), DisplayName = cMultiLanguageSupport.GetItem("Dialog.CloseCase.RemoveAffectedAssetEntry"),
Type = enumF4sdSearchResultClass.Computer, Type = enumF4sdSearchResultClass.Computer,
Identities = null, Identities = null,
Infos = new Dictionary<string, string> { ["Special"] = "RemoveAffectedAssetEntry" } Infos = new Dictionary<string, string> { [TicketInfoKeys.Special] = TicketSpecialValues.RemoveAffectedAssetEntry }
}; };
private const string CategoryTableNamePrimary = "M42Wpm-Ticket-Categories"; private const string CategoryTableNamePrimary = "M42Wpm-Ticket-Categories";
@@ -102,13 +102,73 @@ namespace FasdDesktopUi.Basics.UserControls
public bool AreCaseNotesMandatory => public bool AreCaseNotesMandatory =>
cFasdCockpitConfig.Instance?.Global?.TicketConfiguration?.NotesMandatory ?? false; cFasdCockpitConfig.Instance?.Global?.TicketConfiguration?.NotesMandatory ?? false;
private static class TicketInfoKeys
{
public const string ActivityType = "ActivityType";
public const string Asset = "Asset";
public const string ServiceId = "ServiceId";
public const string ServiceName = "ServiceName";
public const string StatusId = "StatusId";
public const string CategoryId = "CategoryId";
public const string Summary = "Summary";
public const string Special = "Special";
}
private static class TicketInfoValues
{
public const string ActivityTypeTicket = "SPSActivityTypeTicket";
}
private static class TicketSpecialValues
{
public const string TicketCreation = "TicketCreation";
public const string TicketSelect = "TicketSelect";
public const string NoTicket = "NoTicket";
public const string RemoveAffectedAssetEntry = "RemoveAffectedAssetEntry";
public const string RemoveAffectedServiceEntry = "RemoveAffectedServiceEntry";
}
private static class ValidationPropertyNames
{
public const string SelectedTicket = nameof(SelectedTicket);
public const string SelectedCategory = nameof(SelectedCategory);
public const string QuickTicketSelection = nameof(QuickTicketSelection);
public const string TicketSummaryTextBox = nameof(TicketSummaryTextBox);
public const string TicketStatusCombobox = nameof(TicketStatusCombobox);
public const string CaseNotesPreview = nameof(CaseNotesPreview);
public const string SolutionTextbox = "SolutionTextbox";
public const string ErrorTypeValue = "ErrorTypeValue";
public const string ReminderDate = "ReminderDate";
public const string HoldComment = "HoldComment";
public const string SelectedRoleAndPerson = "SelectedRoleAndPerson";
public const string ForwardComment = "ForwardComment";
}
private bool TryGetSelectedTicketInfo(string key, out string value)
{
value = null;
return SelectedTicket?.Infos != null && SelectedTicket.Infos.TryGetValue(key, out value);
}
private string GetSelectedTicketInfoOrDefault(string key) =>
TryGetSelectedTicketInfo(key, out var value) ? value : null;
private static bool TryGetSpecialValue(cF4sdApiSearchResultRelation relation, out string specialValue)
{
specialValue = null;
return relation?.Infos != null && relation.Infos.TryGetValue(TicketInfoKeys.Special, out specialValue);
}
private static bool RelationHasSpecialInfo(cF4sdApiSearchResultRelation relation, string expectedSpecialValue) =>
TryGetSpecialValue(relation, out var specialValue) &&
string.Equals(specialValue, expectedSpecialValue, StringComparison.OrdinalIgnoreCase);
public bool IsTicket public bool IsTicket
{ {
get get
{ {
var activityType = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ActivityType").Value; return TryGetSelectedTicketInfo(TicketInfoKeys.ActivityType, out var activityType)
var isTicket = string.Equals(activityType, "SPSActivityTypeTicket", StringComparison.InvariantCultureIgnoreCase); && string.Equals(activityType, TicketInfoValues.ActivityTypeTicket, StringComparison.OrdinalIgnoreCase);
return isTicket;
} }
} }
@@ -172,15 +232,12 @@ namespace FasdDesktopUi.Basics.UserControls
UpdateAffectedServiceLabel(); UpdateAffectedServiceLabel();
UpdateAffectedAssetComboBox(); UpdateAffectedAssetComboBox();
ShowAssetWarningTicketAction = IsTicket; ShowAssetWarningTicketAction = IsTicket;
ValidateProperty("SelectedTicket"); ValidateProperty(ValidationPropertyNames.SelectedTicket);
EnableHoldTicketAction = _selectedTicket == null || SelectedTicket == _selectTicketRelation || selectedTicketIsNewTicket; EnableHoldTicketAction = _selectedTicket == null || SelectedTicket == _selectTicketRelation || selectedTicketIsNewTicket;
if (_selectedTicket != null && _selectedTicket.Infos.TryGetValue("StatusId", out var statusIdString)) if (TryGetSelectedTicketInfo(TicketInfoKeys.StatusId, out var statusIdString) &&
Enum.TryParse(statusIdString, true, out enumTicketStatus statusId))
{ {
object parsedStatusId = Enum.Parse(typeof(enumTicketStatus), statusIdString); EnableHoldTicketAction = statusId != enumTicketStatus.OnHold;
if (parsedStatusId is enumTicketStatus statusId)
{
EnableHoldTicketAction = statusId != enumTicketStatus.OnHold;
}
} }
TrySelectTicketCategoryFromTicketInfos(); TrySelectTicketCategoryFromTicketInfos();
} }
@@ -259,7 +316,7 @@ namespace FasdDesktopUi.Basics.UserControls
if (d is CloseCaseDialogWithTicket instance) if (d is CloseCaseDialogWithTicket instance)
{ {
instance.LogSelectedCategoryChanged(e.NewValue as HierarchicalSelectionItem); instance.LogSelectedCategoryChanged(e.NewValue as HierarchicalSelectionItem);
instance.ValidateProperty("SelectedCategory"); instance.ValidateProperty(ValidationPropertyNames.SelectedCategory);
} }
} }
@@ -338,7 +395,7 @@ namespace FasdDesktopUi.Basics.UserControls
set set
{ {
_newTicketPillSelected = value; _newTicketPillSelected = value;
ValidateProperty("SelectedTicket"); ValidateProperty(ValidationPropertyNames.SelectedTicket);
} }
} }
@@ -433,8 +490,8 @@ namespace FasdDesktopUi.Basics.UserControls
me.UpdateTicketComponentVisibility(); me.UpdateTicketComponentVisibility();
await me.InitializeCategorySelectionAsync(); await me.InitializeCategorySelectionAsync();
await me.UpdateQuickCallsComboBoxAsync(); await me.UpdateQuickCallsComboBoxAsync();
me.ValidateProperty("SelectedCategory"); me.ValidateProperty(ValidationPropertyNames.SelectedCategory);
me.ValidateProperty("QuickTicketSelection"); me.ValidateProperty(ValidationPropertyNames.QuickTicketSelection);
} }
catch (Exception E) catch (Exception E)
{ {
@@ -481,11 +538,11 @@ namespace FasdDesktopUi.Basics.UserControls
parentWindow.SetButtonStateYes(false, "Initial gesperrt."); parentWindow.SetButtonStateYes(false, "Initial gesperrt.");
parentWindow.SetButtonStateNo(true, cMultiLanguageSupport.GetItem("Dialog.CloseCase.Cancel")); parentWindow.SetButtonStateNo(true, cMultiLanguageSupport.GetItem("Dialog.CloseCase.Cancel"));
ValidateProperty("TicketSummaryTextBox"); ValidateProperty(ValidationPropertyNames.TicketSummaryTextBox);
ValidateProperty("TicketStatusCombobox"); ValidateProperty(ValidationPropertyNames.TicketStatusCombobox);
ValidateProperty("CaseNotesPreview"); ValidateProperty(ValidationPropertyNames.CaseNotesPreview);
ValidateProperty("SelectedCategory"); ValidateProperty(ValidationPropertyNames.SelectedCategory);
ValidateProperty("QuickTicketSelection"); ValidateProperty(ValidationPropertyNames.QuickTicketSelection);
} }
private void CloseCaseDialogWithTicket_Unloaded(object sender, RoutedEventArgs e) private void CloseCaseDialogWithTicket_Unloaded(object sender, RoutedEventArgs e)
{ {
@@ -524,7 +581,7 @@ namespace FasdDesktopUi.Basics.UserControls
private void UpdateAffectedAssetLabel() private void UpdateAffectedAssetLabel()
{ {
var computerName = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "Asset").Value; var computerName = GetSelectedTicketInfoOrDefault(TicketInfoKeys.Asset);
var binding = new Binding var binding = new Binding
{ {
@@ -536,7 +593,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
private void UpdateAffectedServiceLabel() private void UpdateAffectedServiceLabel()
{ {
var serviceId = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ServiceId").Value; var serviceId = GetSelectedTicketInfoOrDefault(TicketInfoKeys.ServiceId);
var binding = new Binding var binding = new Binding
{ {
@@ -592,14 +649,15 @@ namespace FasdDesktopUi.Basics.UserControls
AdaptableIcon.AdaptableIcon ticketIcon = new AdaptableIcon.AdaptableIcon() { SelectedInternIcon = enumInternIcons.f4sd_outline }; AdaptableIcon.AdaptableIcon ticketIcon = new AdaptableIcon.AdaptableIcon() { SelectedInternIcon = enumInternIcons.f4sd_outline };
if (ticketRelation.Infos.TryGetValue("Special", out string specialInfo)) if (RelationHasSpecialInfo(ticketRelation, TicketSpecialValues.TicketCreation))
{ {
if (specialInfo.Equals("TicketCreation", StringComparison.InvariantCultureIgnoreCase)) ticketIcon.SelectedInternIcon = enumInternIcons.misc_plus;
ticketIcon.SelectedInternIcon = enumInternIcons.misc_plus;
else if (specialInfo.Equals("NoTicket", StringComparison.InvariantCultureIgnoreCase))
ticketIcon.SelectedMaterialIcon = MaterialIconType.ic_block;
} }
else if (ticketRelation.Infos.TryGetValue("StatusId", out string ticketStatusId)) else if (RelationHasSpecialInfo(ticketRelation, TicketSpecialValues.NoTicket))
{
ticketIcon.SelectedMaterialIcon = MaterialIconType.ic_block;
}
else if (ticketRelation.Infos.TryGetValue(TicketInfoKeys.StatusId, out string ticketStatusId))
{ {
Enum.TryParse(ticketStatusId, true, out enumTicketStatus ticketStatus); Enum.TryParse(ticketStatusId, true, out enumTicketStatus ticketStatus);
@@ -635,7 +693,7 @@ namespace FasdDesktopUi.Basics.UserControls
ticketTextStack.Children.Add(ticketDescriptionBorder); ticketTextStack.Children.Add(ticketDescriptionBorder);
TextBlock ticketDescriptionTextBlock = null; TextBlock ticketDescriptionTextBlock = null;
if (ticketRelation.Infos.TryGetValue("Summary", out string ticketSummary)) if (ticketRelation.Infos.TryGetValue(TicketInfoKeys.Summary, out string ticketSummary))
{ {
ticketDescriptionTextBlock = new TextBlock() { Text = ticketSummary, TextTrimming = TextTrimming.CharacterEllipsis, FontWeight = FontWeights.UltraLight }; ticketDescriptionTextBlock = new TextBlock() { Text = ticketSummary, TextTrimming = TextTrimming.CharacterEllipsis, FontWeight = FontWeights.UltraLight };
ticketDescriptionBorder.Child = ticketDescriptionTextBlock; ticketDescriptionBorder.Child = ticketDescriptionTextBlock;
@@ -699,19 +757,20 @@ namespace FasdDesktopUi.Basics.UserControls
TicketIcon.SelectedMaterialIcon = null; TicketIcon.SelectedMaterialIcon = null;
TicketTextBlock.Text = SelectedTicket.DisplayName; TicketTextBlock.Text = SelectedTicket.DisplayName;
if (SelectedTicket.Infos.TryGetValue("Summary", out var ticketSummary)) if (SelectedTicket.Infos.TryGetValue(TicketInfoKeys.Summary, out var ticketSummary))
TicketSummaryTextBox.Text = ticketSummary; TicketSummaryTextBox.Text = ticketSummary;
else else
TicketSummaryTextBox.Text = string.Empty; TicketSummaryTextBox.Text = string.Empty;
if (SelectedTicket.Infos.TryGetValue("Special", out string specialInfo)) if (RelationHasSpecialInfo(SelectedTicket, TicketSpecialValues.TicketCreation))
{ {
if (specialInfo.Equals("TicketCreation", StringComparison.InvariantCultureIgnoreCase)) TicketIcon.SelectedInternIcon = enumInternIcons.misc_plus;
TicketIcon.SelectedInternIcon = enumInternIcons.misc_plus;
else if (specialInfo.Equals("NoTicket", StringComparison.InvariantCultureIgnoreCase))
TicketIcon.SelectedMaterialIcon = MaterialIconType.ic_block;
} }
else if (SelectedTicket.Infos.TryGetValue("StatusId", out string ticketStatusId)) else if (RelationHasSpecialInfo(SelectedTicket, TicketSpecialValues.NoTicket))
{
TicketIcon.SelectedMaterialIcon = MaterialIconType.ic_block;
}
else if (SelectedTicket.Infos.TryGetValue(TicketInfoKeys.StatusId, out string ticketStatusId))
{ {
Enum.TryParse(ticketStatusId, true, out enumTicketStatus ticketStatus); Enum.TryParse(ticketStatusId, true, out enumTicketStatus ticketStatus);
@@ -744,20 +803,20 @@ namespace FasdDesktopUi.Basics.UserControls
try try
{ {
WarningAssetHasBeenChanged.DataContext = this; WarningAssetHasBeenChanged.DataContext = this;
Binding visibilityBinding = new Binding("ShowAssetHasBeenChangedWarning") Binding visibilityBinding = new Binding(nameof(ShowAssetHasBeenChangedWarning))
{ {
Converter = new BooleanToVisibilityConverter(), Converter = new BooleanToVisibilityConverter(),
}; };
if (DataProvider == null) return; if (DataProvider == null) return;
var computerName = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "Asset").Value; var computerName = GetSelectedTicketInfoOrDefault(TicketInfoKeys.Asset);
if (string.IsNullOrEmpty(computerName) || SelectedComputer == null) if (string.IsNullOrEmpty(computerName) || SelectedComputer == null)
{ {
AssetHasBeenChanged = false; AssetHasBeenChanged = false;
} }
else else
{ {
AssetHasBeenChanged = !SelectedComputer.DisplayName.Equals(computerName, StringComparison.InvariantCultureIgnoreCase); AssetHasBeenChanged = !SelectedComputer.DisplayName.Equals(computerName, StringComparison.OrdinalIgnoreCase);
} }
WarningAssetHasBeenChanged.SetBinding(VisibilityProperty, visibilityBinding); WarningAssetHasBeenChanged.SetBinding(VisibilityProperty, visibilityBinding);
} }
@@ -773,20 +832,20 @@ namespace FasdDesktopUi.Basics.UserControls
try try
{ {
WarningServiceHasBeenChanged.DataContext = this; WarningServiceHasBeenChanged.DataContext = this;
Binding visibilityBinding = new Binding("ShowServiceHasBeenChangedWarning") Binding visibilityBinding = new Binding(nameof(ShowServiceHasBeenChangedWarning))
{ {
Converter = new BooleanToVisibilityConverter(), Converter = new BooleanToVisibilityConverter(),
}; };
if (DataProvider == null) return; if (DataProvider == null) return;
var service = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ServiceId").Value; var service = GetSelectedTicketInfoOrDefault(TicketInfoKeys.ServiceId);
if (string.IsNullOrEmpty(service) || service == Guid.Empty.ToString() || SelectedService.Value == null) if (string.IsNullOrEmpty(service) || service == Guid.Empty.ToString() || SelectedService.Value == null)
{ {
ServiceHasBeenChanged = false; ServiceHasBeenChanged = false;
} }
else else
{ {
ServiceHasBeenChanged = !SelectedService.Value.ToString().Equals(service, StringComparison.InvariantCultureIgnoreCase); ServiceHasBeenChanged = !SelectedService.Value.ToString().Equals(service, StringComparison.OrdinalIgnoreCase);
} }
WarningServiceHasBeenChanged.SetBinding(VisibilityProperty, visibilityBinding); WarningServiceHasBeenChanged.SetBinding(VisibilityProperty, visibilityBinding);
} }
@@ -804,7 +863,7 @@ namespace FasdDesktopUi.Basics.UserControls
return; return;
ComputerRelations = new List<cF4sdApiSearchResultRelation>(computerRelationsTemp); ComputerRelations = new List<cF4sdApiSearchResultRelation>(computerRelationsTemp);
var currentlySelectedId = DataProvider.Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.Computer)?.Id; var currentlySelectedId = DataProvider.Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.Computer)?.Id;
var computerName = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "Asset").Value; var computerName = GetSelectedTicketInfoOrDefault(TicketInfoKeys.Asset);
// Direktes Hinzufügen von Standardoptionen // Direktes Hinzufügen von Standardoptionen
@@ -835,7 +894,7 @@ namespace FasdDesktopUi.Basics.UserControls
else if (ComputerSelection.Items.Count > 0) else if (ComputerSelection.Items.Count > 0)
ComputerSelection.SelectedIndex = 0; ComputerSelection.SelectedIndex = 0;
if (currentlySelectedComputer == null || ComputerRelations.Any(x => x.Infos != null && x.Infos.ContainsKey("Special") && x.Infos["Special"] == "RemoveAffectedAssetEntry")) if (currentlySelectedComputer == null || ComputerRelations.Any(x => RelationHasSpecialInfo(x, TicketSpecialValues.RemoveAffectedAssetEntry)))
SetOrUpdateComputerInTicket = false; SetOrUpdateComputerInTicket = false;
if (NewTicketPillSelected) if (NewTicketPillSelected)
SetOrUpdateComputerInTicket = true; SetOrUpdateComputerInTicket = true;
@@ -876,7 +935,7 @@ namespace FasdDesktopUi.Basics.UserControls
requestData.FilterParams = new List<string> { adDnUser }; requestData.FilterParams = new List<string> { adDnUser };
requestData.ResetFilter = ServiceSelectionControl.ResetFilter; requestData.ResetFilter = ServiceSelectionControl.ResetFilter;
if (string.IsNullOrEmpty(lastServiceSearch) || !lastServiceSearch.Equals(requestData.Search, StringComparison.CurrentCultureIgnoreCase)) if (string.IsNullOrEmpty(lastServiceSearch) || !lastServiceSearch.Equals(requestData.Search, StringComparison.OrdinalIgnoreCase))
{ {
var resServiceCount = await cFasdCockpitCommunicationBase.Instance.GetPagedDataCount(requestData); var resServiceCount = await cFasdCockpitCommunicationBase.Instance.GetPagedDataCount(requestData);
ServiceSelectionControl.TotalItemCount = resServiceCount; ServiceSelectionControl.TotalItemCount = resServiceCount;
@@ -886,12 +945,12 @@ namespace FasdDesktopUi.Basics.UserControls
var serviceData = await cFasdCockpitCommunicationBase.Instance.GetPagedData(requestData); var serviceData = await cFasdCockpitCommunicationBase.Instance.GetPagedData(requestData);
var servicesList = GetServiceSelectionData(serviceData); var servicesList = GetServiceSelectionData(serviceData);
var service = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ServiceId").Value; var service = GetSelectedTicketInfoOrDefault(TicketInfoKeys.ServiceId);
var serviceName = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ServiceName").Value; var serviceName = GetSelectedTicketInfoOrDefault(TicketInfoKeys.ServiceName);
if (!string.IsNullOrEmpty(service) && Guid.Empty.ToString() != service) if (!string.IsNullOrEmpty(service) && Guid.Empty.ToString() != service)
{ {
servicesList.Add(new KeyValuePair<string, object>(string.Format(cMultiLanguageSupport.GetItem("Dialog.CloseCase.RemoveAffectedServiceEntry"), serviceName), "RemoveAffectedServiceEntry")); servicesList.Add(new KeyValuePair<string, object>(string.Format(cMultiLanguageSupport.GetItem("Dialog.CloseCase.RemoveAffectedServiceEntry"), serviceName), TicketSpecialValues.RemoveAffectedServiceEntry));
var itemToRemove = servicesList.FirstOrDefault(item => item.Value is string && (string)item.Value == service); var itemToRemove = servicesList.FirstOrDefault(item => item.Value is string && (string)item.Value == service);
if (!itemToRemove.Equals(default(KeyValuePair<string, object>))) if (!itemToRemove.Equals(default(KeyValuePair<string, object>)))
{ {
@@ -900,7 +959,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
else else
{ {
var itemToRemove = servicesList.FirstOrDefault(x => x.Value.ToString() == "RemoveAffectedServiceEntry"); var itemToRemove = servicesList.FirstOrDefault(x => string.Equals(x.Value.ToString(), TicketSpecialValues.RemoveAffectedServiceEntry, StringComparison.OrdinalIgnoreCase));
if (itemToRemove.Key != null) if (itemToRemove.Key != null)
{ {
servicesList.Remove(itemToRemove); servicesList.Remove(itemToRemove);
@@ -976,7 +1035,7 @@ namespace FasdDesktopUi.Basics.UserControls
finally finally
{ {
isCategoryLoading = false; isCategoryLoading = false;
ValidateProperty("SelectedCategory"); ValidateProperty(ValidationPropertyNames.SelectedCategory);
} }
} }
@@ -1108,7 +1167,7 @@ namespace FasdDesktopUi.Basics.UserControls
return; return;
} }
if (!SelectedTicket.Infos.TryGetValue("CategoryId", out var categoryId) || string.IsNullOrWhiteSpace(categoryId)) if (!SelectedTicket.Infos.TryGetValue(TicketInfoKeys.CategoryId, out var categoryId) || string.IsNullOrWhiteSpace(categoryId))
{ {
SelectedCategory = null; SelectedCategory = null;
return; return;
@@ -1169,7 +1228,7 @@ namespace FasdDesktopUi.Basics.UserControls
QuickTicketSelection.SelectedItem = quickCallListe QuickTicketSelection.SelectedItem = quickCallListe
.FirstOrDefault(x => x.ID == "7bbe64e2-94d0-ee11-4285-00155d010a04"); .FirstOrDefault(x => x.ID == "7bbe64e2-94d0-ee11-4285-00155d010a04");
ValidateProperty("QuickTicketSelection"); ValidateProperty(ValidationPropertyNames.QuickTicketSelection);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -1257,14 +1316,11 @@ namespace FasdDesktopUi.Basics.UserControls
try try
{ {
bool createTicket = _selectedTicket == null || SelectedTicket == _selectTicketRelation || selectedTicketIsNewTicket; bool createTicket = _selectedTicket == null || SelectedTicket == _selectTicketRelation || selectedTicketIsNewTicket;
if (_selectedTicket != null && _selectedTicket.Infos.TryGetValue("StatusId", out var statusIdString)) if (TryGetSelectedTicketInfo(TicketInfoKeys.StatusId, out var statusIdString) &&
Enum.TryParse(statusIdString, true, out enumTicketStatus statusId))
{ {
object parsedStatusId = Enum.Parse(typeof(enumTicketStatus), statusIdString); createTicket = statusId == enumTicketStatus.Closed;
if (parsedStatusId is enumTicketStatus statusId) SelectedTicket = SelectedTicket ?? _selectTicketRelation;
{
createTicket = statusId == enumTicketStatus.Closed;
SelectedTicket = SelectedTicket ?? _selectTicketRelation;
}
} }
TicketSelectionBorder.IsEnabled = !createTicket; TicketSelectionBorder.IsEnabled = !createTicket;
@@ -1299,7 +1355,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
if (checkTicketActive()) if (checkTicketActive())
{ {
if (tag == "SelectTicket") if (string.Equals(tag, "SelectTicket", StringComparison.OrdinalIgnoreCase))
{ {
selectionPill.IsSelectedChanged += (s, e) => selectionPill.IsSelectedChanged += (s, e) =>
{ {
@@ -1312,12 +1368,12 @@ namespace FasdDesktopUi.Basics.UserControls
var ticketRelations = new List<cF4sdApiSearchResultRelation>(tempTicketRelations); var ticketRelations = new List<cF4sdApiSearchResultRelation>(tempTicketRelations);
var currentlySelectedTicket = DataProvider.Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.Ticket); var currentlySelectedTicket = DataProvider.Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.Ticket);
SelectedTicket = SelectedTicket ?? ticketRelations.FirstOrDefault(ticket => ticket.id == currentlySelectedTicket.Id); SelectedTicket = SelectedTicket ?? ticketRelations.FirstOrDefault(ticket => ticket.id == currentlySelectedTicket.Id);
ValidateProperty("SelectedTicket"); ValidateProperty(ValidationPropertyNames.SelectedTicket);
ValidateProperty("TicketSummaryTextBox"); ValidateProperty(ValidationPropertyNames.TicketSummaryTextBox);
ValidateProperty("TicketStatusCombobox"); ValidateProperty(ValidationPropertyNames.TicketStatusCombobox);
}; };
} }
else if (tag == "CreateTicket") else if (string.Equals(tag, "CreateTicket", StringComparison.OrdinalIgnoreCase))
{ {
selectionPill.IsSelectedChanged += (s, e) => selectionPill.IsSelectedChanged += (s, e) =>
{ {
@@ -1327,21 +1383,21 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
SelectedTicket = _selectTicketRelation; SelectedTicket = _selectTicketRelation;
} }
ValidateProperty("SelectedTicket"); ValidateProperty(ValidationPropertyNames.SelectedTicket);
ValidateProperty("TicketSummaryTextBox"); ValidateProperty(ValidationPropertyNames.TicketSummaryTextBox);
ValidateProperty("TicketStatusCombobox"); ValidateProperty(ValidationPropertyNames.TicketStatusCombobox);
}; };
} }
else if (tag == "SkipTicket") else if (string.Equals(tag, "SkipTicket", StringComparison.OrdinalIgnoreCase))
{ {
selectionPill.IsSelectedChanged += (s, e) => selectionPill.IsSelectedChanged += (s, e) =>
{ {
_skipTicketPillSelected = selectionPill.IsSelected; _skipTicketPillSelected = selectionPill.IsSelected;
_errors.Clear(); _errors.Clear();
UpdateTicketComponentVisibility(); UpdateTicketComponentVisibility();
ValidateProperty("SelectedTicket"); ValidateProperty(ValidationPropertyNames.SelectedTicket);
ValidateProperty("TicketSummaryTextBox"); ValidateProperty(ValidationPropertyNames.TicketSummaryTextBox);
ValidateProperty("TicketStatusCombobox"); ValidateProperty(ValidationPropertyNames.TicketStatusCombobox);
if (selectionPill.IsSelected) if (selectionPill.IsSelected)
{ {
TicketStatusCombobox.SelectedIndex = 0; TicketStatusCombobox.SelectedIndex = 0;
@@ -1547,7 +1603,7 @@ namespace FasdDesktopUi.Basics.UserControls
["UserId"] = userId, ["UserId"] = userId,
["id"] = SelectedTicket.id, ["id"] = SelectedTicket.id,
["Summary"] = TicketSummaryTextBox.Text, [TicketInfoKeys.Summary] = TicketSummaryTextBox.Text,
["CreationSource"] = 3, ["CreationSource"] = 3,
["Status"] = enumTicketStatus.Unknown, ["Status"] = enumTicketStatus.Unknown,
["time"] = DateTime.UtcNow, ["time"] = DateTime.UtcNow,
@@ -1631,10 +1687,10 @@ namespace FasdDesktopUi.Basics.UserControls
if (DataProvider.NamedParameterEntries.TryGetValue("UserFullName", out var userNameParameter)) if (DataProvider.NamedParameterEntries.TryGetValue("UserFullName", out var userNameParameter))
user = userNameParameter.GetValue(); user = userNameParameter.GetValue();
ticketValues.Add("AffectedUser", user); ticketValues.Add("AffectedUser", user);
string asset = ""; string asset = string.Empty;
if (SelectedComputer == _removeAffectedAssetEntry) if (SelectedComputer == _removeAffectedAssetEntry)
{ {
asset = _removeAffectedAssetEntry.Infos.First(x => x.Key.Equals("Special", StringComparison.InvariantCultureIgnoreCase)).Value.ToString(); asset = TicketSpecialValues.RemoveAffectedAssetEntry;
} }
else if (SetOrUpdateComputerInTicket) else if (SetOrUpdateComputerInTicket)
{ {
@@ -1646,7 +1702,7 @@ namespace FasdDesktopUi.Basics.UserControls
Guid? service = null; Guid? service = null;
if (SetOrUpdateServiceInTicket && SelectedService.Value != null) if (SetOrUpdateServiceInTicket && SelectedService.Value != null)
{ {
if (string.Equals(SelectedService.Value.ToString(), "RemoveAffectedServiceEntry", StringComparison.InvariantCultureIgnoreCase)) if (string.Equals(SelectedService.Value.ToString(), TicketSpecialValues.RemoveAffectedServiceEntry, StringComparison.OrdinalIgnoreCase))
service = Guid.Empty; service = Guid.Empty;
else if (Guid.TryParse(SelectedService.Value.ToString(), out Guid parsedGuid)) else if (Guid.TryParse(SelectedService.Value.ToString(), out Guid parsedGuid))
{ {
@@ -1786,7 +1842,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
string statusIdValue = null; string statusIdValue = null;
if (_selectedTicket != null && _selectedTicket.Infos.TryGetValue("StatusId", out string value)) if (TryGetSelectedTicketInfo(TicketInfoKeys.StatusId, out var value))
{ {
statusIdValue = value; statusIdValue = value;
} }
@@ -1839,7 +1895,7 @@ namespace FasdDesktopUi.Basics.UserControls
CaseId = DataProvider.CaseId CaseId = DataProvider.CaseId
}; };
ticketData.AdditionalValues.Add("IsTicket", IsTicket); ticketData.AdditionalValues.Add("IsTicket", IsTicket);
ticketData.AdditionalValues.Add("ActivityType", SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ActivityType").Value); ticketData.AdditionalValues.Add(TicketInfoKeys.ActivityType, GetSelectedTicketInfoOrDefault(TicketInfoKeys.ActivityType));
ticketData.AdditionalValues.Add("Dialog.CloseCase.AssetNotFoundInMatrix42", cMultiLanguageSupport.GetItem("Dialog.CloseCase.AssetNotFoundInMatrix42")); ticketData.AdditionalValues.Add("Dialog.CloseCase.AssetNotFoundInMatrix42", cMultiLanguageSupport.GetItem("Dialog.CloseCase.AssetNotFoundInMatrix42"));
ticketData.AdditionalValues.Add("Dialog.CloseCase.ReopenReasonText", cMultiLanguageSupport.GetItem("Dialog.CloseCase.ReopenReasonText")); ticketData.AdditionalValues.Add("Dialog.CloseCase.ReopenReasonText", cMultiLanguageSupport.GetItem("Dialog.CloseCase.ReopenReasonText"));
ticketData.AdditionalValues.Add("Dialog.CloseCase.ReopenReasonTextHtml", cMultiLanguageSupport.GetItem("Dialog.CloseCase.ReopenReasonTextHtml")); ticketData.AdditionalValues.Add("Dialog.CloseCase.ReopenReasonTextHtml", cMultiLanguageSupport.GetItem("Dialog.CloseCase.ReopenReasonTextHtml"));
@@ -1882,7 +1938,7 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
switch (propertyName) switch (propertyName)
{ {
case "SelectedTicket": case ValidationPropertyNames.SelectedTicket:
if (SelectedTicket == _selectTicketRelation && !NewTicketPillSelected && !SkipTicketPillSelected) if (SelectedTicket == _selectTicketRelation && !NewTicketPillSelected && !SkipTicketPillSelected)
{ {
if (!_errors.ContainsKey(propertyName)) if (!_errors.ContainsKey(propertyName))
@@ -1894,7 +1950,7 @@ namespace FasdDesktopUi.Basics.UserControls
_errors.Remove(propertyName); _errors.Remove(propertyName);
} }
break; break;
case "TicketSummaryTextBox": case ValidationPropertyNames.TicketSummaryTextBox:
validateTextboxNotEmpty(TicketSummaryTextBox); validateTextboxNotEmpty(TicketSummaryTextBox);
if (!string.IsNullOrEmpty(TicketSummaryTextBox.Text) || !TicketSummaryTextBox.IsVisible) if (!string.IsNullOrEmpty(TicketSummaryTextBox.Text) || !TicketSummaryTextBox.IsVisible)
{ {
@@ -1907,7 +1963,7 @@ namespace FasdDesktopUi.Basics.UserControls
_errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorSummaryEmpty")); _errors.Add(propertyName, cMultiLanguageSupport.GetItem("Dialog.CloseCase.ValidationErrorSummaryEmpty"));
} }
break; break;
case "CaseNotesPreview": case ValidationPropertyNames.CaseNotesPreview:
var errorNotEmpty = CheckTextBlockNotEmpty(CaseNotesPreview, cFasdCockpitConfig.Instance.Global.TicketConfiguration.NotesMandatory); var errorNotEmpty = CheckTextBlockNotEmpty(CaseNotesPreview, cFasdCockpitConfig.Instance.Global.TicketConfiguration.NotesMandatory);
if (errorNotEmpty && CaseNotesPreview.IsVisible) if (errorNotEmpty && CaseNotesPreview.IsVisible)
{ {
@@ -1920,7 +1976,7 @@ namespace FasdDesktopUi.Basics.UserControls
_errors.Remove(propertyName); _errors.Remove(propertyName);
} }
break; break;
case "SolutionTextbox": case ValidationPropertyNames.SolutionTextbox:
if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog) if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog)
{ {
if (string.IsNullOrEmpty(closeTicketDialog.Solution)) if (string.IsNullOrEmpty(closeTicketDialog.Solution))
@@ -1937,7 +1993,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
} }
break; break;
case "ReminderDate": case ValidationPropertyNames.ReminderDate:
if (DynamicStatusAdditionBorder.Child is HoldTicketDialog holdTicketDialog) if (DynamicStatusAdditionBorder.Child is HoldTicketDialog holdTicketDialog)
{ {
if (holdTicketDialog.SelectedReminderDate <= DateTime.UtcNow.AddMinutes(-2)) if (holdTicketDialog.SelectedReminderDate <= DateTime.UtcNow.AddMinutes(-2))
@@ -1953,7 +2009,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "ErrorTypeValue": case ValidationPropertyNames.ErrorTypeValue:
if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog2) if (DynamicStatusAdditionBorder.Child is CloseTicketDialog closeTicketDialog2)
{ {
if (closeTicketDialog2.SelectedErrorType == null || closeTicketDialog2.SelectedErrorType is ComboBoxItem b && b.Tag == null) if (closeTicketDialog2.SelectedErrorType == null || closeTicketDialog2.SelectedErrorType is ComboBoxItem b && b.Tag == null)
@@ -1971,7 +2027,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "SelectedRoleAndPerson": case ValidationPropertyNames.SelectedRoleAndPerson:
if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog) if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog)
{ {
bool hasError = (forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) && bool hasError = (forwardTicketDialog.SelectedPerson.Key == null || forwardTicketDialog.SelectedPerson.Value == null) &&
@@ -1992,7 +2048,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "ForwardComment": case ValidationPropertyNames.ForwardComment:
if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog2) if (DynamicStatusAdditionBorder.Child is ForwardTicketDialog forwardTicketDialog2)
{ {
if (string.IsNullOrEmpty(forwardTicketDialog2.Comment)) if (string.IsNullOrEmpty(forwardTicketDialog2.Comment))
@@ -2009,7 +2065,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
} }
break; break;
case "HoldComment": case ValidationPropertyNames.HoldComment:
if (DynamicStatusAdditionBorder.Child is HoldTicketDialog holdTicketDialog1) if (DynamicStatusAdditionBorder.Child is HoldTicketDialog holdTicketDialog1)
{ {
if (string.IsNullOrEmpty(holdTicketDialog1.Comment)) if (string.IsNullOrEmpty(holdTicketDialog1.Comment))
@@ -2027,24 +2083,18 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "TicketStatusCombobox": case ValidationPropertyNames.TicketStatusCombobox:
validateComboboxNotEmpty(TicketStatusCombobox); validateComboboxNotEmpty(TicketStatusCombobox);
if (!(TicketStatusCombobox.SelectedItem is ComboBoxItem a)) if (!(TicketStatusCombobox.SelectedItem is ComboBoxItem a))
break; break;
enumTicketStatus currenTicketStatus = enumTicketStatus.Unknown; enumTicketStatus currentTicketStatus = enumTicketStatus.Unknown;
var currentTicketActivityType = SelectedTicket?.Infos.FirstOrDefault(x => x.Key == "ActivityType").Value; if (TryGetSelectedTicketInfo(TicketInfoKeys.StatusId, out var statusIdString) &&
Enum.TryParse(statusIdString, true, out enumTicketStatus parsedStatus))
if (SelectedTicket != null && SelectedTicket.Infos.TryGetValue("StatusId", out var statusIdString))
{ {
object parsedStatusId = Enum.Parse(typeof(enumTicketStatus), statusIdString); currentTicketStatus = parsedStatus;
if (parsedStatusId is enumTicketStatus _statusId)
{
currenTicketStatus = _statusId;
}
} }
bool ticketActionHasError = TicketStatusCombobox.IsVisible && a.Tag == null; bool ticketActionHasError = TicketStatusCombobox.IsVisible && a.Tag == null;
if (!ticketActionHasError) if (!ticketActionHasError)
{ {
@@ -2058,12 +2108,21 @@ namespace FasdDesktopUi.Basics.UserControls
UpdateTicketStatusValidationVisualState(ticketActionHasError); UpdateTicketStatusValidationVisualState(ticketActionHasError);
if (a.Tag == null) if (a.Tag == null)
{
ShowAssetWarningTicketAction = false; ShowAssetWarningTicketAction = false;
else if ( break;
!string.Equals(a.Tag.ToString(), "Forward", StringComparison.InvariantCultureIgnoreCase) }
&& !string.Equals(a.Tag.ToString(), "Save", StringComparison.InvariantCultureIgnoreCase)
&& string.Equals(currentTicketActivityType, "SPSActivityTypeTicket", StringComparison.InvariantCultureIgnoreCase) enumCloseCaseTicketStatus? selectedStatus = null;
) if (Enum.TryParse(a.Tag.ToString(), true, out enumCloseCaseTicketStatus parsedStatusAction))
{
selectedStatus = parsedStatusAction;
}
bool hasTicketActivity = TryGetSelectedTicketInfo(TicketInfoKeys.ActivityType, out var currentTicketActivityType) &&
string.Equals(currentTicketActivityType, TicketInfoValues.ActivityTypeTicket, StringComparison.OrdinalIgnoreCase);
if (selectedStatus.HasValue && selectedStatus != enumCloseCaseTicketStatus.Forward && selectedStatus != enumCloseCaseTicketStatus.Save && hasTicketActivity)
{ {
ShowAssetWarningTicketAction = true; ShowAssetWarningTicketAction = true;
var binding = new Binding var binding = new Binding
@@ -2074,7 +2133,7 @@ namespace FasdDesktopUi.Basics.UserControls
WarningTicketAction.SetBinding(ToolTipProperty, binding); WarningTicketAction.SetBinding(ToolTipProperty, binding);
} }
else if (currenTicketStatus == enumTicketStatus.Closed) else if (currentTicketStatus == enumTicketStatus.Closed)
{ {
ShowAssetWarningTicketAction = true; ShowAssetWarningTicketAction = true;
var binding = new Binding var binding = new Binding
@@ -2091,7 +2150,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "SelectedCategory": case ValidationPropertyNames.SelectedCategory:
bool categoryIsVisible = CategorySelectionControl?.IsVisible ?? false; bool categoryIsVisible = CategorySelectionControl?.IsVisible ?? false;
bool categoryHasError = categoryIsVisible && SelectedCategory == null; bool categoryHasError = categoryIsVisible && SelectedCategory == null;
UpdateCategoryValidationVisualState(categoryHasError); UpdateCategoryValidationVisualState(categoryHasError);
@@ -2108,7 +2167,7 @@ namespace FasdDesktopUi.Basics.UserControls
} }
break; break;
case "QuickTicketSelection": case ValidationPropertyNames.QuickTicketSelection:
bool quickCallIsVisible = QuickTicketSelection?.IsVisible ?? false; bool quickCallIsVisible = QuickTicketSelection?.IsVisible ?? false;
bool quickCallSelected = QuickTicketSelection?.SelectedItem is QuickCallEntry selectedQuickCall && !string.IsNullOrWhiteSpace(selectedQuickCall.ID); bool quickCallSelected = QuickTicketSelection?.SelectedItem is QuickCallEntry selectedQuickCall && !string.IsNullOrWhiteSpace(selectedQuickCall.ID);
bool quickCallHasError = quickCallIsVisible && !quickCallSelected; bool quickCallHasError = quickCallIsVisible && !quickCallSelected;
@@ -2223,7 +2282,7 @@ namespace FasdDesktopUi.Basics.UserControls
if (!string.IsNullOrWhiteSpace(CaseNotesPreview.Text)) if (!string.IsNullOrWhiteSpace(CaseNotesPreview.Text))
{ {
CaseNotesPreviewBorder.BorderBrush = (SolidColorBrush)new BrushConverter().ConvertFromString("#DEE2E6"); CaseNotesPreviewBorder.BorderBrush = (SolidColorBrush)new BrushConverter().ConvertFromString("#DEE2E6");
ValidateProperty("CaseNotesPreview"); ValidateProperty(ValidationPropertyNames.CaseNotesPreview);
} }
else else
{ {
@@ -2248,8 +2307,18 @@ namespace FasdDesktopUi.Basics.UserControls
return; return;
// Die Werte aus 'errors' entfernen // Die Werte aus 'errors' entfernen
Array.ForEach(new string[] { "SolutionTextbox", "ErrorTypeValue", "ReminderDate", "SelectedRoleAndPerson", "ForwardComment", "HoldComment" }, key => _errors.Remove(key)); Array.ForEach(
ValidateProperty("TicketStatusCombobox"); new[]
{
ValidationPropertyNames.SolutionTextbox,
ValidationPropertyNames.ErrorTypeValue,
ValidationPropertyNames.ReminderDate,
ValidationPropertyNames.SelectedRoleAndPerson,
ValidationPropertyNames.ForwardComment,
ValidationPropertyNames.HoldComment
},
key => _errors.Remove(key));
ValidateProperty(ValidationPropertyNames.TicketStatusCombobox);
if (!(comboBox.SelectedItem is ComboBoxItem selectedItem)) if (!(comboBox.SelectedItem is ComboBoxItem selectedItem))
return; return;
@@ -2270,8 +2339,8 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
if (dialog.IsLoaded) if (dialog.IsLoaded)
{ {
ValidateProperty("SolutionTextbox"); ValidateProperty(ValidationPropertyNames.SolutionTextbox);
ValidateProperty("ErrorTypeValue"); ValidateProperty(ValidationPropertyNames.ErrorTypeValue);
} }
}), System.Windows.Threading.DispatcherPriority.Loaded); }), System.Windows.Threading.DispatcherPriority.Loaded);
@@ -2287,8 +2356,8 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
if (holdTicketDialog.IsLoaded) if (holdTicketDialog.IsLoaded)
{ {
ValidateProperty("ReminderDate"); ValidateProperty(ValidationPropertyNames.ReminderDate);
ValidateProperty("HoldComment"); ValidateProperty(ValidationPropertyNames.HoldComment);
} }
}), System.Windows.Threading.DispatcherPriority.Loaded); }), System.Windows.Threading.DispatcherPriority.Loaded);
break; break;
@@ -2302,8 +2371,8 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
if (forwardTicketDialog.IsLoaded) if (forwardTicketDialog.IsLoaded)
{ {
ValidateProperty("SelectedRoleAndPerson"); ValidateProperty(ValidationPropertyNames.SelectedRoleAndPerson);
ValidateProperty("ForwardComment"); ValidateProperty(ValidationPropertyNames.ForwardComment);
} }
}), System.Windows.Threading.DispatcherPriority.Loaded); }), System.Windows.Threading.DispatcherPriority.Loaded);
break; break;
@@ -2321,34 +2390,34 @@ namespace FasdDesktopUi.Basics.UserControls
} }
private void ForwardCommentChanged(object sender, EventArgs e) private void ForwardCommentChanged(object sender, EventArgs e)
{ {
ValidateProperty("ForwardComment"); ValidateProperty(ValidationPropertyNames.ForwardComment);
} }
private void HoldCommentChanged(object sender, EventArgs e) private void HoldCommentChanged(object sender, EventArgs e)
{ {
ValidateProperty("HoldComment"); ValidateProperty(ValidationPropertyNames.HoldComment);
} }
private void SelectedRoleChanged(object sender, EventArgs e) private void SelectedRoleChanged(object sender, EventArgs e)
{ {
ValidateProperty("SelectedRoleAndPerson"); ValidateProperty(ValidationPropertyNames.SelectedRoleAndPerson);
} }
private void SelectedPersonChanged(object sender, EventArgs e) private void SelectedPersonChanged(object sender, EventArgs e)
{ {
ValidateProperty("SelectedRoleAndPerson"); ValidateProperty(ValidationPropertyNames.SelectedRoleAndPerson);
} }
private void ReminderDateValueChanged(object sender, EventArgs e) private void ReminderDateValueChanged(object sender, EventArgs e)
{ {
ValidateProperty("ReminderDate"); ValidateProperty(ValidationPropertyNames.ReminderDate);
} }
private void SolutionTextboxValueChanged(object sender, EventArgs e) private void SolutionTextboxValueChanged(object sender, EventArgs e)
{ {
ValidateProperty("SolutionTextbox"); ValidateProperty(ValidationPropertyNames.SolutionTextbox);
} }
private void Dialog_ErrorTypeValueChanged(object sender, EventArgs e) private void Dialog_ErrorTypeValueChanged(object sender, EventArgs e)
{ {
ValidateProperty("ErrorTypeValue"); ValidateProperty(ValidationPropertyNames.ErrorTypeValue);
} }
private static void validateComboboxNotEmpty(object sender) private static void validateComboboxNotEmpty(object sender)
@@ -2402,11 +2471,11 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
try try
{ {
if (SelectedTicket is null) if (SelectedTicket?.Infos is null)
return; return;
SelectedTicket.Infos["Summary"] = TicketSummaryTextBox.Text; SelectedTicket.Infos[TicketInfoKeys.Summary] = TicketSummaryTextBox.Text;
ValidateProperty("TicketSummaryTextBox"); ValidateProperty(ValidationPropertyNames.TicketSummaryTextBox);
} }
catch (Exception E) catch (Exception E)
{ {
@@ -2419,14 +2488,14 @@ namespace FasdDesktopUi.Basics.UserControls
{ {
try try
{ {
if (SelectedTicket is null) if (SelectedTicket?.Infos is null)
return; return;
if (string.IsNullOrWhiteSpace(CaseNotesPreview.Text)) if (string.IsNullOrWhiteSpace(CaseNotesPreview.Text))
CaseNotesPreview.Text = string.Empty; CaseNotesPreview.Text = string.Empty;
SelectedTicket.Infos["Summary"] = CaseNotesPreview.Text; SelectedTicket.Infos[TicketInfoKeys.Summary] = CaseNotesPreview.Text;
ValidateProperty("CaseNotesPreview"); ValidateProperty(ValidationPropertyNames.CaseNotesPreview);
} }
catch (Exception E) catch (Exception E)
{ {
@@ -2562,7 +2631,7 @@ namespace FasdDesktopUi.Basics.UserControls
private void QuickTicketSelection_SelectionChanged(object sender, SelectionChangedEventArgs e) private void QuickTicketSelection_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
ValidateProperty("QuickTicketSelection"); ValidateProperty(ValidationPropertyNames.QuickTicketSelection);
} }
private void TransferCaseNotesCheck_Unchecked(object sender, RoutedEventArgs e) private void TransferCaseNotesCheck_Unchecked(object sender, RoutedEventArgs e)