public override void Execute(IServiceProvider serviceProvider) { base.Execute(serviceProvider); try { lys_agreement createdAgreement = GetTargetAs <Entity>().ToEntity <lys_agreement>(); IOrganizationService currentUserService = CreateService(); NavAgreementHandler agreementHandler = new NavAgreementHandler(currentUserService, TraceService); // 5.2 agreementHandler.UpdateRelatedContactDateOnCreate(createdAgreement); } catch (EntityHandlerException e) { TraceService.Trace(e.ToString()); throw new InvalidPluginExecutionException(e.Message); } catch (Exception e) { TraceService.Trace(e.ToString()); throw new InvalidPluginExecutionException("Возникла ошибка, см. журнал для подробностей."); } }
protected override void Execute(CodeActivityContext context) { Init(context); try { IOrganizationService currentUserService = CreateService(); NavAgreementHandler agreementHandler = new NavAgreementHandler(currentUserService, TraceService); lys_agreement agreement = new lys_agreement { Id = Agreement.Get(context).Id }; // 6.1 agreementHandler.CreateFirstRelatedInvoice(agreement, WorkflowContext.UserId); } catch (EntityHandlerException e) { TraceService.Trace(e.ToString()); throw new InvalidWorkflowException(e.Message); } catch (Exception e) { TraceService.Trace(e.ToString()); throw new InvalidWorkflowException("Возникла ошибка, см. журнал для подробностей."); } }
public override void Execute(IServiceProvider serviceProvider) { base.Execute(serviceProvider); if (PluginExecutionContext.Depth > 1) { // Recursive update. return; } try { lys_agreement updatedAgreement = GetTargetAs <Entity>().ToEntity <lys_agreement>(); IOrganizationService currentUserService = CreateService(); NavAgreementHandler agreementHandler = new NavAgreementHandler(currentUserService, TraceService); // 5.5 agreementHandler.UpdateFact(updatedAgreement); } catch (EntityHandlerException e) { TraceService.Trace(e.ToString()); throw new InvalidPluginExecutionException(e.Message); } catch (Exception e) { TraceService.Trace(e.ToString()); throw new InvalidPluginExecutionException("Возникла ошибка, см. журнал для подробностей."); } }
protected override void Execute(CodeActivityContext context) { Init(context); try { IOrganizationService currentUserService = CreateService(); NavAgreementHandler agreementHandler = new NavAgreementHandler(currentUserService, TraceService); lys_agreement agreement = new lys_agreement { Id = Agreement.Get(context).Id }; // 6.2 agreementHandler.CreateRelatedCreditInvoices(agreement); } catch (Exception e) { // Can't display any errors since it's a background activity. TraceService.Trace(e.ToString()); } }