Exemple #1
0
 public override CONIntegrator Execute(CONIntegrator data, Actions action, Options option, string token)
 {
     try
     {
         if (action == Actions.Add || action == Actions.Modify || action == Actions.Remove || (action == Actions.Find && (option == Options.Me || option == Options.Exist)))
         {
             if ((action == Actions.Add || action == Actions.Modify) && option == Options.All)
             {
                 BenginTransaction();
                 cONIntegratorConfigurationDl = new CONIntegratorConfigurationBLL(Work);
                 cONStructureDl = new CONStructureBLL(Work);
             }
             data = base.Execute(data, action, option, token);
             if (action == Actions.Find && option == Options.Me)
             {
                 cONIntegratorConfigurationDl = new CONIntegratorConfigurationBLL(this.Work.Settings);
                 cONStructureDl = new CONStructureBLL(this.Work.Settings);
                 data.IntegratorConfigurations = cONIntegratorConfigurationDl.FindAll(new CONIntegratorConfiguration {
                     IntegratorId = data.Id
                 }, Options.All);
                 data.Structures = cONStructureDl.FindAll(new CONStructure {
                     IntegratorId = data.Id
                 }, Options.All);
             }
             if ((action == Actions.Add || action == Actions.Modify) && option == Options.All)
             {
                 AddDetails(data);
             }
             //if (option == Options.All)
             //    Work.Commit();
             return(data);
         }
         else if (action == Actions.Find && (option == Options.All || option == Options.Light))
         {
             if (option == Options.All)
             {
                 data.Entities = FindAll(data, Options.All);
             }
             else if (option == Options.Light)
             {
                 data.Entities = FindAll(data, Options.Light);
             }
             return(data);
         }
         else
         {
             throw new NotImplementedException(GetLocalizedMessage(Language.DLACTIONNOTIMPLEMENT, action.ToString(), option.ToString()));
         }
     }
     catch (FaultException <BusinessException> f)
     {
         Rollback();
         throw f;
     }
     catch (Exception e)
     {
         Rollback();
         throw new BusinessException(e).GetFaultException();
     }
     finally
     {
         Commit();
     }
 }