예제 #1
0
 public static Client GetClientById(int id)
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         return(db.Client.Find(id));
     }
 }
예제 #2
0
 public static Contact GetContactById(int ctId)
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         Contact contact = db.Contact.Where(x => x.Id == ctId).Single();
         return(contact);
     }
 }
예제 #3
0
 public static void DeleteClientById(int id)
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         Client a = db.Client.Find(id);
         db.Client.Remove(a);
     }
 }
예제 #4
0
 public static ContactType GetContactType(int ctId)
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         ContactType contactType = db.ContactType.Where(x => x.Id == ctId).Single();
         return(contactType);
     }
 }
예제 #5
0
 public static PositionType GetPositionType(int ptId)
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         PositionType positionType = db.PositionType.Where(x => x.Id == ptId).Single();
         return(positionType);
     }
 }
예제 #6
0
 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());
     }
 }
예제 #7
0
 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);
     }
 }
예제 #8
0
 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());
     }
 }
예제 #9
0
 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 { }
 }
예제 #10
0
 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);
     }
 }
예제 #11
0
 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);
     }
 }
예제 #12
0
 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 { }
 }
예제 #13
0
 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);
     }
 }
예제 #14
0
 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);
     }
 }
예제 #15
0
 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);
     }
 }
예제 #16
0
 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);
     }
 }
예제 #17
0
 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);
         }
     }
 }
예제 #18
0
 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
         {
         }
     }
 }
예제 #19
0
 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);
         }
     }
 }
예제 #20
0
 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
     {
     }
 }
예제 #21
0
 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();
     }
 }
예제 #22
0
 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);
     }
 }
예제 #23
0
 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);
     }
 }
예제 #24
0
 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);
     }
 }
예제 #25
0
 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);
         }
     }
 }
예제 #26
0
 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);
     }
 }
예제 #27
0
 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
     {
     }
 }
예제 #28
0
        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();
            }
        }
예제 #29
0
        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));
        }
예제 #30
0
        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);
        }