public static Client GetClientById(int id) { using (ElibriumEntities db = new ElibriumEntities()) { return(db.Client.Find(id)); } }
public static Contact GetContactById(int ctId) { using (ElibriumEntities db = new ElibriumEntities()) { Contact contact = db.Contact.Where(x => x.Id == ctId).Single(); return(contact); } }
public static void DeleteClientById(int id) { using (ElibriumEntities db = new ElibriumEntities()) { Client a = db.Client.Find(id); db.Client.Remove(a); } }
public static ContactType GetContactType(int ctId) { using (ElibriumEntities db = new ElibriumEntities()) { ContactType contactType = db.ContactType.Where(x => x.Id == ctId).Single(); return(contactType); } }
public static PositionType GetPositionType(int ptId) { using (ElibriumEntities db = new ElibriumEntities()) { PositionType positionType = db.PositionType.Where(x => x.Id == ptId).Single(); return(positionType); } }
public static OfferBO GetOfferById(int id) { using (ElibriumEntities db = new ElibriumEntities()) { List <OfferBO> offers = new List <OfferBO>(); offers.Add(new OfferBO(db.Offer.Find(id))); return(offers.First()); } }
public static List <HobbyBO> GetHobbyById(int id) { using (ElibriumEntities db = new ElibriumEntities()) { List <HobbyBO> hbos = new List <HobbyBO>(); hbos.Add(new HobbyBO(db.Hobby.Find(id))); return(hbos); } }
public static PersonBO GetPersonById(int id) { using (ElibriumEntities db = new ElibriumEntities()) { List <PersonBO> cclts = new List <PersonBO>(); cclts.Add(new PersonBO(db.Person.Find(id))); return(cclts.First()); } }
public void Delete() { try { var offer = parseDomain(); ElibriumEntities db = new ElibriumEntities(); { Offer temp = db.Offer.Find(offer.Id); db.Entry(temp).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } catch { } }
public static ObservableCollection <PersonOfferBO> GetPersonOffersByOfferId(int id) { using (ElibriumEntities db = new ElibriumEntities()) { var offers = db.PersonOffer.Where(x => x.OfferId == id).ToList(); ObservableCollection <PersonOfferBO> a = new ObservableCollection <PersonOfferBO>(); foreach (var o in offers) { a.Add(new PersonOfferBO(o)); } return(a); } }
public static ObservableCollection <PersonOfferBO> GetPersonOffers(Person a) { using (ElibriumEntities db = new ElibriumEntities()) { var offers = db.PersonOffer.Where(x => x.PersonId == a.Id); ObservableCollection <PersonOfferBO> ofrs = new ObservableCollection <PersonOfferBO>(); foreach (var o in offers) { ofrs.Add(new PersonOfferBO(o)); } return(ofrs); } }
public void Delete() { try { var contact = parseDomain(); ElibriumEntities db = new ElibriumEntities(); { Contact temp = db.Contact.Find(contact.Id); db.Entry(temp).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } catch { } }
public static ObservableCollection <ContactTypeBO> GetAllContactTypes() { using (ElibriumEntities db = new ElibriumEntities()) { var contactTypes = db.ContactType.ToList(); ObservableCollection <ContactTypeBO> cts = new ObservableCollection <ContactTypeBO>(); foreach (var contactType in contactTypes) { ContactTypeBO ct = new ContactTypeBO(contactType); cts.Add(ct); } return(cts); } }
public static ObservableCollection <PositionTypeBO> GetAllPositionTypes() { using (ElibriumEntities db = new ElibriumEntities()) { var positionTypes = db.PositionType.ToList(); ObservableCollection <PositionTypeBO> cts = new ObservableCollection <PositionTypeBO>(); foreach (var positionType in positionTypes) { PositionTypeBO pt = new PositionTypeBO(positionType); cts.Add(pt); } return(cts); } }
public static ObservableCollection <PersonBO> GetPersonsByClientId(int id) { using (ElibriumEntities db = new ElibriumEntities()) { var Persons = db.Person.Where(x => x.ClientId == id); ObservableCollection <PersonBO> ccs = new ObservableCollection <PersonBO>(); foreach (var clc in Persons) { PersonBO cc = new PersonBO(clc); ccs.Add(cc); } return(ccs); } }
public static ObservableCollection <OfferBO> GetAllOffers() { using (ElibriumEntities db = new ElibriumEntities()) { var offers = db.Offer.ToList(); ObservableCollection <OfferBO> ofrs = new ObservableCollection <OfferBO>(); foreach (var o in offers) { OfferBO cc = new OfferBO(o); ofrs.Add(cc); } return(ofrs); } }
public static bool ContactTypeInUse(ContactType a) { using (ElibriumEntities db = new ElibriumEntities()) { var Contacts = db.Contact.Where(x => x.ContactTypeId == a.Id); if (Contacts.Count() > 0) { return(true); } else { return(false); } } }
public void Delete() { PositionType PositionType = parseDomain(); ElibriumEntities db = new ElibriumEntities(); { try { PositionType temp = db.PositionType.Find(PositionType.Id); db.Entry(temp).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } catch { } } }
public static bool PositionTypeInUse(PositionType a) { using (ElibriumEntities db = new ElibriumEntities()) { var Positions = db.Person.Where(x => x.PositionTypeId == a.Id); if (Positions.Count() > 0) { return(true); } else { return(false); } } }
public void Delete() { try { var personOffer = parseDomain(); using (ElibriumEntities db = new ElibriumEntities()) { PersonOffer temp = db.PersonOffer.Find(personOffer.Id); db.Entry(temp).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } catch { } }
public static void AddEmail() { using (ElibriumEntities db = new ElibriumEntities()) { ContactType temp = db.ContactType.Find(1); if (temp != null) { temp.Name = "Email"; db.Entry(temp).State = System.Data.Entity.EntityState.Modified; } else { //run the script here } db.SaveChanges(); } }
public static ObservableCollection <ContactBO> GetPersonContacts(Person a) { using (ElibriumEntities db = new ElibriumEntities()) { var Contacts = db.Contact.Where(x => x.PersonId == a.Id); ObservableCollection <ContactBO> ccs = new ObservableCollection <ContactBO>(); if (Contacts.Count() > 0) { foreach (var clc in Contacts) { ContactBO cc = new ContactBO(clc); ccs.Add(cc); } } return(ccs); } }
public static ObservableCollection <PersonBO> GetPersonsWithBirthdays() { using (ElibriumEntities db = new ElibriumEntities()) { ObservableCollection <PersonBO> ccs = new ObservableCollection <PersonBO>(); if (db.Person.Count() > 0) { var Persons = db.Person.Where(x => x.DBO.Day == DateTime.Now.Day && x.DBO.Month == DateTime.Now.Month).ToList(); foreach (var clc in Persons) { PersonBO cc = new PersonBO(clc); ccs.Add(cc); } } return(ccs); } }
public static ObservableCollection <PersonBO> GetAllPersons() { using (ElibriumEntities db = new ElibriumEntities()) { ObservableCollection <PersonBO> ccs = new ObservableCollection <PersonBO>(); if (db.Person.Count() > 0) { var Persons = db.Person.ToList(); foreach (var clc in Persons) { PersonBO cc = new PersonBO(clc); ccs.Add(cc); } } return(ccs); } }
public static ContactBO GetSpecificContactForPerson(int contactType, Person a) { using (ElibriumEntities db = new ElibriumEntities()) { var Contacts = db.Contact.Where(x => x.ContactTypeId == contactType && x.PersonId == a.Id); ObservableCollection <ContactBO> ccs = new ObservableCollection <ContactBO>(); Contact contact = Contacts.FirstOrDefault(); if (contact != null) { return(new ContactBO(contact)); } else { return(null); } } }
public static ObservableCollection <PersonOfferBO> GetPersonOffersForClient(int id) { using (ElibriumEntities db = new ElibriumEntities()) { ObservableCollection <PersonBO> persons = PersonService.GetPersonsByClientId(id); ObservableCollection <PersonOfferBO> offer = new ObservableCollection <PersonOfferBO>(); foreach (PersonBO person in persons) { ObservableCollection <PersonOfferBO> ofrs = GetPersonOffers((person).parseDomain()); foreach (PersonOfferBO ofr in ofrs) { offer.Add(ofr); } } return(offer); } }
public void Delete() { try { var client = parseDomain(); ElibriumEntities db = new ElibriumEntities(); { Person temp = db.Person.Find(client.Id); db.Entry(temp).State = System.Data.Entity.EntityState.Deleted; List <Contact> temp2 = db.Contact.Where(i => Id == temp.Id).ToList(); foreach (Contact item in temp2) { } db.SaveChanges(); } }catch { } }
public void AddOrUpdate() { var contactType = parseDomain(); using (ElibriumEntities db = new ElibriumEntities()) { if (_isNew) { db.ContactType.Add(contactType); } else { ContactType temp = db.ContactType.Find(contactType.Id); temp.Name = contactType.Name; db.Entry(temp).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); } }
public static ObservableCollection <ClientBO> GetAllClients() { List <ClientBO> clts = new List <ClientBO>(); var clients = new List <Client>(); using (ElibriumEntities db = new ElibriumEntities()) { if (db.Client.Count() > 0) { clients = db.Client.ToList(); foreach (var client in clients) { ClientBO clt = new ClientBO(client); clts.Add(clt); } } } return(new ObservableCollection <ClientBO>(clts)); }
public static ObservableCollection <EmailTemplateBO> GetAllEmailTemplates() { ObservableCollection <EmailTemplateBO> ets = new ObservableCollection <EmailTemplateBO>(); var emailTemplates = new List <EmailTemplate>(); using (ElibriumEntities db = new ElibriumEntities()) { if (db.Client.Count() > 0) { emailTemplates = db.EmailTemplate.ToList(); foreach (var et in emailTemplates) { EmailTemplateBO clt = new EmailTemplateBO(et); ets.Add(clt); } } } return(ets); }