Exemple #1
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);
        }
Exemple #2
0
        // Lay mot 1 Kieu cua mot thuoc tinh nao do trong Entry

        public System.Data.OleDb.OleDbType GetPropertyType(PropertyInfo Pinfo)
        {
            System.Data.OleDb.OleDbType Catchtype = 0;
            object[] Attributes = Pinfo.GetCustomAttributes(typeof(DBPropertyAttribute), false);
            if (Attributes.Length == 1)
            {
                try
                {
                    DBPropertyAttribute Attrib = (DBPropertyAttribute)Attributes[0];
                    Catchtype = Attrib.PropertyType;
                }
                catch (Exception EX)
                {
                    Except.SetException(EX);
                }
            }
            return(Catchtype);
        }
Exemple #3
0
        // lay ra mot mang cac Kieu thuoc tinh ung voi mang PropertyInfo

        public System.Data.OleDb.OleDbType[] GetPropertyTypes(PropertyInfo[] PInfors)
        {
            int count = 0;

            System.Data.OleDb.OleDbType[] CatchLists = new System.Data.OleDb.OleDbType[PInfors.Length];
            try
            {
                foreach (PropertyInfo Pi in PInfors)
                {
                    CatchLists[count] = GetPropertyType(Pi);
                    count++;
                }
            }
            catch (Exception EX)
            {
                Except.SetException(EX);
            }
            return(CatchLists);
        }
Exemple #4
0
        // lay ra mot mang cac ten tuy bien(Attriubute) ung voi mang PropertyInfo

        public string[] GetPropertyNames(PropertyInfo[] PInfors)
        {
            int count = 0;

            string[] CatchLists = new string[PInfors.Length];
            try
            {
                foreach (PropertyInfo Pi in PInfors)
                {
                    CatchLists[count] = GetPropertyName(Pi);
                    count++;
                }
            }
            catch (Exception EX)
            {
                Except.SetException(EX);
            }
            return(CatchLists);
        }
Exemple #5
0
        // Lay length cua Field

        public int GetPropertyLength(PropertyInfo Pinfo)
        {
            int Catchint = 0;

            object[] Attributes = Pinfo.GetCustomAttributes(typeof(DBPropertyAttribute), false);
            if (Attributes.Length == 1)
            {
                try
                {
                    DBPropertyAttribute Attrib = (DBPropertyAttribute)Attributes[0];
                    Catchint = Attrib.Length;
                }
                catch (Exception EX)
                {
                    Except.SetException(EX);
                }
            }
            return(Catchint);;
        }
Exemple #6
0
        // Lay mot ten tuy bien(AttributeName) cua 1 thuoc tinh nao do trong Entry

        public string GetPropertyName(PropertyInfo Pinfo)
        {
            string Catchname = "";

            object[] Attributes = Pinfo.GetCustomAttributes(typeof(DBPropertyAttribute), false);
            if (Attributes.Length == 1)
            {
                try
                {
                    DBPropertyAttribute Attrib = (DBPropertyAttribute)Attributes[0];
                    Catchname = Attrib.PropertyName;
                }
                catch (Exception EX)
                {
                    Except.SetException(EX);
                }
            }
            return(Catchname);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }