/// <summary> /// Список ключей у клиента. /// </summary> /// <param name="idClient"></param> /// <param name="keyFeatureClient"></param> private void ListKeyAtClient(int idClient, List <ModelViewKeyFeatureClient> keyFeatureClient) { if (keyFeatureClient == null) { throw new ArgumentNullException(nameof(keyFeatureClient)); } var allKeyFeature = keyFeatureLogic.GetAll(); var listKeyFeatureClient = keyFeatureClientLogic.GetAll() .Where(x => x.IdClient == idClient); var listIdHaspKeyAtClient = from keyFeatCl in listKeyFeatureClient join keyActFeat in allKeyFeature on keyFeatCl.IdKeyFeature equals keyActFeat.Id select keyActFeat.IdHaspKey; var listKeyFeatureAtClient = from keyFeat in allKeyFeature join keyInCl in listIdHaspKeyAtClient on keyFeat.IdHaspKey equals keyInCl where keyFeat.EndDate >= date select keyFeat; var kyeFeature = from keyFeat in listKeyFeatureAtClient.Distinct() join key in haspKeyLogic.GetAll() on keyFeat.IdHaspKey equals key.Id join feature in featureLogic.GetAll() on keyFeat.IdFeature equals feature.Id where keyFeat.EndDate >= date select new ModelViewKeyFeatureClient { IdClient = idClient, IdKeyFeature = keyFeat.Id, Feature = feature.Name, NumberKey = key.InnerId.ToString() + " - \"" + key.Number + "\"", EndDate = keyFeat.EndDate, TypeKey = key.TypeKey }; foreach (var item in kyeFeature) { var client = listKeyFeatureClient.FirstOrDefault(x => x.IdKeyFeature == item.IdKeyFeature); if (client != null) { item.Id = client.Id; item.Selected = true; item.Initiator = client.Initiator; item.Note = client.Note; } keyFeatureClient.Add(item); } }
public void GetAllEmptyHaspKey() { var getAll = new List <HaspKey>(); var haspKeysExpected = new List <HaspKey>(); using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); haspKeyL = Get(db); getAll = haspKeyL.GetAll(); } CollectionAssert.AreEqual(getAll, haspKeysExpected); }
public void GetAllHaspKey() { var getAll = new List <HaspKey>();; var haspKeys = CreateListEntities.HaspKeys(); using (var db = new EntitesContext()) { ClearTable.HaspKeys(db); haspKeyL = Get(db); foreach (var key in haspKeys) { haspKeyL.Save(key); } getAll = haspKeyL.GetAll(); } CollectionAssert.AreEqual(getAll, haspKeys); }
public List <ModelViewHaspKey> GetAll() => Convert(keyLogic.GetAll());