private void CellAssetsRolesValueChecked(AssetsRoleModel obj) { WebSocketController.Instance.OutputQueueAddObject(new ServerLib.JTypes.Client.RequestRolesObjectsDeleteClass() { Token = DataStorage.Instance.Login.Token, ObjectID = obj.ID, RoleID = SelectedRoleClass.ID }); }
private void ObjectsHandler(string inputMessage) { if (DataStorage.Instance.accessRolesObjectsData.Count == 0) { DataStorage.Instance.accessRolesObjectsData.Clear(); DataStorage.Instance.accessRolesObjectsData = JsonConvert.DeserializeObject <ResponseObjectsClass>(inputMessage).Items; DataStorage.Instance.accessListData = new List <AssetsRoleModel>(); foreach (ResponseObjectClass responseRoles in DataStorage.Instance.accessRolesObjectsData) { AssetsRoleModel AssetData = new AssetsRoleModel(); AssetData.ID = responseRoles.ID; AssetData.Name = responseRoles.Name; AssetData.Description = responseRoles.Description; AssetData.OperationAddAsset = responseRoles.OperationAdd; AssetData.OperationDeleteAsset = responseRoles.OperationDelete; AssetData.OperationEditAsset = responseRoles.OperationEdit; AssetData.OperationReadAsset = responseRoles.OperationRead; DataStorage.Instance.accessListData.Add(AssetData); } } else { foreach (ResponseObjectClass obj in JsonConvert.DeserializeObject <ResponseObjectsClass>(inputMessage).Items) { if (obj.Command == ServerLib.JTypes.Enums.ItemCommands.add) { DataStorage.Instance.accessRolesObjectsData.Add(obj); } if (obj.Command == ServerLib.JTypes.Enums.ItemCommands.delete) { ResponseObjectClass temp = DataStorage.Instance.accessRolesObjectsData.Find(x => x.Hash == obj.Hash); DataStorage.Instance.accessRolesObjectsData.Remove(temp); } if (obj.Command == ServerLib.JTypes.Enums.ItemCommands.edit) { ResponseObjectClass temp = DataStorage.Instance.accessRolesObjectsData.Find(x => x.ID == obj.ID); DataStorage.Instance.accessRolesObjectsData.Remove(temp); DataStorage.Instance.accessRolesObjectsData.Add(obj); } } } }