Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 2
0
        internal override void DisplayEntity(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");
            }
            dataGridView.Rows.Clear();
            if (m_member.Trim() == string.Empty || m_columnMembers == null || m_columnMembers.Length <= 0)
            {
                return;
            }
            try
            {
                object propertyValue = PropertyHelper.GetPropertyValue(m_member, entity);
                if (propertyValue != null && propertyValue is IList)
                {
                    CGridTool cGridTool = new CGridTool(dataGridView, m_columnMembers);
                    cGridTool.FillGrid((IList)propertyValue);
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
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;
     }
 }
Ejemplo n.º 4
0
 public void FillGridRow <T>(DataGridView dgv, int index, T entity) where T : class
 {
     try
     {
         ColumnMember[] columnMembers = m_fillEntrys[dgv] as ColumnMember[];
         CGridTool      cGridTool     = new CGridTool(dgv, columnMembers);
         cGridTool.FillRow(index, entity);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 5
0
 public void AddRowRange <T>(DataGridView dgv, IList <T> list) where T : class
 {
     if (dgv != null && list != null)
     {
         try
         {
             ColumnMember[] columnMembers = m_fillEntrys[dgv] as ColumnMember[];
             CGridTool      cGridTool     = new CGridTool(dgv, columnMembers);
             cGridTool.AddRowRange(list);
         }
         catch
         {
             throw;
         }
     }
 }
Ejemplo n.º 6
0
 public void FillGrid(DataGridView dgv, IList list)
 {
     if (dgv != null)
     {
         try
         {
             ColumnMember[] columnMembers = m_fillEntrys[dgv] as ColumnMember[];
             CGridTool      cGridTool     = new CGridTool(dgv, columnMembers);
             cGridTool.FillGrid(list);
         }
         catch
         {
             throw;
         }
     }
 }