Exemple #1
0
 /// <summary>
 /// Gets a TrackingList object with the (current) bound data in the table
 /// </summary>
 /// <param name="allowCache">Determines whether or not to force a full table read for the request, deny cache usage for fetching data on the first call to this method.</param>
 /// <returns>A TrackingList object with the (current) bound data in the table</returns>
 public TrackingList <T> GetData(bool allowCache)
 {
     if ((allowCache) && (OpenData != null))
     {
         return(OpenData);
     }
     OpenData.Clear();
     using (SQLiteCommand command = new SQLiteCommand("SELECT * FROM " + TableName, DBConnection))
     {
         using (SQLiteDataReader reader = command.ExecuteReader())
         {
             while (reader.Read())
             {
                 T obj = Activator.CreateInstance <T>();
                 foreach (AttributeProperty property in Properties)
                 {
                     property.propertyInfo.SetValue(obj, reader[property.attribute.column]);
                 }
                 IDField.SetValue(obj, reader["id"]);
                 OpenData.PreAdd(obj);
             }
         }
     }
     return(OpenData);
 }
Exemple #2
0
            public object GetValueByOriName(string field)
            {
                if (curRow >= 0 && curRow < values.Count)
                {
                    if (DocumentField.Equals(field))
                    {
                        return(values[curRow]);
                    }
                    else if (IDField.Equals(field))
                    {
                        return(values[curRow][IDField]);
                    }
                }

                return(DBNull.Value);
            }
        protected override void LoadWindowsForm()
        {
            //CountryData.ID = this.ID;
            base.LoadWindowsForm();

            this.FormId = obj.GetType().GetProperty("ID").GetValue(obj, null);
            this.FID    = (int)FormId;

            this.CodeField = obj.GetType().GetProperty("CodeField").GetValue(obj, null);
            this.FCode     = CodeField.ToString();

            this.IDField     = obj.GetType().GetProperty("IDField").GetValue(obj, null);
            this.IDFieldName = IDField.ToString();

            this.Table = obj.GetType().GetProperty("TableName").GetValue(obj, null);
            this.Tbl   = Table.ToString();

            //FndNumber.Text = CountryData.ID.ToString();
        }