private void AddInternal(TItem item) { if (item == null) { return; } if (ModelRegistry.IsManagedModel(item) && !ModelRegistry.IsManagedBy(Session, item)) { var id = ModelRegistry.GetId(item); throw new UnmanagedModelException(item.GetType(), id); } var itemId = ModelRegistry.GetOrCreateId(item); Session.Cache.Update(itemId, item); if (Ids.Contains(itemId)) { return; } Ids.Add(itemId); IsModified = true; }
private void GenerateTextBoxes() { foreach (KeyValuePair <int, double> entry in SumEntries) { #region Create the textbox standard var idTextbox = new TextBox(); var sumTextbox = new TextBox(); idTextbox.Width = sumTextbox.Width = 60; idTextbox.HorizontalContentAlignment = sumTextbox.HorizontalContentAlignment = HorizontalAlignment.Center; idTextbox.Background = Brushes.WhiteSmoke; sumTextbox.Background = Brushes.WhiteSmoke; #endregion // Adds the text to the textboxes. idTextbox.Text = entry.Key.ToString(); sumTextbox.Text = entry.Value.ToString(); // Makes them not table. idTextbox.IsTabStop = false; sumTextbox.IsTabStop = false; // Make them readonly idTextbox.IsReadOnly = true; sumTextbox.IsReadOnly = true; // Adds them to the collections. Ids.Add(idTextbox); Sums.Add(sumTextbox); } }
private void AddIds(string queryParam, int startIndex, string profile) { string sortings = queryParam.Substring(startIndex); Item pItem = new Item(sortings.Substring(3), profile); Ids.Add(pItem); }
private static int GetNextId(string modelName) { /*var idModels = models.Where(m => m.Id.HasValue).ToArray(); * * // ReSharper disable once PossibleInvalidOperationException * return idModels.Any() ? idModels.Max(m => m.Id.Value) + 1 : 1;*/ var modelId = Ids?.FirstOrDefault(mi => mi.ModelName == modelName); int id; if (modelId == null) { id = 1; modelId = new ModelId { ModelName = modelName, Id = 1 }; Ids?.Add(modelId); } else { id = modelId.Id; } modelId.Id += 1; Save(Ids, nameof(Ids)); return(id); }
public void AddIfNeed(KnowledgeDataType dataType, long dataId) { if (IsSupportType(dataType)) { Ids.Add(dataId); } }
public void Add(Field field) { if (Ids.Contains(field.Id)) { return; } _passwordFields = _usernameFields = null; Ids.Add(field.Id); Fields.Add(field); AutofillIds.Add(field.AutofillId); IdToFieldMap.Add(field.Id, field); if (field.Hints != null) { foreach (var hint in field.Hints) { Hints.Add(hint); if (field.Focused) { FocusedHints.Add(hint); } if (!HintToFieldsMap.ContainsKey(hint)) { HintToFieldsMap.Add(hint, new List <Field>()); } HintToFieldsMap[hint].Add(field); } } }
private void RefreshMembers() { Task.Run(async() => { if (ListId == 0) { var listDesc = await ListProxy.GetListDescription(_info).ConfigureAwait(false); if (listDesc != null) { _listId = listDesc.Id; } } // list data is not found if (ListId == 0) { return; } var userIds = await ListProxy.GetListMembers(ListId).ConfigureAwait(false); // user data is not found if (userIds == null) { return; } lock (Ids) { Ids.Clear(); userIds.ForEach(id => Ids.Add(id)); } OnListMemberUpdated.SafeInvoke(); }); }
public ImportViewModel(IImportService import) { _import = import; ClearCommand = new RelayCommand(() => Ids.Clear(), () => Ids.Count > 0); ImportCommand = new AsyncCommand(async() => { await Task.Run(() => _import.ImportAsync(Ids.ToList(), SelectedGroup, Rcf ? ProfileType.Rcf : ProfileType.Fide)); //await _import.ImportAsync(Ids.ToList(), SelectedGroup, Rcf ? ProfileType.Rcf : ProfileType.Fide) //.ConfigureAwait(false); MessengerInstance.Send(Ri2Constants.Notifications.DbUpdated); MessengerInstance.Send(Ri2Constants.Notifications.ProfilesUpdated); }); AddIdCommand = new RelayCommand(() => { if (CurrentId != 0) { Ids.Add(CurrentId); } CurrentId = 0; }); SelectFileCommand = new RelayCommand(SelectFile); DeleteIdCommand = new RelayCommand <int>(i => Ids.Remove(i), Ids.Count > 0); MessengerInstance.Register <string>(this, msg => { if (msg == Ri2Constants.Notifications.GroupsUpdated) { RaisePropertyChanged(nameof(Groups)); } }); }
public Layout(string name, int width, int height, byte borderWidth, byte borderHeight, Blockset.Block defaultBlock) { Id = Ids.Add(name); _loadedLayouts.Add(Id, new WeakReference <Layout>(this)); Block[][] Create(int w, int h) { var arr = new Block[h][]; for (int y = 0; y < h; y++) { var arrY = new Block[w]; for (int x = 0; x < w; x++) { arrY[x] = new Block(x, y, defaultBlock); } arr[y] = arrY; } return(arr); } Blocks = Create(Width = width, Height = height); BorderBlocks = Create(BorderWidth = borderWidth, BorderHeight = borderHeight); Name = name; Save(); Ids.Save(); UpdateBitmapSize(false); UpdateBitmapSize(true); }
public VismaEntrySumViewModel(Dictionary <int, double> sumEntries) { SumEntries = sumEntries; // Starts by creating two standard textboxes which contains the "ID" text and the "Sum" text at the start of every row of sums. Ids.Add(new TextBox { Text = "Visma ID", FontWeight = FontWeights.Bold, Width = 60, Background = Brushes.WhiteSmoke, HorizontalContentAlignment = HorizontalAlignment.Center, IsTabStop = false }); Sums.Add(new TextBox { Text = "Sum", FontWeight = FontWeights.Bold, Width = 60, Background = Brushes.WhiteSmoke, HorizontalContentAlignment = HorizontalAlignment.Center, IsTabStop = false }); // Then it generates the textboxes containing the sum and id pairs based on the dictionary that was sent. GenerateTextBoxes(); }
public void Add(AutofillFieldMetadata data) { _size++; SaveType |= data.SaveType; Ids.Add(data.Id); AutofillIds.Add(data.AutofillId); IdToFieldMap.Add(data.Id, data); if ((data.AutofillHints?.Count ?? 0) > 0) { AutofillHints.AddRange(data.AutofillHints); if (data.IsFocused) { FocusedAutofillHints.AddRange(data.AutofillHints); } foreach (var hint in data.AutofillHints) { if (!AutofillHintsToFieldsMap.ContainsKey(hint)) { AutofillHintsToFieldsMap.Add(hint, new List <AutofillFieldMetadata>()); } AutofillHintsToFieldsMap[hint].Add(data); } } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jObject = JObject.Load(reader); var typeName = jObject["type"]?.Value <string>() ?? jObject["@type"]?.Value <string>(); if (typeName == null) { // Get value of this objectType's "Type" JsonProperty(Required) var typeJsonPropertyRequiredValue = objectType.GetRuntimeProperty("Type") .CustomAttributes.Where(a => a.AttributeType == typeof(JsonPropertyAttribute)).FirstOrDefault()? .NamedArguments.Where(a => a.TypedValue.ArgumentType == typeof(Required)).FirstOrDefault() .TypedValue.Value.ToString(); // If this objectType does not require "Type" attribute, use the objectType's XML "TypeName" attribute if (typeJsonPropertyRequiredValue == "0") { typeName = objectType .GetRuntimeFields().Where(x => x.Name == "TypeName").FirstOrDefault()? .GetValue("TypeName").ToString(); } else { throw new AdaptiveSerializationException("Required property 'type' not found on adaptive card element"); } } if (TypedElementTypes.Value.TryGetValue(typeName, out var type)) { if (jObject.Value <string>("id") == null) { if (typeof(AdaptiveInput).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) { throw new AdaptiveSerializationException($"Required property 'id' not found on '{typeName}'"); } } else { string objectId = jObject.Value <string>("id"); if (Ids.Contains(objectId)) { throw new AdaptiveSerializationException($"Duplicate 'id' found: '{objectId}'"); } else { Ids.Add(objectId); } } var result = (AdaptiveTypedElement)Activator.CreateInstance(type); serializer.Populate(jObject.CreateReader(), result); HandleAdditionalProperties(result); return(result); } Warnings.Add(new AdaptiveWarning(-1, $"Unknown element '{typeName}'")); return(null); }
public PatientsViewModel(List <Patient> patients) { this.Patients = patients; foreach (Patient patient in Patients) { Names.Add(patient.UserName); Ids.Add(patient.Number); } }
public void AddTrafficLight(TrafficLight tl) { if (!IdExists(tl.StateId)) { Ids.Add(tl.StateId); } // TLs.Add(tl); }
/// <summary> Add a node id to the Ids list </summary> /// <param name="parentGraph"> The graph this node belongs to (needed to save the Asset path) </param> /// <param name="nodeId"> The node is being saved </param> /// <param name="saveToEditorPrefs"> If true, it will also save the Ids list to EditorPrefs. This bool is useful when adding a range if Ids at once so that we don't save after every node. </param> public void Add(Graph parentGraph, string nodeId, bool saveToEditorPrefs) { Ids.Add(nodeId); //add the node id to the ids list if (!saveToEditorPrefs) { return; } SaveToEditorPrefs(parentGraph); }
internal void AddStatment(StyleIdScope IdScope) { if (this.Ids == null) { this.Ids = new List <RSSStyleItem>(); } Ids.Add(new RSSStyleItem(IdScope.ClassNames, IdScope.Ids)); }
internal void AddProperty(RSSProperty rSSProperty) { if (Ids == null) { Ids = new List <RSSProperty>(); } Ids.Add(rSSProperty); }
public void ValidaCrud() { var participante1 = new DTO.ChurrascoParticipante() { IdChurrasco = IdChurrasco, Nome = "Darlan Hendges", Pago = true, DataInscricao = DateTime.Now, ValorContribuicao = 25.5M, ComBebida = true }; Total += participante1.ValorContribuicao.Value; var participante2 = new DTO.ChurrascoParticipante() { IdChurrasco = IdChurrasco, Nome = "Erci Hendges", Pago = true, DataInscricao = DateTime.Now, ValorContribuicao = 15.5M, ComBebida = false }; Total += participante2.ValorContribuicao.Value; var participante3 = new DTO.ChurrascoParticipante() { IdChurrasco = IdChurrasco, Nome = "Evandro Carlos Hendges", Pago = false, DataInscricao = DateTime.Now, ValorContribuicao = 0, ComBebida = false }; Total += participante3.ValorContribuicao.Value; var bo = new BO.ChurrascoParticipante(); bo.Adiciona(participante1); Assert.AreNotEqual(0, participante1.Id); bo.Adiciona(participante2); Assert.AreNotEqual(0, participante2.Id); bo.Adiciona(participante3); Assert.AreNotEqual(0, participante3.Id); Ids.Add(participante1.Id); Ids.Add(participante2.Id); Ids.Add(participante3.Id); ValidaTotal(); }
/// <summary> /// Id column by default skipped and can be multiply /// </summary> /// <param name="col"></param> public void AddIdColumn(string col) { string ncol = col.ToLower(); if (!Ids.ContainsKey(ncol)) { Ids.Add(ncol.ToLower(), 1); } AddSkipColumn(ncol); }
public TemplatesProcessor() { if (Ids == null) { Ids = new List <ID>(); } Ids.Add(Sitecore.ItemIDs.TemplateRoot); Ids.Add(Sitecore.Strategy.Contacts.DataProviders.ItemIDs.ContactsTemplatesFolder); Ids.Add(Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetTemplate); }
public static void InitIds() { string[] lines = System.IO.File.ReadAllLines("scryfallIds.txt"); foreach (string line in lines) { if (line != string.Empty) { Ids.Add(new Guid(line)); } } }
internal Map(string name, Layout layout) { Id = Ids.Add(name); _loadedMaps.Add(Id, new WeakReference <Map>(this)); MapLayout = layout; MapDetails = new Details(); Connections = new List <Connection>(); Encounters = new EncounterGroups(); MapEvents = new Events(); Name = name; Save(); Ids.Save(); }
internal EncounterTable(string name) { Id = Ids.Add(name); _loadedEncounterTables.Add(Id, new WeakReference <EncounterTable>(this)); ChanceOfPhenomenon = 51; // 20% Encounters = new List <Encounter>() { new Encounter() }; Name = name; Save(); Ids.Save(); }
internal Blockset(string name) { Id = Ids.Add(name); _loadedBlocksets.Add(Id, new WeakReference <Blockset>(this)); Blocks = new List <Block>() { new Block(this, 0) }; Name = name; Save(); Ids.Save(); UpdateBitmapSize(); DrawAll(); }
public void Update(int id) { var Ids = HttpContext.Session.Get <List <int> >("Ids"); if (Ids == null) { Ids = new List <int>(); } Ids.Add(id); HttpContext.Session.Set("Ids", Ids); var connectionString = _configuration.GetConnectionString("connectionString"); var repo = new ImageRepository(connectionString); repo.Update(id); }
internal RemoteGenericBag(Session.Session session, object owner, string name, IEnumerable <TItem> items = null) : base(session, owner, name) { if (items == null) { // pull from owner resource var relationships = ModelRegistry.GetResource(owner).Relationships; if (relationships != null && relationships.TryGetValue(name, out var rltn)) { var ids = rltn.Data?.SelectTokens("[*].id"); ids.Each(id => Ids.Add(id.ToObject <Guid>())); } } else { items.Each(Add); } }
public int AllocateId() { while (true) { if (_lastAssignedId < int.MaxValue) { _lastAssignedId++; } else { _lastAssignedId = 0; } if (!Ids.Contains(_lastAssignedId)) { Ids.Add(_lastAssignedId); return(_lastAssignedId); } } }
public virtual void AddDetail(string key, object value) { if (value is Guid) { Ids.Add(key, (Guid)value); } else if (value is string) { Strings.Add(key, (string)value); } else if (value is int) { Ints.Add(key, (int)value); } else if (value is double) { Doubles.Add(key, (double)value); } else { Strings.Add(key, value.ToString()); } }
private static void ArchivedCustomerOrdersWithoutCustomerOrderParts() { IDbTransactionData dbTransactionData = ZppConfiguration.CacheManager.GetDbTransactionData(); Ids customerOrderIds = new Ids(); foreach (var demand in dbTransactionData.CustomerOrderPartGetAll()) { CustomerOrderPart customerOrderPart = (CustomerOrderPart)demand; customerOrderIds.Add(customerOrderPart.GetCustomerOrderId()); } foreach (var customerOrder in dbTransactionData.CustomerOrderGetAll()) { bool customerOrderHasNoCustomerOrderPart = customerOrderIds.Contains(customerOrder.GetId()) == false; if (customerOrderHasNoCustomerOrderPart) { ArchiveCustomerOrder(customerOrder.GetId()); } } }
private static void ArchivedPurchaseOrdersWithoutPurchaseOrderParts() { IDbTransactionData dbTransactionData = ZppConfiguration.CacheManager.GetDbTransactionData(); Ids purchaseOrderIds = new Ids(); foreach (var demand in dbTransactionData.PurchaseOrderPartGetAll()) { PurchaseOrderPart purchaseOrderPart = (PurchaseOrderPart)demand; purchaseOrderIds.Add(purchaseOrderPart.GetPurchaseOrderId()); } foreach (var purchaseOrder in dbTransactionData.PurchaseOrderGetAll()) { bool purchaseOrderHasNoPurchaseOrderParts = purchaseOrderIds.Contains(purchaseOrder.GetId()) == false; if (purchaseOrderHasNoPurchaseOrderParts) { ArchivePurchaseOrder(purchaseOrder); } } }