public static List <ContactData> GetActiveRecordsFromDB() { List <ContactData> contacts = new List <ContactData>(); using (AddressBookDB db = new AddressBookDB()) { /** c.Deprecated.Year == 0 - picks out only active records * which weren't removed from UI **/ contacts = (from c in db.Contacts where c.DeprecationDate.Year == 0 select c ).ToList(); } // Process records to get them in proper format to compare with records from // UI representation level List <ContactData> contacts2 = new List <ContactData>(); foreach (ContactData c in contacts) { contacts2.Add(Utils.PrepareEntityForContactsView(c)); } return(contacts2); }
public static List <GroupData> GetAllFromDB() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); //запрос в БД списка групп } }
public static List <AddressData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from a in db.Address.Where(x => x.Deprecated == "0000-00-00 00:00:00") select a).ToList()); } }
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()); }//закрывается база данных автоматически }
public static List <GroupData> GetGroupWithContacts() { using (AddressBookDB db = new AddressBookDB()) { return(db.Groups.Where(x => x.Deprecated == "0000-00-00 00:00:00" && db.GCR.Select(y => y.GroupId).Contains(x.Id)).ToList()); } }
public List <ContactData> GetContacts() { using (AddressBookDB db = new AddressBookDB()) { // for auto close DB at the end using 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()); }; }
public static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); } }
public static List <ContactData> GetAll() { using (AddressBookDB addressBookDB = new AddressBookDB()) { return((from g in addressBookDB.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") select g).ToList()); } }
public static GroupData GetNonEmptyGroup() { List <GroupData> groups = new List <GroupData>(); using (AddressBookDB db = new AddressBookDB()) { groups = (from g in db.Groups select g).ToList(); if (groups.Count() == 0) { // Nothing to process further, so we return 'null' right here return(null); } } foreach (GroupData group in groups) { if (group.GetContacts().Count() > 0) { return(group); } } // if no proper object were found return 'null' return(null); }
public static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups.Where(x => x.Depricated == "0000 - 00 - 00 00:00:00") select g).ToList()); } }
static public 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()); } }
public static List <ContactData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { // for auto close DB at the end using return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") select c).ToList()); }; }
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()); //возвращает список контактов, у которыйх в Deprecated указанное значение } }
public List <ContactData> GetContactsListWithGroup(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()); } }
public static List <ContactData> GetContactsWithoutGroup() { using (AddressBookDB db = new AddressBookDB()) { return(db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00" && !db.GCR.Select(y => y.ContactId).Contains(x.Id)).ToList()); } }
public List <GroupData> GetGroupWithContacts() { using (AddressBookDB db = new AddressBookDB()) { return(db.Groups.Where(g => db.GCR.Any(gcr => gcr.GroupId == g.Id) && g.Deprecated == "0000-00-00 00:00:00").Distinct().ToList()); } }
public static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); }//закрывается база данных автоматически }
public List <GroupContactRelation> ContactEnteredToGroup(string contactId, string groupId) { using (AddressBookDB db = new AddressBookDB()) { return((from gcr in db.GCR.Where(p => p.ContactId == contactId && p.GroupId == groupId) select gcr).Distinct().ToList()); } }
public static List <ContactData> GetAllFromDB() { using (AddressBookDB db = new AddressBookDB()) { return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:0") select c).ToList()); //запрос в БД списка групп } }
public static List <ContactData> GetContactDatafromDB(string firstname) { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00" && x.Firstname == firstname) select g).ToList()); } }
public List <ContactsData> GetContacts() { using (AddressBookDB db = new AddressBookDB()) { return((from c in db.Contacts from gsr in db.GCR.Where(p => p.GroupId == Id && p.ContactId == c.Id) select c).Distinct().ToList()); } }
public static ContactData GetLastContact() { using (AddressBookDB db = new AddressBookDB()) { List <ContactData> contacts = (from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") select c).ToList(); return(contacts.Last()); } }
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.Deprecated == "0000 - 00 - 00 00:00:00") select c).Distinct().ToList()); //возвращает список из бд } }
public List <GroupData> GetGroupsByContact() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups from gcr in db.GCR.Where(p => p.ContactId == Id && p.GroupId == g.Id) select g).ToList()); } }
public List <ContactData> GetContacts() { using (AddressBookDB addressBookDB = new AddressBookDB()) { return((from c in addressBookDB.Contacts from gcr in addressBookDB.GCR.Where(p => p.GroupId == Id && p.ContactId == c.Id && c.Deprecated == "0000-00-00 00:00:00") select c).ToList()); } }
public List <UserData> 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.Deprecated == "0000-00-00 00:00:00") select c).Distinct().ToList()); } }
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()); } }
public List <AddressData> GetAddresses() { using (AddressBookDB db = new AddressBookDB()) { return((from a in db.Addresses from gar in db.GAR.Where(p => p.GroupID == ID && p.AddresssID == a.ID) select a).Distinct().ToList()); } }
public List <AddressData> GetAddress() { using (AddressBookDB db = new AddressBookDB()) { return((from a in db.Address from gar in db.GAR.Where(p => p.GroupId == Id && p.AddressId == a.Id && a.Deprecated == "0000-00-00 00:00:00") select a).Distinct().ToList()); } }
public void SelectGroupToRemove(string groupId, string contactId) { using (AddressBookDB db = new AddressBookDB()) { (from gcr in db.GCR .Where(t => t.ContactId == contactId && t.GroupId == groupId) select gcr).Delete(); } }