COmpletata prima review Starred Softkey

This commit is contained in:
Samuele Locatelli
2020-07-14 14:32:58 +02:00
parent c5fea9fa43
commit 3801b9ba0e
4 changed files with 19 additions and 0 deletions
@@ -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
@@ -76,6 +76,21 @@ namespace Thermo.Active.Database.Controllers
.ToList();
}
public List<DTOUserSoftKeyConfigModel> GetStarredSoftkeys(int userId)
{
// Find user softkey stored in the database
List<FavoriteUserSoftkeyModel> favoriteKey = FindUserFavoriteSoftkeys(userId);
// Get config
List<DTOUserSoftKeyConfigModel> userSoftkey = GetUserSoftkeyConfig();
return userSoftkey
.Where(x =>
favoriteKey.Any(y => y.SoftkeyId == x.Id
))
.ToList();
}
public List<DTOUserSoftKeyConfigModel> InsertUserSoftkeyModel(List<uint> softKeyIds, int userId)
{
List<FavoriteUserSoftkeyModel> softKeys = new List<FavoriteUserSoftkeyModel>();
@@ -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<SubKeysModel> SubKeys { get; set; }
public int PlcId { get; set; }
+2
View File
@@ -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