Exemple #1
0
        public static List <ChildInfo> getChildInfoFromEventId(long id)
        {
            List <ChildInfo> list = new List <ChildInfo>();

            DB db = new DB();

            DataTable items = db.query("SELECT e3.* FROM `list` e1 JOIN child e2 ON e1.id_child = e2.id JOIN child_info e3 ON e2.id_child_info = e3.id JOIN `events` e4 ON e1.id_event = e4.id WHERE e1.id_event = " + id);

            foreach (DataRow row in items.Rows)
            {
                object[] item = row.ItemArray;

                ChildInfo newChild = new ChildInfo();
                newChild.id      = Convert.ToInt32(item[0]);
                newChild.fio     = Convert.ToString(item[1]);
                newChild.dob     = Convert.ToDateTime(item[2]);
                newChild.address = Convert.ToString(item[3]);

                list.Add(newChild);
            }

            return(list);
        }
Exemple #2
0
        public static List <ChildInfo> getChildInfos()
        {
            List <ChildInfo> list = new List <ChildInfo>();

            DB db = new DB();

            DataTable items = db.query("SELECT * FROM child_info");

            foreach (DataRow row in items.Rows)
            {
                object[] item = row.ItemArray;

                ChildInfo newChildInfo = new ChildInfo();
                newChildInfo.id      = Convert.ToInt32(item[0]);
                newChildInfo.fio     = Convert.ToString(item[1]);
                newChildInfo.dob     = Convert.ToDateTime(item[2]);
                newChildInfo.address = Convert.ToString(item[3]);

                list.Add(newChildInfo);
            }

            return(list);
        }