Ejemplo n.º 1
0
        public Dictionary<string, string> Read(Guid Id, TablesNames tableName)
        {
            TableInform table;
            DbConnection connection;
            DataRow result;

            connection = TableInform.Connection;
            table = new TableInform(tableName.ToString());

            DataRow dr = table.Table.AsEnumerable().SingleOrDefault(r => r.Field<Guid>("ID") == Id);
            var dict = table.ConvertRowToDict(dr);
            return dict;
        }
Ejemplo n.º 2
0
        public List<Dictionary<string, string>> ReadAll(TablesNames tableName, Gender gender)
        {
            TableInform table;
            DbConnection connection;
            DataRow[] rows;
            List<Dictionary<string, string>> resultedList;

            connection = TableInform.Connection;
            resultedList = new List<Dictionary<string, string>>();
            table = new TableInform(tableName.ToString());

            if (gender == Gender.NotSpecified)
            {
                rows = table.Table.Select();
            }
            else
            {
                string param = String.Format("LEAGUE = '{0}'", gender.ToString());
                rows = table.Table.Select(param);
            }

            foreach (var row in rows)
            {
                var result = table.ConvertRowToDict(row);
                resultedList.Add(result);
            }
            return resultedList;
        }
Ejemplo n.º 3
0
        public List<Dictionary<string, string>> FindSerchResults(string serchableName, TablesNames tableName, Gender gender)
        {
            TableInform table;
            DbConnection connection;
            List<Dictionary<string, string>> result;

            result = new List<Dictionary<string, string>>();
            connection = TableInform.Connection;
            table = new TableInform(tableName.ToString());

            var rowList = table.Table.AsEnumerable().Where(r => r.Field<string>("Name").Contains(serchableName.ToUpper())).ToList();

            if (rowList.Count > 0)
            {
                foreach (var row in rowList)
                {
                    if (row.Field<string>("League") == gender.ToString())
                    {
                        result.Add(table.ConvertRowToDict(row));
                    }
                }
                return result;
            }
            return null;
        }
Ejemplo n.º 4
0
        private List<Dictionary<string, string>> ReadByIds(TablesNames tableName, List<Guid> idList)
        {
            TableInform table;
            List<Dictionary<string, string>> resultedList;

            resultedList = new List<Dictionary<string, string>>();
            table = new TableInform(tableName.ToString());

            if (idList.Count > 0)
            {
                foreach (var id in idList)
                {
                    var row = (from r in table.Table.AsEnumerable()
                               where r.Field<Guid>("Id") == id
                               select r).SingleOrDefault();

                    var result = table.ConvertRowToDict(row);
                    resultedList.Add(result);
                }
                return resultedList;
            }
            return null;
        }