示例#1
0
 public static List <GroupData> GetAll()
 {
     using (AddressBookDb db = new AddressBookDb())
     {
         return((from g in db.Groups.Where(x => x.Deprecated == "0000-00-00 00:00:00") select g).ToList());
     }
 }
示例#2
0
 public static List <ContactData> GetAll()
 {
     using (AddressBookDb db = new AddressBookDb())
     {
         return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") select c).ToList());
     }
 }
示例#3
0
 public static List <GroupData> GetAll()
 {
     using (var db = new AddressBookDb())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
示例#4
0
 public List <ContactData> GetContacts()
 {
     using (AddressBookDb db = new AddressBookDb())
     {
         return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00")
                 from gcr in db.GCR.Where(rel => rel.GroupId == Id && rel.ContactId == c.Id)
                 select c).Distinct().ToList());
     }
 }
示例#5
0
 public void ExecuteCmd(string cmd)
 {
     using (var db = new AddressBookDb())
     {
         var command = db.CreateCommand();
         command.CommandText = cmd;
         command.ExecuteNonQuery();
     }
 }
示例#6
0
 public List <ContactData> GetContacts()
 {
     using (var db = new AddressBookDb())
     {
         return((from c in db.Contacts
                 from gcr in db.GCR.Where(p => p.GroupID == Id && p.ContactID == c.Id && c.Deprecated == "0000-00-00 00:00:00")
                 select c).Distinct().ToList());
     }
 }
示例#7
0
        public static GroupData GetGroupWithContacts()
        {
            using (AddressBookDb db = new AddressBookDb())
            {
                // get all relations
                GroupContactRelation firstRelation = (from gcr in db.GCR select gcr).ToList().First();

                // get first relation and get group using group_id
                GroupData group = (from g in db.Groups where g.Id == firstRelation.GroupId select g).First();
                return(group);
            }
        }