/// <summary> /// Get data from SmartReference table by the matching columns of specified Id and Type. /// </summary> /// <param name="id">Match for the Id within SmartReference table.</param> /// <param name="type">Match for the Type within SmartReference table.</param> /// <returns>The query result into <see cref="IInternalState"/> object.</returns> /// <exception cref="System.InvalidOperationException">The current state of the connection is closed.</exception> public static IInternalState Get(ID id, string type) { return new AdfQuery() .Select() .From(SmartReferenceDescriber.Table) .Where(SmartReferenceDescriber.Id).IsEqual(id) .And(SmartReferenceDescriber.Type).IsEqual(type) .Run(DataSource); }
public static bool TryGetId(this SmartView view, int index, out ID id) { id = IdManager.Empty(); if (index < 0 || view.DataKeys.Count == 0 || view.DataKeys.Count <= index) return false; var dataKey = view.DataKeys[index]; if (dataKey != null) { id = (ID) dataKey.Value; return true; } return false; }
public static bool TryParse(string s, IFormatProvider provider, out ID result) { return TryParse(s, out result); }
/// <summary> /// Checks whether the specified string is a valid <see cref="ID"/>. /// </summary> /// <param name="s">The string to check.</param> /// <param name="result">The resulting <see cref="ID"/>, or the empty <see cref="ID"/> if the string is not a valid <see cref="ID"/>.</param> /// <returns> /// true if the specified string is a valid <see cref="ID"/>; otherwise, false. /// </returns> public static bool TryParse(string s, out ID result) { result = IdManager.New(s); return true; }
private void SetIndex(ID value) { var index = (DataSource as IEnumerable<IDomainObject>).IndexOf(value); PageIndex = index/PageSize; SelectedIndex = index%PageSize; DataBind(); // rebind otherwise the page is not correctly set }
protected override void OnRowCommand(GridViewCommandEventArgs e) { ID id; if (this.TryGetId(e, out id)) _currentId = id; base.OnRowCommand(e); }