Esempio n. 1
0
        //Lay chi so cua moi gia tri khac nhau cua thuoc tinh
        public static List <IndexValueOfAttributes> GetIndexValueOfAttribute(DataTable data, List <string> differentAttributenames, int columnIndex)
        {
            List <IndexValueOfAttributes> IndexOfDifferentAttributeNames = new List <IndexValueOfAttributes>();

            foreach (var item in differentAttributenames)
            {
                IndexOfDifferentAttributeNames.Add(IndexValueOfAttributes.GetIndexValueOfAttributes(data, item, columnIndex));
            }

            return(IndexOfDifferentAttributeNames);
        }
        public static IndexValueOfAttributes GetIndexValueOfAttributes(DataTable data, string value, int columnIndex)
        {
            List <int> index = new List <int>();

            for (int i = 0; i < data.Rows.Count; i++)
            {
                if (data.Rows[i][columnIndex].ToString().Equals(value))
                {
                    index.Add(i);
                }
            }

            IndexValueOfAttributes IndexValue = new IndexValueOfAttributes(value, index);

            return(IndexValue);
        }