コード例 #1
0
		// lay ra mot mang cac value ung voi mang PropertyInfo
		
		public object[] GetPropertyValues(DBEntry entry,PropertyInfo[] PInfors)
		{
			int count=0;
			object[] CatchLists=new object[PInfors.Length];
			try
			{
				foreach (PropertyInfo Pi in PInfors)
				{
					CatchLists[count]=GetPropertyValue(entry,Pi);
					count++;
				}
			}
			
			catch (Exception EX)
			{
				Except.SetException(EX);
			}
			return CatchLists;

		}
コード例 #2
0
		// Chi nhung thuoc tinh ung voi cac Field cua DBEntry

		public PropertyInfo[] GetFilterProperties(DBEntry entry)
		{
			PropertyInfo[] ListObject=new PropertyInfo[entry.FieldCount];
			PropertyInfo[] Properties=GetAllProperties(entry);
			string[] ListFields=entry.GetListFields();
			string[] AllListNames=GetPropertyNames(Properties);
			try
			{
				for (int count=0;count<ListFields.Length;count++)
				{
					for (int i=0;i<AllListNames.Length;i++)
					{
						if (ListFields[count].ToLower()==AllListNames[i].ToLower())
						{
							ListObject[count]=Properties[i];
							break;
						} 
						else
						{ continue; }
					}
				}
			}
			catch (Exception EX)
			{
				Except.SetException(EX);
			}
			return ListObject;
		}
コード例 #3
0
		// Lay mot gia tri cua 1 thuoc tinh nao do trong Entry

		public object GetPropertyValue(DBEntry entry,PropertyInfo Pinfo)
		{
			object Catchvalue=null;
			object[] Attributes=Pinfo.GetCustomAttributes(typeof(DBPropertyAttribute),false);
			if (Attributes.Length==1)
			{
				try
				{
					MethodInfo Mi=Pinfo.GetGetMethod(false);
					object result=Mi.Invoke(entry,null);
					Catchvalue=result;
				}
				catch (Exception EX)
				{
					Except.SetException(EX);
				}
			}
			return Catchvalue;
		}
コード例 #4
0
				// All Property ung voi cac Field cua DBEntry

		public PropertyInfo[] GetAllProperties(DBEntry entry)
		{
			Type T=entry.GetType();
			PropertyInfo[] Properties=T.GetProperties(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public);
			return Properties;
		}