예제 #1
0
 // Methods
 public DocumentContainer()
 {
     m_AllContainer = new SortableList();
       m_IndexList = new SortedList();
       m_SupportedType = typeof (BusinessDocument);
       m_SupportsFullKey = true;
       foreach (
     EntityGeneralAttribute attribute1 in base.GetType().GetCustomAttributes(typeof (EntityGeneralAttribute), false))
       {
     if (attribute1 is SupportsFullKeyAttribute)
     {
       m_SupportsFullKey = (bool) attribute1.Value;
     }
     else if (attribute1 is SupportedTypeAttribute)
     {
       m_SupportedType = (Type) attribute1.Value;
     }
       }
 }
예제 #2
0
 private SortableList GetModifiedDocs()
 {
     SortableList list1 = new SortableList();
       foreach (BusinessDocument document1 in m_AllContainer)
       {
     if (document1.__DocumentState == DocumentState.Modified)
     {
       list1.Add(document1);
     }
       }
       return list1;
 }
예제 #3
0
 private DataTable GetDocsInDataTable(SortableList DocsContainer, bool usePrefix)
 {
     FieldInfo info1;
       DataTable table1 = new DataTable();
       FieldInfo[] infoArray1 = m_SupportedType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
       int num1 = infoArray1.Length;
       for (int num2 = 0; num2 < num1; num2++)
       {
     info1 = infoArray1[num2];
     Type type1 = info1.FieldType;
     object[] objArray1 = info1.GetCustomAttributes(typeof (BindingFieldAttribute), false);
     if (objArray1.Length > 0)
     {
       BindingFieldAttribute attribute1 = (BindingFieldAttribute) objArray1[0];
       if (info1.FieldType == typeof (DBBinary))
       {
     type1 = typeof (byte[]);
       }
       else if (info1.FieldType == typeof (DBByte))
       {
     type1 = typeof (byte[]);
       }
       else if (info1.FieldType == typeof (DBDateTime))
       {
     type1 = typeof (DateTime);
       }
       else if (info1.FieldType == typeof (DBDecimal))
       {
     type1 = typeof (decimal);
       }
       else if (info1.FieldType == typeof (DBDouble))
       {
     type1 = typeof (double);
       }
       else if (info1.FieldType == typeof (DBGuid))
       {
     type1 = typeof (Guid);
       }
       else if (info1.FieldType == typeof (DBInt))
       {
     type1 = typeof (int);
       }
       else if (info1.FieldType == typeof (DBInt16))
       {
     type1 = typeof (short);
       }
       else if (info1.FieldType == typeof (DBInt64))
       {
     type1 = typeof (long);
       }
       else if (info1.FieldType == typeof (DBString))
       {
     type1 = typeof (string);
       }
       string text1 = usePrefix ? ((string) attribute1.Value) : info1.Name.Substring(2);
       DataColumn column1 = new DataColumn(text1, type1);
       table1.Columns.Add(column1);
     }
       }
       foreach (BusinessDocument document1 in DocsContainer.Items)
       {
     DataRow row1 = table1.NewRow();
     for (int num3 = 0; num3 < num1; num3++)
     {
       info1 = infoArray1[num3];
       object[] objArray2 = info1.GetCustomAttributes(typeof (BindingFieldAttribute), false);
       if (objArray2.Length > 0)
       {
     string text2 = usePrefix ? ((string) ((BindingFieldAttribute) objArray2[0]).Value) : info1.Name.Substring(2);
     object obj1 = info1.GetValue(document1);
     if (info1.FieldType == typeof (DBBinary))
     {
       DBBinary binary1 = obj1 as DBBinary;
       if (binary1.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = (byte[]) obj1;
       }
     }
     else if (info1.FieldType == typeof (DBByte))
     {
       DBByte num4 = obj1 as DBByte;
       if (num4.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToByte(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBDateTime))
     {
       DBDateTime time1 = obj1 as DBDateTime;
       if (time1.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToDateTime(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBDecimal))
     {
       DBDecimal num5 = obj1 as DBDecimal;
       if (num5.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToDecimal(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBDouble))
     {
       DBDouble num6 = obj1 as DBDouble;
       if (num6.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToDouble(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBGuid))
     {
       DBGuid guid1 = obj1 as DBGuid;
       if (guid1.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = guid1.Value;
       }
     }
     else if (info1.FieldType == typeof (DBInt))
     {
       DBInt num7 = obj1 as DBInt;
       if (num7.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToInt32(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBInt16))
     {
       DBInt16 num8 = obj1 as DBInt16;
       if (num8.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToInt16(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBInt64))
     {
       DBInt64 num9 = obj1 as DBInt64;
       if (num9.IsNull)
       {
         row1[text2] = DBNull.Value;
       }
       else
       {
         row1[text2] = Convert.ToInt64(obj1);
       }
     }
     else if (info1.FieldType == typeof (DBString))
     {
       row1[text2] = Convert.ToString(obj1);
     }
     else if (info1.FieldType == typeof (bool))
     {
       row1[text2] = Convert.ToBoolean(obj1);
     }
       }
     }
     table1.Rows.Add(row1);
       }
       SetPrimaryKeys(table1);
       return table1;
 }
예제 #4
0
 private DataTable GetDocsInDataTable(SortableList DocsContainer)
 {
     return GetDocsInDataTable(DocsContainer, false);
 }
예제 #5
0
 private SortableList GetCurrentDocs()
 {
     SortableList list1 = new SortableList();
       foreach (BusinessDocument document1 in m_AllContainer)
       {
     if (document1.__DocumentState != DocumentState.Deleted)
     {
       list1.Add(document1);
     }
       }
       return list1;
 }
예제 #6
0
 public DataTable GetAsDataTable(SortableList DocsContainer, bool usePrefix)
 {
     return GetDocsInDataTable(DocsContainer, usePrefix);
 }