Beispiel #1
0
        public IEnumerable<Contact> search()
        {
            List<Contact> ContactsList = new List<Contact>();

            string qu1 = string.Format(@"select * from contact where owner_id = '{0}';", ownerId);
            SQLiteDataReader data = db.selectQuery(qu1);
            while (data.Read())
            {
                Contact newContact = new Contact();
                newContact.name = data["contact_name"].ToString();
                newContact.email = data["contact_email"].ToString();
                newContact.ownerId = Convert.ToInt32(data["owner_id"]);
                newContact.id = Convert.ToInt32(data["contact_id"]);

                ContactsList.Add(newContact);

            }

            IEnumerable<Contact> d = (IEnumerable<Contact>)ContactsList;
            data.Close();
            return d;
        }
Beispiel #2
0
        public IEnumerable<Contact> getContacts()
        {
            List<Contact> contacts = new List<Contact>();

            string qy1 = string.Format(@"select * from contact_category 
            inner join contact on `contact_category`.`contact_id` = `contact`.`contact_id`
            where category_id = '{0}';", this.id);

            SQLiteDataReader data = db.selectQuery(qy1);
            
            while (data.Read())
            {
                Contact nc = new Contact();
                nc.id = Convert.ToInt32(data["contact_id"]);
                nc.name = data["contact_name"].ToString();
                nc.email = data["contact_email"].ToString();
                nc.ownerId = Convert.ToInt32(data["owner_id"]);

                contacts.Add(nc);
            }
            data.Close();

            IEnumerable<Contact> EnumContacts = (IEnumerable<Contact>)contacts;

            return EnumContacts;
        }