Beispiel #1
0
        private void ValidateCase(Case cas)
        {
            long companyid = Convert.ToInt32(HttpContext.Current.Session["CompanyID"]);
            long caseid = cas.CaseID;
            string cNumber = cas.CaseNumber;

            bool oneCase = caseRepository.IsCaseExists(companyid, caseid, cNumber);

            if (oneCase == true)
            {
                throw new DuplicateContactException(String.Format("Case Number {0} already exists. Please try another one", cNumber));
            }
        }
 public long InsertOrUpdateCase(Case cas)
 {
     try
     {
         context.Entry(cas).State = cas.CaseID == 0 ? EntityState.Added : EntityState.Modified;
         SaveChanges();
         return cas.CaseID;
     }
     catch (Exception ex) { throw ex; }
 }
Beispiel #3
0
 public long UpdateCase(Case cas)
 {
     ValidateCase(cas);
     try
     {
         return caseRepository.InsertOrUpdateCase(cas);
     }
     catch (Exception e)
     {
         throw e;
     }
 }