/// <summary> /// Update the properties when the current node placer descriptor has changed. /// </summary> private void SelectionProviderSelectionChanged(object sender, EventArgs e) { //We just rebuild the option handler from scratch nodePlacerOptionHandler.BuildFromSelection(selectionProvider, Lookups.CreateContextLookupChainLink( (subject, type) => ((type == typeof(IOptionBuilder) && subject is INodePlacerConfiguration) ? new SortableOptionBuilder() : null))); }
/// <summary> /// Creates a new instance using the provided domain and a filter. /// </summary> /// <param name="model">The domain to work on.</param> /// <param name="filter">A filter that works on the domain.</param> public DefaultSelectionProvider(IEnumerable <T> model, Predicate <T> filter) { eventfilter = new EventFilter <EventArgs>(); this.model = model; this.filter = filter; link = Lookups.CreateContextLookupChainLink(DescriptorContextLookupCallback); eventfilter.Event += new EventHandler <EventArgs>(eventfilter_Event); }
internal void GetIndices(Lookups lookups, Entries entries) { PartIndex = (short)FindIndex(lookups.Parts, PartName); foreach (Bone bone in Bones) { bone.GetIndices(lookups, entries); } }
public BFN(string name = "") : base(Lookups.StructuredFieldID <BFN>(), 0, 0, null) { if (!string.IsNullOrWhiteSpace(name)) { Data = new byte[8]; ObjectName = name; } }
public void AddLookups() { Lookups.DeleteAllLookups(); //Lookups.AddCategories(); //Lookups.AddUnits(); //Lookups.AddRoles(); Lookups.AddPermissions(); Lookups.AddRolesPermisons(); }
protected virtual void OnLoaded(object src, EventArgs args) { InitializeInputModes(); // Decorate the lookup of the nodes to change the default behavior // for moving, selection paint, resizing, etc. IGraph graph = graphControl.Graph; ILookupDecorator decorator = graph.Lookup <ILookupDecorator>(); if (decorator != null && decorator.CanDecorate(typeof(INode))) { decorator.AddLookup(typeof(INode), new UMLNodeLookupChainLink()); } // register a node grid with the canvas' input mode context lookup GridConstraintProvider <INode> nodeGrid = new GridConstraintProvider <INode>(20); IContextLookupChainLink gridLink = Lookups.AddingLookupChainLink(typeof(IGridConstraintProvider <INode>), nodeGrid); graphControl.InputModeContextLookupChain.Add(gridLink); // remove the highlight indicator manager from the input context - disables highlight hints IContextLookupChainLink hidingLink = Lookups.HidingLookupChainLink(typeof(HighlightIndicatorManager <IModelItem>)); graphControl.InputModeContextLookupChain.Add(hidingLink); // Create a style var umlStyle = new NodeControlNodeStyle("ClassInfoNodeStyle"); graph.NodeDefaults.Style = umlStyle; // Add a sample node INode node = CreateNode(null, graphControl.Graph, new PointD(100, 100), null); node.Tag = CreateDefaultClassInfo(); // Enable clipboard graphControl.Clipboard = new GraphClipboard { ToClipboardCopier = { Clone = GraphCopier.CloneTypes.Tags, ReferentialIdentityTypes = GraphCopier.CloneTypes.All }, FromClipboardCopier = { Clone = GraphCopier.CloneTypes.Tags, ReferentialIdentityTypes = GraphCopier.CloneTypes.All }, DuplicateCopier = { Clone = GraphCopier.CloneTypes.Tags, ReferentialIdentityTypes = GraphCopier.CloneTypes.All } }; }
internal void GetIndices(Lookups lookups, Entries entries) { if (!lookups.BoneNames.ContainsKey(Name)) { lookups.BoneNames[Name] = entries.BoneNames.Count; entries.BoneNames.Add(new BoneName(Name)); } NameIndex = FindIndex(lookups.BoneNames, Name); }
public JobOrderHistoryController() { _context = new ErpEntities(Constants.ConnectionString); _jobOrderHeader = new BaseModel <iffsJobOrderHistoryHeader>(_context); _jobOrderDetail = new BaseModel <iffsJobOrderHistoryDetail>(_context); _quotationHeader = new BaseModel <iffsQuotationHeader>(_context); _lookup = new Lookups(_context); _jobOrderQuotation = new BaseModel <iffsJobOrderQuotation>(_context); }
public STO(CommonMappings.eRotations iOrient, CommonMappings.eRotations bOrient, bool hasPrefix, bool isChained) : base(Lookups.PTXControlSequenceID <STO>(isChained), hasPrefix, null) { Data = new byte[4]; // The enum values need to be multiplied by 2 to reflect the actual degree values IDegrees = (ushort)((ushort)iOrient * 2); BDegrees = (ushort)((ushort)bOrient * 2); }
public void ShouldAddLookups() { var lookups = new Lookups(); var flight = _target.CreateFlight(new FlightData { Lookups = lookups }, TestDates.Now); Assert.IsNotNull(flight.Lookups); }
public DdsViewModel(DdsDnevnikModel ddsmodel) { ddsDnevnikModel = ddsmodel; KindDocLookup = new ObservableCollection <LookUpSpecific>(Context.GetAllDocTypes()); if (ddsDnevnikModel.CodeDoc == null) { ddsDnevnikModel.CodeDoc = "01"; } KindDoc = KindDocLookup.FirstOrDefault(e => e.CodetId == ddsDnevnikModel.CodeDoc); ActivityTypeLookup = new ObservableCollection <LookUpSpecific> { new LookUpSpecific { CodetId = "01", Id = 1, Name = "Покупки" }, new LookUpSpecific { CodetId = "02", Id = 2, Name = "Продажби" }, new LookUpSpecific { CodetId = "03", Id = 3, Name = "Други" }, }; this.Lookups = new ObservableCollection <LookUpMetaData>(Context.GetAllLookups(" where NAMEENG='k'")); AllFields = new ObservableCollection <DdsDnevnicItem>(); foreach (var items in ddsDnevnikModel.DetailItems) { AllFields.Add(new DdsDnevnicItem(items)); } if (ddsmodel.LookupID > 0) { Lookup = Lookups.FirstOrDefault(e => e.Id == ddsmodel.LookupID); if (Lookup == null) { Lookup = ddsmodel.KindActivity == 2 ? Lookups.FirstOrDefault(e => e.Name == "Клиенти") : Lookups.FirstOrDefault(e => e.Name == "Доставчици"); ddsmodel.LookupElementID = 0; } } else { Lookup = ddsmodel.KindActivity == 2 ? Lookups.FirstOrDefault(e => e.Name == "Клиенти") : Lookups.FirstOrDefault(e => e.Name == "Доставчици"); } if (SelectedItem == null) { SelectedItem = new SaldoItem(); } SelectedItem.Value = ddsDnevnikModel.ClNum; Bustad = ddsDnevnikModel.Bulstat; DdsId = ddsDnevnikModel.Nzdds; ClName = ddsDnevnikModel.NameKontr; if (Lookup != null) { SelectedItem.Name = Lookup.Name; } OnPropertyChanged("SelectedItem"); ddsDnevnikModel.Total = ddsDnevnikModel.DetailItems.Sum(e => e.DdsSuma).ToString(Vf.LevFormatUI); }
/// <exclude/> public Index(SerializationInfo serializationInfo, StreamingContext streamingContext) { if (SerializerHelper.UseFastSerialization) { _columns = null; using (SerializationReader reader = new SerializationReader((byte[])serializationInfo.GetValue("d", typeof(byte[])))) { UniqueId = reader.ReadString(); Lookups.Add(UniqueId, this); _alias = reader.ReadString(); _columnIds = reader.ReadStringArray(); _enabled = reader.ReadBoolean(); _isUserDefined = reader.ReadBoolean(); _name = reader.ReadString(); // TODO: Parent _type = reader.ReadString(); _userOptions = (List <IUserOption>)reader.ReadObject(); } } else { int version = 0; if (SerializationVersionExists) { try { version = serializationInfo.GetInt32("SerializationVersion"); } catch (SerializationException) { // ignore SerializationVersionExists = false; } } _alias = serializationInfo.GetString("Alias"); _columns = (List <Column>)serializationInfo.GetValue("Columns", ModelTypes.ColumnList); _enabled = serializationInfo.GetBoolean("Enabled"); //this._exposedUserOptions = serializationInfo.GetValue("ExposedUserOptions", ModelTypes.Object); _isUserDefined = serializationInfo.GetBoolean("IsUserDefined"); _name = serializationInfo.GetString("Name"); _parent = (ScriptObject)serializationInfo.GetValue("Parent", ModelTypes.ScriptObject); _type = serializationInfo.GetString("Type"); _userOptions = (List <IUserOption>)serializationInfo.GetValue("UserOptions", ModelTypes.UserOptionList); for (int i = 0; i < _userOptions.Count; i++) { _userOptions[i].Owner = this; } if (version >= 8) { _description = serializationInfo.GetString("Description"); } } }
public OperationController() { _context = new ErpEntities(Constants.ConnectionString); _operation = new BaseModel <iffsOperation>(_context); _documentNoSetting = new BaseModel <iffsDocumentNoSetting>(_context); _jobOrderHeader = new BaseModel <iffsJobOrderHeader>(_context); _notification = new BaseModel <iffsNotification>(_context); _employee = new BaseModel <hrmsEmployee>(_context); _lookup = new Lookups(_context); }
protected void SearchUsers(string query) { DataTable dtUsers = Lookups.ReturnLookupsPrimary(query); if (dtUsers.Rows.Count > 0) { gdv_users.DataSource = dtUsers; gdv_users.DataBind(); } }
void LoadDropDowns() { Utility.LoadListItems(ddlManufacturerID.Items, Lookups.GetList("CSK_Store_Manufacturer"), "manufacturer", "manufacturerid", "", true); Utility.LoadListItems(ddlStatusID.Items, Lookups.GetList("CSK_Store_ProductStatus"), "status", "statusid", "", true); Utility.LoadListItems(ddlProductTypeID.Items, Lookups.GetList("CSK_Store_ProductType"), "producttype", "producttypeid", "", true); Utility.LoadListItems(ddlShippingTypeID.Items, Lookups.GetList("CSK_Store_ShippingType"), "shippingtype", "shippingtypeid", "", true); Utility.LoadListItems(ddlShipEstimateID.Items, Lookups.GetList("CSK_Store_ShippingEstimate"), "shippingestimate", "shipestimateid", "", true); Utility.LoadListItems(ddlTaxTypeID.Items, Lookups.GetList("CSK_Tax_Type"), "taxtype", "taxtypeid", "", true); Utility.LoadListItems(ddlCurrencyCodeID.Items, Lookups.GetList("CSK_Util_Currency"), "code", "code", ConfigurationManager.AppSettings["defaultCurrency"], true); }
protected void btnQuickMan_Click(object sender, EventArgs e) { if (txtQuickMan.Text.Trim() != string.Empty) { Lookups.QuickAdd("CSK_Store_Manufacturer", "manufacturer", txtQuickMan.Text); txtQuickMan.Text = ""; this.LoadDropDowns(); ddlManufacturerID.SelectedIndex = ddlManufacturerID.Items.Count - 1; } }
public FND(string desc, ushort pointSize) : base(Lookups.StructuredFieldID <FND>(), 0, 0, null) { Data = new byte[80]; TypefaceDescription = desc; WeightClass = CommonMappings.eWeightClass.Medium; WidthClass = CommonMappings.eWidthClass.Medium; MaxVerticalSize = pointSize; NominalVerticalSize = pointSize; MinVerticalSize = pointSize; }
/// <summary> /// Create new ObjectOptionItem with given name and no initial value set. /// </summary> /// <remarks>The option is enabled by default.</remarks> /// <param name="name">The canonical (non-localized) name of the option</param> /// <param name="attributes">An optional map of attributes for the item</param> protected OptionItem(string name, IDictionary <string, object> attributes) { if (String.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", "Name must not be null or empty"); } this.name = name; this.attributes = attributes; Value = null; lookup = Lookups.CreateDictionaryLookup(dictionary); }
protected override void OnAfterSaveEntity(Company company) { base.OnAfterSaveEntity(company); var companies = Lookups.Where(companyLookup => companyLookup.ParentCompany != null && companyLookup.ParentCompany.Id == company.Id); foreach (var companyLookup in companies) { companyLookup.Entity.ParentCompany = company; companyLookup.Refresh(); } }
public SurveyRequestController() { _context = new ErpEntities(Constants.ConnectionString); _SurveyRequest = new SurveyRequest(_context); _documentNoSetting = new DocumentNoSetting(_context); _lookup = new Lookups(_context); _shipmentType = new BaseModel <iffsShipmentType>(_context); _userOperationMapping = new BaseModel <iffsUserOperationTypeMapping>(_context); _ReceivingClient = new ReceivingClient(_context); _notification = new BaseModel <iffsNotification>(_context); }
public async Task <Lookups> Get() { var result = new Lookups(); var cats = new List <SelectOption>(); var category = await _categoryService.GetAll(); foreach (var cat in category) { cats.Add(new SelectOption { OptionName = cat.Title, OptionValue = cat.Id.ToString() }); } result.CategoryList = cats; result.Cultures = _cultureService.Get(); result.SelfRegisterRoles = new List <SelectOption>(); var task = _userManager.GetUsersInRoleAsync("Administrator"); var administrators = task.Result; Author author = new Author(); bool isSelected = false; var items = new List <SelectOption>(); foreach (var item in administrators) { author.Id = item.Id; author.DisplayName = item.DisplayName; author.Signature = item.Signature; author.Name = item.UserName; var json = Newtonsoft.Json.JsonConvert.SerializeObject(author); items.Add(new SelectOption { OptionName = item.DisplayName, OptionValue = author.Id, IsSelected = isSelected }); } result.AuthorList = items; var pages = new List <SelectOption>(); result.PageList = pages; result.InstalledThemes = new List <SelectOption>(); result.PostOptions = new EditorOptions { OptionType = "Post", ShowSlug = true, ShowDescription = true, ShowCustomFields = true, ShowAuthors = true }; result.PageOptions = new EditorOptions { OptionType = "Page", ShowSlug = true, ShowDescription = true, ShowCustomFields = true }; return(result); }
public Lookups GetLookups() { var lookups = new Lookups { Rooms = GetRooms().ToList(), TimeSlots = GetTimeSlots().ToList(), Tracks = GetTracks().ToList(), }; return(lookups); }
public static Lookups ToLookups <TKey, TValue>(this Dictionary <TKey, TValue> dictionary) { var lookups = new Lookups(); foreach (var item in dictionary) { lookups.Add(new Lookup(item.Key, item.Value)); } return(lookups); }
private static async Task CreateLookup(string resDir, string name, Dictionary <string, string> map) { var outputFile = Path.Combine(resDir, name + ".bin"); var buffer = new char[map.Values.Sum(k => k.Length)]; var bufferLength = 0; var entries = new Dictionary <ulong, Lookups.Entry>(); int count = 0; foreach (var(k, v) in map.OrderByDescending(kv => kv.Value.Length).ThenBy(kv => kv.Value)) { var keyHash = Lookups.Hash(k); var invKeyHash = Lookups.InvariantHash(k); var index = buffer.AsSpan(0, bufferLength).IndexOf(v); if (index < 0) { v.AsSpan().CopyTo(buffer.AsSpan(bufferLength, v.Length)); entries.TryAdd(keyHash, new Lookups.Entry((byte)v.Length, (uint)bufferLength)); if (invKeyHash != keyHash) { entries.TryAdd(invKeyHash, new Lookups.Entry((byte)v.Length, (uint)bufferLength)); } bufferLength += v.Length; Console.Write("+"); } else { entries.TryAdd(keyHash, new Lookups.Entry((byte)v.Length, (uint)index)); if (invKeyHash != keyHash) { entries.TryAdd(invKeyHash, new Lookups.Entry((byte)v.Length, (uint)index)); } //Console.Write("."); } count++; if (count % 1000 == 0) { Console.WriteLine($"\nAt {count} of {map.Count}"); } } Array.Resize(ref buffer, bufferLength); var lookup = new Lookups(name, Language.English, new string(buffer), entries); using (var f = File.OpenWrite(outputFile)) { await lookup.SerializeAsync(f); } }
protected void returnLookupsSeconday(string query, string id, DropDownList cbo, string dtValue, string dtText) { DataTable dt = Lookups.ReturnLookupsSecondary(query, id); if (dt.Rows.Count > 0) { cbo.DataSource = dt; cbo.DataValueField = dtValue; cbo.DataTextField = dtText; cbo.DataBind(); } }
public static IList <EmployeeDiseaseRiskStatus> GetEmployeeDiseaseRiskStatusesWithNoClientSettings( IList <DiseaseRiskRecord> diseaseRisk, Lookups lookups, IMapper mapper, IList <EmployeeDiseaseRiskStatusRecord> employeeDiseaseRiskStatusRiskStatusRecords) { var mergedStatuses = mapper.Map <IList <EmployeeDiseaseRiskStatus> >(employeeDiseaseRiskStatusRiskStatusRecords).ToList(); AddLookupDescriptions(diseaseRisk, lookups, mergedStatuses); return(mergedStatuses.OrderBy(x => x.CreateDate).ToList()); }
public static Lookups ToLookups <T, TValue>( this IEnumerable <Enumeration <T, TValue> > list) where T : Enumeration <T, TValue> where TValue : IComparable { var lookups = new Lookups(); foreach (var item in list) { lookups.Add(new Lookup(item.Value, item.Name)); } return(lookups); }
public bool Insert(Lookups lookups) { int autonumber = 0; LookupsDAC lookupsComponent = new LookupsDAC(); bool endedSuccessfuly = lookupsComponent.InsertNewLookups(ref autonumber, lookups.LookupName, lookups.LookupFriendlyName); if (endedSuccessfuly) { lookups.LookupId = autonumber; } return(endedSuccessfuly); }
public async Task <HttpResponseMessage> Get(HttpRequestMessage req, TraceWriter log) { try { await _configRepo.InitializeAsync(); } catch (Exception ex) { log.Error($"Error initialising database: {ex.ToString()}"); return(req.CreateResponse(HttpStatusCode.BadRequest)); } try { await _sampleDataApi.SetupBaseData(req); } catch (Exception exp) { log.Error("Error setting base data: " + exp.Message); return(req.CreateResponse(HttpStatusCode.BadRequest)); } try { var metadata = await _metadataRepo.GetItemAsync(Metadata.MetadataId); var lookups = new Lookups() { checklistItems = metadata.checklistItems, riskHazardTypes = metadata.riskHazardTypes, riskPeople = metadata.riskPeople, ethnicities = metadata.ethnicities, ratingQuestions = metadata.learnerRatingQuestions, ragStatuses = Enums.GetMembers <RagStatus>().Select(x => new Lookup() { name = x.AsString(), value = x.ToInt32() }).ToList(), certificationDate = Config.GetCertificationDate(DateTime.Now), // TODO - Set these from an admin page lowEvaluationLevel = 4, highEvaluationLevel = 6 }; var config = await _configRepo.GetItemAsync(Config.ConfigId); return(req.CreateResponse(HttpStatusCode.OK, lookups)); } catch (Exception exp) { log.Error("Error setting metadata and lookups: " + exp.Message); return(req.CreateResponse(HttpStatusCode.BadRequest)); } }
private void UpdateLookups() { _logger.Info("Updating lookup dictionary"); Lookups.Clear(); // Don't hammer the website: SurgeProtection.CheckBeforeRequest(); Uri categoryApiUri = new Uri(HostUri, "CategoryAPI"); string categoryApiPageSource; try { categoryApiPageSource = _webClient.DownloadString(categoryApiUri); _logger.Debug($"Downloaded '{categoryApiUri}'"); } catch (Exception ex) { _logger.Error(ex, $"The file '{categoryApiUri}' page failed to download because of an exception"); return; } HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(categoryApiPageSource); var nodes = doc.DocumentNode.SelectNodes(@"//*[@id='content']//*[contains(@class,'searchresults')]//a"); _logger.Debug($"Found {nodes.Count} categories for updating the lookup dictionary"); if (nodes.Any()) { foreach (var node in nodes) { string name = node.InnerText; string link = node.GetAttributeValue("href", string.Empty); int linkQueryIndex = link.IndexOf('?'); // Skip anything that looks like a category but has an invalid URI if (!Uri.TryCreate(HostUri, link.Substring(0, linkQueryIndex >= 0 ? linkQueryIndex : link.Length), out Uri uri)) { _logger.Warn($"Skipping category named '{name}' for lookup dictionary because it has an invalid URI: {link}"); continue; } Lookups.Add(name, uri); } } else { _logger.Warn("There weren't any items on the categories by name page to fill the lookup dictionary"); } }
/// <summary> /// Builds the HraView and collects the lkpLookups data based on the given table. /// </summary> /// <param name="table">table used to filter results</param> /// <remarks> /// Must implement <code>GetControlsForLookups()</code> /// when using this constructor. /// </remarks> protected HraView(string table) { this._lookups = new Lookups(table); this.Load += this.HraView_Load; }
/// <summary> /// Builds the HraView and collects the lkpLookups data based on the given table. /// </summary> /// <param name="tables">table used to filter results</param> /// <remarks> /// Must implement <code>GetControlsForLookups()</code> /// when using this constructor. /// </remarks> protected HraView(params string[] tables) : this() { this._lookups = new Lookups(tables); this.Load += this.HraView_Load; }