Esempio n. 1
0
        public virtual bool Equals(Diver obj)
        {
            if (obj == null) return false;

              if (Equals(Notes, obj.Notes) == false)
            return false;

              if (Equals(RestingSacRate, obj.RestingSacRate) == false)
            return false;

              if (Equals(WorkingSacRate, obj.WorkingSacRate) == false)
            return false;

              return true;
        }
Esempio n. 2
0
        public Diver Save(Diver diver)
        {
            try
            {
                diver.LastModifed = System.DateTime.Now;

                DiverRepository.SaveOrUpdate(diver);
                DiverRepository.DbContext.CommitChanges();
            }
            catch (Exception e)
            {
                log.Error("Unable to save diver ", e);
                throw e;
            }
            return diver;
        }
Esempio n. 3
0
        public Diver Delete(Diver diver)
        {
            Diver retVal = new Diver();

            try
            {
                DiverRepository.Delete(diver);
                DiverRepository.DbContext.CommitChanges();
            }
            catch (Exception e)
            {
                log.Error("Cound not delete diver. Something else probably references this contact",e);
                throw e;
            }
            return retVal;
        }
Esempio n. 4
0
        private void saveNewContact(ContactModel model)
        {
            this.user = userServices.FindUser(this.User.Identity.Name);
              Contact contact = new Contact();
              contact = UpdateContactFromModel(contact, model);
              contact.User = this.user;
              contact.Created = DateTime.Now;
              contact.LastModified = DateTime.Now;
              contactServices.Save(contact);

              if (model.isDiver) {
            Diver diver = new Diver();
            diver.Contact = contact;
            diverServices.Save(diver);
              }
              if (model.isInstructor) {
            Instructor instructor = new Instructor();
            instructor.Contact = contact;
            instructorServices.Save(instructor);
              }

              if (model.isAgency) {
            DiveAgency agency = new DiveAgency();
            agency.Contact = contact;
            diveAgencyServices.Save(agency);
              }

              if (model.isManufacturer) {
            Manufacturer manufacturer = new Manufacturer();
            manufacturer.Contact = contact;
            manufacturerServices.Save(manufacturer);
              }

              if (model.isDiveShop)
              {
            DiveShop diveShop = new DiveShop();
            diveShop.Contact = contact;
            diveShopServices.Save(diveShop);
              }
        }