diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs index 18dc9845..61690efb 100644 --- a/Thermo.Active.Config/ServerConfigController.cs +++ b/Thermo.Active.Config/ServerConfigController.cs @@ -517,6 +517,7 @@ namespace Thermo.Active.Config PlcId = Convert.ToInt32(x.Element("plcId")?.Value), // If exists IsActive = Convert.ToBoolean(x.Element("active").Value), IsVisible = Convert.ToBoolean(x.Element("visible").Value), + IsStarred = Convert.ToBoolean(x.Element("starred").Value), Category = Convert.ToInt32(x.Element("category").Value), LocalizedNames = x.Element("localizedNames").Elements().ToDictionary( // Read localized names and convert into a dictionary y => y.Attribute("langKey").Value, y => y.Value diff --git a/Thermo.Active.Database/Controllers/UserSoftkeysController.cs b/Thermo.Active.Database/Controllers/UserSoftkeysController.cs index cc86becc..15e23ad6 100644 --- a/Thermo.Active.Database/Controllers/UserSoftkeysController.cs +++ b/Thermo.Active.Database/Controllers/UserSoftkeysController.cs @@ -76,6 +76,21 @@ namespace Thermo.Active.Database.Controllers .ToList(); } + + public List GetStarredSoftkeys(int userId) + { + // Find user softkey stored in the database + List favoriteKey = FindUserFavoriteSoftkeys(userId); + // Get config + List userSoftkey = GetUserSoftkeyConfig(); + + return userSoftkey + .Where(x => + favoriteKey.Any(y => y.SoftkeyId == x.Id + )) + .ToList(); + } + public List InsertUserSoftkeyModel(List softKeyIds, int userId) { List softKeys = new List(); diff --git a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs index c3f1713f..bf84c04b 100644 --- a/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs +++ b/Thermo.Active.Model/ConfigModels/UserSoftKeyConfigModel.cs @@ -10,6 +10,7 @@ namespace Thermo.Active.Model.ConfigModels public int Category { get; set; } public bool IsActive { get; set; } public bool IsVisible { get; set; } + public bool IsStarred { get; set; } = false; public bool OperatorConfirmationNeeded { get; set; } public List SubKeys { get; set; } public int PlcId { get; set; } diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index 6c3366fb..04f13f2f 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -1009,6 +1009,7 @@ namespace Thermo.Active.NC { Id = subkey.Id, Active = plcSoftKey.Active, + Starred = softKey.IsStarred, Category = softKey.Category, Value = plcSoftKey.Value }); @@ -1029,6 +1030,7 @@ namespace Thermo.Active.NC { Id = softKey.Id, Active = plcSoftKey.Active, + Starred=softKey.IsStarred, Category = softKey.Category, Visible = softKey.IsVisible, Value = plcSoftKey.Value