Exemple #1
0
        internal void DisplaySingle(Control control, object entity)
        {
            DataGridView dataGridView = control as DataGridView;

            if (control == null || dataGridView == null)
            {
                throw new ArgumentNullException("control");
            }
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (m_columnMembers != null && m_columnMembers.Length > 0)
            {
                try
                {
                    CGridTool cGridTool = new CGridTool(dataGridView, m_columnMembers);
                    cGridTool.FillGridRowOfMember(dataGridView.CurrentRow.Index, entity);
                }
                catch
                {
                    throw;
                }
            }
        }
Exemple #2
0
 public void FillPartGridRow <T>(DataGridView dgv, int index, T entity) where T : class
 {
     try
     {
         PropertyInfo[] properties = entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty);
         if (properties == null || properties.Length <= 0)
         {
             return;
         }
         ArrayList      arrayList = new ArrayList();
         ColumnMember[] array     = m_fillEntrys[dgv] as ColumnMember[];
         if (array == null)
         {
             PropertyInfo[] array2 = properties;
             foreach (PropertyInfo propertyInfo in array2)
             {
                 if (dgv.Columns.Contains(propertyInfo.Name))
                 {
                     arrayList.Add(new ColumnMember(propertyInfo.Name, propertyInfo.Name));
                 }
             }
         }
         else
         {
             HybridDictionary hybridDictionary = new HybridDictionary(10);
             PropertyInfo[]   array3           = properties;
             foreach (PropertyInfo propertyInfo2 in array3)
             {
                 if (!hybridDictionary.Contains(propertyInfo2.Name))
                 {
                     hybridDictionary.Add(propertyInfo2.Name, null);
                 }
             }
             ColumnMember[] array4 = array;
             foreach (ColumnMember columnMember in array4)
             {
                 if (hybridDictionary.Contains(columnMember.Member))
                 {
                     arrayList.Add(columnMember);
                 }
             }
         }
         if (arrayList.Count > 0)
         {
             CGridTool cGridTool = new CGridTool(dgv, (ColumnMember[])arrayList.ToArray(typeof(ColumnMember)));
             cGridTool.FillGridRowOfMember(index, entity);
         }
     }
     catch
     {
         throw;
     }
 }