Пример #1
0
        public CaseSaveStatus AddBasicData(vw_CrimeCaseBasicData caseBasicData, out int CaseID)
        {
            try
            {
                int            MasterCaseID;
                CaseSaveStatus CaseResult = MasterCaseComponent.AddCaseBasicData(caseBasicData, out MasterCaseID);
                if (CaseResult == CaseSaveStatus.SecondNumberExistBefore)
                {
                    CaseID = 0;
                    return(CaseSaveStatus.SecondNumberExistBefore);
                }

                else
                {
                    using (var Transaction = BeginDatabaseTransaction())
                    {
                        CaseID = CaseComponent.AddCaseData(caseBasicData, MasterCaseID);
                        if (Transaction != null)
                        {
                            Transaction.Commit();
                        }
                        return(CaseSaveStatus.Saved);
                    }
                }
            }
            catch (Exception ex)
            {
                CaseID = 0;
                HandleException(ex);
                return(CaseSaveStatus.Failed);
            }
        }
Пример #2
0
 public CaseSaveStatus AddBasicData(vw_FaultCaseBasicData caseBasicData)
 {
     try
     {
         using (var Transaction = BeginDatabaseTransaction())
         {
             caseBasicData.NationalID = MasterCaseComponent.CreateNationalID(caseBasicData);
             int            MasterCaseID;
             CaseSaveStatus CaseResult = MasterCaseComponent.AddCaseBasicData(caseBasicData, out MasterCaseID);
             if (CaseResult != CaseSaveStatus.Saved)
             {
                 return(CaseResult);
             }
             caseBasicData.MasterCaseID = MasterCaseID;
             CaseComponent.Add(caseBasicData);
             if (Transaction != null)
             {
                 Transaction.Commit();
             }
             return(CaseSaveStatus.Saved);
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
         return(CaseSaveStatus.Failed);
     }
 }
 private Response ReturnErrorResponse(CaseSaveStatus caseSaveStatus)
 {
     return(ReturnErrorResponse(new List <int> {
         (int)caseSaveStatus
     }));
 }