Example #1
0
        public void EditUnsuitability(int person_Id, int incident_Id, int createdBy)
        {
            try {
                var oldCPR_Unsuitability = (from a in db.CPR_Unsuitability
                                            where a.Person_Id == person_Id
                                            select a).FirstOrDefault();

                if (oldCPR_Unsuitability == null)
                {
                    oldCPR_Unsuitability                  = new CPR_Unsuitability();
                    oldCPR_Unsuitability.Person_Id        = person_Id;
                    oldCPR_Unsuitability.Incident_Id      = incident_Id;
                    oldCPR_Unsuitability.CreatedDate      = DateTime.Now;
                    oldCPR_Unsuitability.CreatedBy        = createdBy;
                    oldCPR_Unsuitability.RegistrationType = 1;
                    db.CPR_Unsuitability.Add(oldCPR_Unsuitability);
                    db.SaveChanges();
                    oldCPR_Unsuitability.CPRB_ReferenceNumber = "CPRB/NAT/" + oldCPR_Unsuitability.Unsuitablity_Id.ToString("0000000#") + "/" + DateTime.Now.Year.ToString();
                    db.SaveChanges();
                }
                else
                {
                    oldCPR_Unsuitability.Incident_Id = incident_Id;
                    oldCPR_Unsuitability.CreatedDate = DateTime.Now;
                    oldCPR_Unsuitability.CreatedBy   = createdBy;
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
 public void AddUnsuitablePerson(int person_Id, int incident_Id, int createdBy)
 {
     try {
         var newCPR_Unsuitability = new CPR_Unsuitability
         {
             Person_Id        = person_Id,
             Incident_Id      = incident_Id,
             CreatedDate      = DateTime.Now,
             CreatedBy        = createdBy,
             RegistrationType = 1
         };
         db.CPR_Unsuitability.Add(newCPR_Unsuitability);
         db.SaveChanges();
         newCPR_Unsuitability.CPRB_ReferenceNumber = "CPRB/NAT/" + newCPR_Unsuitability.Unsuitablity_Id.ToString("0000000#") + "/" + DateTime.Now.Year.ToString();
         db.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
 public void AddCPR_Unsuitability(CPR_Unsuitability unsuitablePerson)
 {
     db.CPR_Unsuitability.Add(unsuitablePerson);
 }