Skip to content

Commit

Permalink
Update RQM Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
prashelke committed Nov 14, 2024
1 parent 0e194ef commit 97e3be2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 13 deletions.
Binary file modified Ginger/GingerCoreNET/DLLS/RQMExportStd.dll
Binary file not shown.
78 changes: 65 additions & 13 deletions Ginger/GingerCoreNET/GeneralLib/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,11 @@ public static ObservableList<ExternalItemFieldBase> GetExternalFields()
}
foreach (var externalItemField in externalOnlineItemsFields)
{
originalExternalFields.Add(MapExternalField(externalItemField));
ExternalItemFieldBase item = MapExternalField(externalItemField);
if(item != null)
{
originalExternalFields.Add(item);
}
}
}
else
Expand All @@ -740,20 +744,68 @@ public static ObservableList<ExternalItemFieldBase> GetExternalFields()

private static ExternalItemFieldBase MapExternalField(ExternalItemFieldBase externalItemField)
{
var existingField = WorkSpace.Instance.Solution.ExternalItemsFields
.FirstOrDefault(x => x.Name.Equals(externalItemField.Name, StringComparison.CurrentCultureIgnoreCase));
try
{
var existingField = WorkSpace.Instance.Solution.ExternalItemsFields
.FirstOrDefault(x => x.Name.Equals(externalItemField.Name, StringComparison.CurrentCultureIgnoreCase) && x.ProjectGuid == externalItemField.ProjectGuid);

return new ExternalItemFieldBase
string value = "";

if (existingField == null)
{
if (externalItemField.Mandatory)
{
if (!string.IsNullOrEmpty(externalItemField.SelectedValue))
{
value = externalItemField.SelectedValue;
}
else
{
value = GetDefaultValue(externalItemField);
}
}
}
else
{
if (externalItemField.Mandatory)
{
if (!string.IsNullOrEmpty(existingField.SelectedValue))
{
value = existingField.SelectedValue;
}
else
{
value = GetDefaultValue(externalItemField);
}
}
}
return new ExternalItemFieldBase
{
Name = externalItemField.Name,
ID = externalItemField.ID,
ItemType = externalItemField.ItemType,
Type = externalItemField.Type,
Guid = externalItemField.Guid,
IsCustomField = externalItemField.IsCustomField,
SelectedValue = value
};
}
catch (Exception ex)
{
Reporter.ToLog(eLogLevel.ERROR,"Failed to Map External Fields",ex.InnerException);
return null;
}
}

private static string GetDefaultValue(ExternalItemFieldBase externalItemField)
{
// Return default values based on the field type.
return (externalItemField.Type.ToUpperInvariant()) switch
{
Name = externalItemField.Name,
ID = externalItemField.ID,
ItemType = externalItemField.ItemType,
Type = externalItemField.Type,
Guid = externalItemField.Guid,
IsCustomField = externalItemField.IsCustomField,
SelectedValue = existingField != null && !string.IsNullOrEmpty(existingField.SelectedValue)
? existingField.SelectedValue
: externalItemField.SelectedValue
"INTEGER" => "1",
"MEDIUMSTRING" => "Dummy",
"SMALLSTRING" => "Dummy",
_ => externalItemField.SelectedValue
};
}
}
Expand Down

0 comments on commit 97e3be2

Please sign in to comment.