示例#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);
 }
示例#2
0
        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;
        }
示例#3
0
文件: ID.cs 项目: NLADP/ADF
 public static bool TryParse(string s, IFormatProvider provider, out ID result)
 {
     return TryParse(s, out result);
 }
示例#4
0
文件: ID.cs 项目: 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;
 }
示例#5
0
文件: SmartView.cs 项目: NLADP/ADF
        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
        }
示例#6
0
文件: SmartView.cs 项目: NLADP/ADF
        protected override void OnRowCommand(GridViewCommandEventArgs e)
        {
            ID id;

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

            base.OnRowCommand(e);
        }