Esempio n. 1
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());
     }
 }
Esempio n. 2
0
 public static List <GroupData> GetAllFromDB()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
Esempio n. 3
0
 public List <ContactData> GetContacts()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from c in db.Contacts from gcr in db.GCR.Where(p => p.GroupId == Id && p.ContactId == c.Id && c.DateTo == "0000-00-00 00:00:00") select c).Distinct().ToList());
     }
 }
Esempio n. 4
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());
     }
 }
Esempio n. 5
0
 public static List <ContactData> GetAll()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Contacts.Where(x => x.Active == "0000-00-00 00:00:00") select g).ToList());
     }
 }
Esempio n. 6
0
 public List<ContactData> GetContactsWithGroup(string groupId)
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return (from c in db.Contacts from gcr in db.GCR.Where(p => p.GroupId == groupId && p.ContactId == c.Id && c.Deprecated == "0000-00-00 00:00:00") select c).Distinct().ToList();
     }
 }
Esempio n. 7
0
 public static List <GroupData> GetAll()
 {
     //соединение и закрытие подключения автоматически
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
Esempio n. 8
0
 public static List <GroupData> GetAll()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups select g).ToList());
         // db.Close(); не надо прописывать, т.к. автоматом закрывается
     }
 }
Esempio n. 9
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());
     }
 }
Esempio n. 10
0
 public List <GroupContactRelation> GetRelations()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from gcr in db.GCR
                 select gcr).Distinct().ToList());
     }
 }
Esempio n. 11
0
 public List <GroupData> GetGroups()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups
                 from gcr in db.GCR.Where(p => p.GroupId == g.Id && p.ContactId == Id && g.Deprecated == "0000-00-00 00:00:00")
                 select g).Distinct().ToList());
     }
 }
Esempio n. 12
0
 public static List <GroupData> GetGroups()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups
                 from gcr in db.GCR.Where(p => p.Groupid == g.Id)
                 select g).Distinct().ToList());
     }
 }
Esempio n. 13
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") //проверяем, что контакт не удален
                 orderby c.Modified ascending                                            //сортируем по дате модификации, чтобы каждый раз модифицировался новый контакт
                 select c).ToList());
     }
 }