/// <summary> /// Check if there is some non-null, non-empty, non-whitespace response for the given def_ItemVariable /// </summary> /// <param name="itemVariableIdentifier">identifier of the def_ItemVariable in question</param> /// <returns></returns> public bool HasAnyResponse(string itemVariableIdentifier) { //def_ResponseVariables rv = formsRepo.GetResponseVariablesByFormResultIdentifier(formResultId, itemVariableIdentifier); ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == itemVariableIdentifier); return(vp != null && !String.IsNullOrWhiteSpace(vp.rspValue) && (vp.rspValue.Trim().Length > 0)); }
public void UpdatePartByName(string partName, string partValue) { if (propertyTable.ContainsKey(partName)) { propertyTable[partName] = new ValuePair(partValue, partValue); } }
/// <summary> /// 辞書の優先順位と有効・無効を一括設定します /// </summary> /// <param name="list">辞書の名前・有効かどうかを表したValuePairを、辞書の優先順位の順番に格納したリスト</param> public static void changeOrder(List <ValuePair <string, Boolean> > list) { // 現在の辞書をバッファに退避 List <SymbolTable> buff = new List <SymbolTable>(); int size = mTable.Count; for (int i = 0; i < size; i++) { buff.Add(mTable[i]); } // 現在の辞書をいったんクリア mTable.Clear(); int count = list.Count; for (int i = 0; i < count; i++) { ValuePair <string, Boolean> itemi = list[i]; for (int j = 0; j < size; j++) { SymbolTable table = buff[j]; if (table.getName().Equals(itemi.getKey())) { table.setEnabled(itemi.getValue()); mTable.Add(table); break; } } } }
/// <summary> /// Check if the response to a given def_ItemVariable matches the targetResponse /// </summary> /// <param name="itemVariableIdentifier">identifier of the def_ItemVariable in question</param> /// <param name="targetResponse">expected response</param> /// <returns>true if there is a response and it matches</returns> public bool HasExactResponse(string itemVariableIdentifier, string targetResponse) { //def_ResponseVariables rv = formsRepo.GetResponseVariablesByFormResultIdentifier(formResultId, itemVariableIdentifier); ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == itemVariableIdentifier); return(vp != null && vp.rspValue != null && vp.rspValue.Equals(targetResponse)); }
ValuePair AddValue(T value) { for (;;) { var p = Volatile.Read(ref pair); if (p == null) { p = new ValuePair(); if (Interlocked.CompareExchange(ref pair, p, null) != null) { continue; } } if (!p.Add(value)) { Interlocked.CompareExchange(ref pair, null, p); continue; } if (p.Finish()) { Interlocked.CompareExchange(ref pair, null, p); return(p); } return(null); } }
/// <summary> /// returns true if there is an existing, nuumerical, >0 response for the given def_ItemVariable /// </summary> /// <param name="itemVariableIdentifier"></param> /// <returns></returns> public bool HasPositiveResponse(string itemVariableIdentifier) { //def_ResponseVariables rv = formsRepo.GetResponseVariablesByFormResultIdentifier(formResultId, itemVariableIdentifier); ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == itemVariableIdentifier); return(vp != null && !String.IsNullOrWhiteSpace(vp.rspValue) && (vp.rspValue.ToLower() == "true" || ForceParseInt(vp.rspValue) > 0)); }
public static void FillRow(object row, out int id, out SqlString value) { ValuePair pair = (ValuePair)row; id = pair.ID; value = pair.Value; }
/// <summary> /// Check if the response to a given def_ItemVariable matches the targetPattern /// </summary> /// <param name="itemVariableIdentifier">identifier of the def_ItemVariable in question</param> /// <param name="targetPattern">expected response regex pattern</param> /// <returns>true if there is a response and it matches</returns> public bool HasPattern(string itemVariableIdentifier, string targetPattern) { //def_ResponseVariables rv = formsRepo.GetResponseVariablesByFormResultIdentifier(formResultId, itemVariableIdentifier); ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == itemVariableIdentifier); return(vp != null && vp.rspValue != null && System.Text.RegularExpressions.Regex.IsMatch(vp.rspValue, targetPattern)); }
private void Evaluate(ValuePair knownValue) { foreach (var entity in population) { entity.Gene.ApplyInputs(knownValue.Name, knownValue.Input); entity.Gene.ToValidTree(out Node root); entity.Value = root.CalculateValue(); } }
/// <summary> /// Attribute Value Pairs をセットする /// </summary> public void AppendAttribute(ValuePair vp) { if (attributeValuePairs == null) { attributeValuePairs = new List <ValuePair>(); } attributeValuePairs.Add(vp); }
public static void BindLateTickableExecutionOrder( this DiContainer container, Type type, int order) { Assert.That(type.DerivesFrom <ILateTickable>(), "Expected type '{0}' to derive from ILateTickable", type.Name()); container.Bind <ValuePair <Type, int> >().WithId("Late") .FromInstance(ValuePair.New(type, order)).WhenInjectedInto <TickableManager>(); }
public static void BindDisposableExecutionOrder( this DiContainer container, Type type, int order) { Assert.That(type.DerivesFrom <IDisposable>(), "Expected type '{0}' to derive from IDisposable", type.Name()); container.BindInstance( ValuePair.New(type, order)).WhenInjectedInto <DisposableManager>(); }
public static ValuePair GetValuePair(string text) { ValuePair valuePair = new ValuePair { Value = text, Type = GetItemType(text) }; return(valuePair); }
public static IEnumerable When(Func <bool> cond, IEnumerable whenTrue, IEnumerable whenFalse = null, Func <bool> stopCond = null) { whenFalse = whenFalse != null ? whenFalse : KeepDoing(Nothing); return(SimpleStateMachine(stopCond, ValuePair.New(cond, whenTrue), ValuePair.New(Not(cond), whenFalse) )); }
public void Set(TKey key, TEntity value) { var valuePair = new ValuePair { OriginalValue = default(TEntity), Value = default(TEntity) }; Cache[key] = valuePair; valuePair.Value = value; }
public static IEnumerable <ValuePair <Type, MetadataType> > GetAnnotatedTypes <MetadataType>() where MetadataType : Attribute { foreach (var type in Assembly.GetExecutingAssembly().GetTypes()) { foreach (var route in type.GetCustomAttributes(true)) { if (route is MetadataType) { yield return(ValuePair.New(type, route as MetadataType)); } } } }
/// <summary> /// Perform generic validation: /// /// For the given formResultId (assigned in SharedValidation constructor), /// Make sure there is some non-null, non-whitespace response value for each of the /// def_ItemVariables corresponding to a def_SectionItems entry (or def_SectionItemsEnt entry) /// where the "display" "validation" and "requiredForm" flags are all marked 1/true. /// /// Only def_SectionItems for the current def_Forms (parameter "frm") are considered. /// /// Only def_SectionItemsEnt for the current def_Forms and form enterprise /// </summary> /// <param name="amt"></param> /// <param name="frm"></param> /// <param name="ItemVariableSuffixesToSkip"></param> /// <returns></returns> public bool DoGenericValidation( IFormsRepository formsRepo, TemplateItems amt, def_Forms frm, string[] ItemVariableSuffixesToSkip = null) { //pick an enterprise ID to use for validation purposes int entId = SessionHelper.LoginStatus.EnterpriseID; bool invalid = false; amt.missingItemVariablesBySectionByPart = new Dictionary <int, Dictionary <int, List <string> > >(); //get a list of identifiers for all the required item variables //typically this list will be pulled from a single EntAppConfig record for this enterprise/form //if such a record is not available, the meta-data structure will be traversed to find the required itemvariables //and an EntAppDonfig record will be added to speed the next validation for this enterprise/form List <ItemVariableIdentifierWithPartSection> requiredIvs = GetRequiredItemVarsWithPartsSections(formsRepo, frm, entId); //iterate through all the required item variable identifiers foreach (ItemVariableIdentifierWithPartSection ivps in requiredIvs) { //if this identifier ends with one of the "skippable" suffixes, skip it if (ItemVariableSuffixesToSkip != null) { bool skip = false; foreach (string suffixtoSkip in ItemVariableSuffixesToSkip) { if (ivps.itemVariableIdentifier.EndsWith(suffixtoSkip)) { skip = true; break; } } if (skip) { continue; } } //check if we have a valid response for this required item variable ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == ivps.itemVariableIdentifier); if (vp == null || vp.rspValue == null || vp.rspValue.Trim().Length == 0) { invalid = true; AddMissingItemtoModel(ivps, amt); } } return(invalid); }
public IApplication RegisterPresenter(IRoute route, Type type, Dictionary <string, ValuePair <IRoute, Type> > dict = null) { if (!typeof(MonoBehaviour).IsAssignableFrom(type)) { throw new Exception(string.Format("Type '{0}' is not a MonoBehaviour", type)); } container.Bind(type).FromComponentInNewPrefabResource(route.fullPath).AsTransient(); if (dict != null) { dict[route.path] = ValuePair.New(route, type); } return(this); }
public void ValuePairTest() { ValuePair <Int32, Int32> pair = new ValuePair <int, int>(55, 555); Assert.AreEqual("First: 55; Second: 555", pair.ToString()); ValuePair <Int32, Int32> pair2 = new ValuePair <int, int>(55, 55); ValuePair <Int32, Int32> pair3 = new ValuePair <int, int>(55, 555); Assert.AreEqual(pair3.GetHashCode(), pair.GetHashCode()); Assert.AreNotEqual(pair3.GetHashCode(), pair2.GetHashCode()); Assert.AreEqual(true, pair3.Equals(pair)); Assert.AreEqual(false, pair3.Equals(pair2)); }
private void LoadCBNReturnsReport(DataTable dt, ReportDocument report, string id) { report.SetDataSource(dt); var reportparams = new List <ValuePair>(); var p = new ValuePair(); p.ID = "mfbCode"; p.Value = "50629"; reportparams.Add(p); p = new ValuePair(); p.ID = "mfbName"; p.Value = "NPF MICROFINANCE BANK PLC"; reportparams.Add(p); p = new ValuePair(); p.ID = "returnCode"; p.Value = "MMFBR M00"; reportparams.Add(p); p = new ValuePair(); p.ID = "stCode"; p.Value = "MMFBR M00"; reportparams.Add(p); p = new ValuePair(); p.ID = "stName"; p.Value = "LAGOS"; reportparams.Add(p); p = new ValuePair(); p.ID = "lgCode"; p.Value = "ETI-OSA"; reportparams.Add(p); p = new ValuePair(); p.ID = "lgName"; p.Value = "LAGOS ISLAND"; reportparams.Add(p); var reportobject = new InlaksBIContext().Resources.FirstOrDefault(r => r.value == id); var title = reportobject.isNull() ? "" : reportobject.ResourceName; p = new ValuePair(); p.ID = "returnName"; p.Value = title; reportparams.Add(p); Session["reportparams"] = reportparams; Session["report"] = report; }
public List <ValuePair> getDataSets(string moduleid) { var db = new InlaksBIContext(); var pairs = new List <ValuePair>(); foreach (DataSetDetail set in db.DataSets.Where(d => d.Module.value == moduleid)) { var pair = new ValuePair(); pair.ID = set.DataSetName; pair.Value = set.DataSetName; pairs.Add(pair); } return(pairs); }
private Item CreateItem(IPUMS.Variable variable, Level level) { Item item = new Item(level.IDs); item.Name = variable.Name; if (_codebook.ValueSets.ContainsKey(variable.Name)) { item.Label = _codebook.ValueSets[variable.Name].Label; } else { item.Label = variable.Name; } item.Start = variable.StartPosition; item.Length = variable.Length; item.ZeroFill = true; // see if there is a value set for this item if (_codebook.ValueSets.ContainsKey(variable.Name)) { IPUMS.ValueSet ipumsVS = _codebook.ValueSets[variable.Name]; ValueSet vs = new ValueSet(item); item.AddValueSet(vs); vs.Name = ipumsVS.Name + "_VS"; vs.Label = ipumsVS.Label; foreach (IPUMS.Value ipumsValue in ipumsVS.Values) { Value value = new Value(); vs.AddValue(value); value.Label = ipumsValue.Label; ValuePair valuePair = new ValuePair(); value.AddValuePair(valuePair); valuePair.From = ipumsValue.Code; } } return(item); }
public static void AppendValuePairList(ICollection <SectionBase> SectionBaseList, string Desciption, string Value) { XElement SpanDesc = new XElement(span); XElement Bold = new XElement(b); SpanDesc.Add(Bold); Bold.Value = string.Format("{0}: ", Desciption); XElement TableDataDesc = new XElement(td); TableDataDesc.Add(SpanDesc); XElement SpanValue = new XElement(span); SpanValue.Value = Value; XElement TableDataValue = new XElement(td); TableDataValue.Add(SpanValue); XElement TableRow = new XElement(tr); TableRow.Add(TableDataDesc); TableRow.Add(TableDataValue); SectionBase SectionBase = SectionBaseList.LastOrDefault(); if (SectionBase != null) { if (SectionBase is ValuePair oValuePair1) { oValuePair1.ElementList.Add(TableRow); } else { SectionBase.End(); ValuePair oValuePair = new ValuePair(); oValuePair.ElementList.Add(TableRow); SectionBaseList.Add(oValuePair); } } else { ValuePair oValuePair = new ValuePair(); oValuePair.ElementList.Add(TableRow); SectionBaseList.Add(oValuePair); } }
private void Button_Click(object sender, RoutedEventArgs e) { ToggleButton btn = sender as ToggleButton; StackPanel s_panel = VisualHelper.FindParent <StackPanel>(btn); IFlowBalanceTI FlowBalanceTI_Frame = VisualHelper.FindParent <IFlowBalanceTI>(s_panel); ComboBox cmbReturnProfile = (ComboBox)((UserControl)FlowBalanceTI_Frame).FindName("cmbReturnProfile"); DataGridControl GridControl = (DataGridControl)((UserControl)FlowBalanceTI_Frame).FindName("GridControl"); TSection _SectionIntegralActs = FlowBalanceTI_Frame.GetSectionAct(); if (s_panel != null) { ValuePair <string, TDatePeriod> title_pair = (ValuePair <string, TDatePeriod>)s_panel.DataContext; EnumDataSourceType?DataSourceType = cmbReturnProfile.SelectedValue as EnumDataSourceType?; bool isReadCalculatedValues = true; DateTime dtStart = title_pair.Value.dtStart; FlowBalanceTI result = null; bool IsAdd = btn.IsChecked.Value; if (!IsAdd) { result = new FlowBalanceTI() { NumbersValues = Extention.GetNumbersValuesInPeriod(enumTimeDiscreteType.DBHalfHours, dtStart, dtStart.AddMinutes(1410), Manager.Config.SelectedTimeZoneInfo) }; ValuesToXceedGrid.UpdateFlowBalanceTIToGrid(GridControl, result, Proryv.AskueARM2.Client.Visual.Common.GlobalDictionary.TGlobalVisualDataRequestObjectsNames.GlobalVisualDataRequestObjectsNames, new ItemSelector(), title_pair, IsAdd); } else { Manager.UI.RunAsync(delegate() { result = ARM_Service.SIA_GetFlowBalanceTI(_SectionIntegralActs.Section_ID, dtStart, dtStart.AddMinutes(1410), DataSourceType, enumTimeDiscreteType.DBHalfHours, EnumUnitDigit.None, isReadCalculatedValues, Manager.Config.TimeZone); }, delegate() { if (result != null) { ValuesToXceedGrid.UpdateFlowBalanceTIToGrid(GridControl, result, Proryv.AskueARM2.Client.Visual.Common.GlobalDictionary.TGlobalVisualDataRequestObjectsNames.GlobalVisualDataRequestObjectsNames, new ItemSelector(), title_pair, IsAdd); } }); } } }
public List <ValuePair> getFilterColumns(string tablename) { var data = getDatasetCollection(tablename, 1, true); var pairs = new List <ValuePair>(); foreach (DataColumn column in data.Columns) { var pair = new ValuePair(); pair.ID = column.ColumnName; pair.Value = column.ColumnName; pairs.Add(pair); } return(pairs); }
public List <ValuePair> getDataSets(string moduleid) { var pairs = new List <ValuePair>(); var datasets = new string[] { "customer_summary_cust_profit", "customersegments_custrep" }; foreach (string dataset in datasets.Where(t => t.CleanUp().Contains(moduleid.CleanUp()))) { var pair = new ValuePair(); pair.ID = dataset; pair.Value = dataset; pairs.Add(pair); } return(pairs); }
public FightingArt() { QualityValue = 0; AdditiveQuality = true; Aim = AnatomyAim.Mid; PositionResult = new ValuePair <MobilityState>(MobilityState.None, MobilityState.None); DistanceRange = new ValueRange <ulong>(0, 1); Stamina = new ValuePair <int>(1, 0); Health = new ValuePair <int>(0, 1); Impact = 1; Armor = 0; Setup = 1; Recovery = 1; RekkaPosition = -1; ActorCriteria = new FightingArtCriteria(); VictimCriteria = new FightingArtCriteria(); Readiness = ReadinessState.Offensive; }
public string getValuePair(string id, string param) { if (param.isNull()) { } var pairs = new List <ValuePair>(); WarehouseInterface warehouse = new InlaksBIContext().getWarehouse(new Settings().warehousedbtype); switch (id.CleanUp()) { case "resources": int mid = param.toInt(); var res = new InlaksBIContext().Resources.Where(r => r.Module.ModuleID == mid).ToList(); foreach (var re in res) { ValuePair pair = new ValuePair(); pair.ID = re.ResourceID.ToString(); pair.Value = re.ResourceName; pairs.Add(pair); } return(JsonConvert.SerializeObject(pairs)); case "dataset": int modid = param.toInt(); var module = new InlaksBIContext().Modules.FirstOrDefault(m => m.ModuleID == modid); pairs = warehouse.getDataSets(module.value); return(JsonConvert.SerializeObject(pairs)); case "datasetcolumns": pairs = warehouse.getViewColumns(param); return(JsonConvert.SerializeObject(pairs)); default: return(""); } }
public static void Init() { for (int i = 0; i < 2; i++) { Rom.Seek(Address[i]); LevelPsiEntries[i] = new ValuePair[Entries[i]]; for (int j = 0; j < Entries[i]; j++) { var pd = new ValuePair(); pd.First = Rom.ReadUShort(); pd.Second = Rom.ReadUShort(); pd.cindex = i; pd.pindex = j; LevelPsiEntries[i][j] = pd; } } }
/// <summary> /// Returns the response for a def_ItemVariable in the form of an integer /// /// Defaults to -1 if no response is available, or if the response is empty/whitespace. /// /// Throws exception if there is an existing response in the wrong format /// </summary> /// <param name="itemVariableIdentifier"></param> /// <returns>an integer, or -1 if no response</returns> public int GetResponseInt(string itemVariableIdentifier) { //def_ResponseVariables rv = formsRepo.GetResponseVariablesByFormResultIdentifier(formResultId, itemVariableIdentifier); ValuePair vp = allResponses.FirstOrDefault(vpt => vpt.identifier == itemVariableIdentifier); if (vp == null || String.IsNullOrWhiteSpace(vp.rspValue)) { return(-1); } try { return(Convert.ToInt32(vp.rspValue)); } catch (Exception e) { throw new Exception("Expected integer response to item variable \"" + itemVariableIdentifier + "\", but found \"" + vp.rspValue + "\""); } }
public void AddProgressBarX(string title) { this.m_baseWnd.SuspendLayout(); Label label = new Label(); label.SuspendLayout(); label.AutoSize = false; label.Text = title; using (Graphics graphics = Graphics.FromHwnd(label.Handle)) { this.m_titleWidth = ((int) graphics.MeasureString(label.Text, this.m_Font).Width) + label.Margin.Size.Width; } label.Size = new Size(this.m_titleWidth, label.Font.Height); label.Location = new Point(this.m_baseWnd.Location.X + this.m_fromPt.X, (this.m_baseWnd.Location.Y + this.m_fromPt.Y) + (this.m_intervalBarH * this.m_ValuePair.Count)); ProgressBarX rx = new ProgressBarX(); rx.SuspendLayout(); rx.Size = new Size(this.m_barWidth, 0x17); rx.Style = ProgressBarStyle.Continuous; rx.Location = new Point((label.Location.X + label.Width) + 10, label.Location.Y - ((rx.Height - label.Height) >> 1)); Label label2 = new Label(); label2.SuspendLayout(); label2.AutoSize = true; label2.Size = new Size(50, label2.Font.Height); label2.Text = string.Empty; label2.Location = new Point((rx.Location.X + rx.Width) + 10, label.Location.Y); rx.TitleLable = label; rx.TextLable = label2; ValuePair item = new ValuePair(); item.Key = title; item.Value = rx; this.m_ValuePair.Add(item); this.m_baseWnd.Controls.Add(rx); this.m_baseWnd.Controls.Add(label); this.m_baseWnd.Controls.Add(label2); this.AdjustWindow(); label2.ResumeLayout(); rx.ResumeLayout(); label.ResumeLayout(); this.m_baseWnd.ResumeLayout(); this.m_baseWnd.PerformLayout(); }
private void ParseValues(string value_string, bool are_post_values) { //Console.WriteLine("values: " + value_string); string[] seps = { "&", ";" }; string[] pairs = value_string.Split(seps, StringSplitOptions.RemoveEmptyEntries); foreach (string pair in pairs) { string[] seps2 = { "=" }; string[] parts = pair.Split(seps2, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) {//found a key/value pair ValuePair vp = new ValuePair(); vp.key = parts[0]; vp.value = UnEscape(parts[1]); if (are_post_values) post_values.Add(vp); else query_values.Add(vp); } } }
public void AddShake(float amplitude, float duration) { ValuePair vp = new ValuePair(amplitude, duration); shake.Add(vp); }
static SourceWindow() { _defaultWndsize = DesignerClient.Instance.DefaultWndsize; }