Example #1
0
 /// <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;
        }
Example #3
0
File: ID.cs Project: NLADP/ADF
 public static bool TryParse(string s, IFormatProvider provider, out ID result)
 {
     return TryParse(s, out result);
 }
Example #4
0
File: ID.cs Project: NLADP/ADF
 /// <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;
 }
Example #5
0
        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
        }
Example #6
0
        protected override void OnRowCommand(GridViewCommandEventArgs e)
        {
            ID id;

            if (this.TryGetId(e, out id)) _currentId = id;

            base.OnRowCommand(e);
        }