public void Execute(IServiceProvider serviceProvider) { var traceService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); traceService.Trace("Info about trace"); var pluginContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); var targetAgreement = (Entity)pluginContext.InputParameters["Target"]; traceService.Trace("Name " + targetAgreement.GetAttributeValue <string>(Common.Entities.nav_agreement.Fields.nav_name)); var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); var service = serviceFactory.CreateOrganizationService(Guid.Empty);// null try { AgreementService agreementService = new AgreementService(service, traceService); agreementService.SetContractDate(targetAgreement); } catch (Exception exc) { traceService.Trace(exc.ToString()); throw new InvalidPluginExecutionException(exc.Message); } }
protected override void Execute(CodeActivityContext context) { var wfContext = context.GetExtension <IWorkflowContext>(); var servicefactory = context.GetExtension <IOrganizationServiceFactory>(); var service = servicefactory.CreateOrganizationService(null); var agreementRef = AgreementReference.Get(context); try { AgreementService agreementService = new AgreementService(service); bool hasInvoices = agreementService.HasPayedInvoicesByAgreementId(agreementRef); if (hasInvoices) { HasInvoice.Set(context, true); } else { HasInvoice.Set(context, false); } } catch (Exception ex) { throw new InvalidPluginExecutionException(ex.Message); } }
public AgreementController ( IMapper <Agreement, AgreementViewModel> mapperToViewModel, IMapper <AgreementViewModel, Agreement> mapperToBysinessModel, AgreementService agreementService ) { _mapperToViewModel = mapperToViewModel; _mapperToBysinessModel = mapperToBysinessModel; _agreementService = agreementService; }
public List <CustomerAgreementModel> getAgreements(int customerId, string token) { List <CustomerAgreementModel> agreementModels = null; try { agreementModels = registerservice.getAgreements(customerId, token); if (agreementModels != null) { if (agreementModels.Count > 0) { GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null; VehicleService vehicleService = new VehicleService(); getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token); AgreementService agreementService = new AgreementService(); foreach (CustomerAgreementModel cam in agreementModels) { if (cam.Status != null) { int agreeId = cam.AgreementId; int vehId = cam.VehicleId; int vehicleTypeID = 0; GetAgreementByAgreementIdMobileResponse agreementByAgreementIdMobileResponse = null; GetAgreementByAgreementIdMobileRequest agreementIdMobileRequest = new GetAgreementByAgreementIdMobileRequest(); agreementIdMobileRequest.agreementId = agreeId; agreementByAgreementIdMobileResponse = agreementService.getAgreement(agreementIdMobileRequest, token); cam.custAgreement = agreementByAgreementIdMobileResponse.custAgreement; foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle) { if (vtmr.VehicleType == agreementByAgreementIdMobileResponse.custAgreement.AgreementDetail.VehicleType) { vehicleTypeID = vtmr.VehicleTypeId; } } if (vehId > 0 && vehicleTypeID > 0) { cam.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehId, token); } } } } } } catch (Exception ex) { throw ex; } return(agreementModels); }
public void PostInvoiceRecalculating(Entity targetInvoice) { var fact = targetInvoice.GetAttributeValue <bool?>(Common.Entities.nav_invoice.Fields.nav_fact); if (fact == true) { var agreementService = new AgreementService(_service, _tracingService); _tracingService.Trace("Set nav_type value"); agreementService.RecalculateFactSummaAfterPayingInvoice(targetInvoice); _service.Delete(targetInvoice.LogicalName, targetInvoice.Id); } }
protected override void Execute(CodeActivityContext context) { var wfContext = context.GetExtension <IWorkflowContext>(); var id = wfContext.PrimaryEntityId; var servicefactory = context.GetExtension <IOrganizationServiceFactory>(); var service = servicefactory.CreateOrganizationService(null); AgreementService agreementService = new AgreementService(service); IsFirst.Set(context, agreementService.IsAgreementHaveNoAnyInvoice(id)); IsAnyInvoiceWhithFactEqTrue.Set(context, agreementService.IsAgreementHaveAnyInvoiceWhithFactEqTrue(id)); IsAnyInvoiceWhithTypeEqManually.Set(context, agreementService.IsAgreementHaveAnyInvoiceWhithTypeEqManually(id)); }
protected override void Execute(CodeActivityContext context) { var wfContext = context.GetExtension <IWorkflowContext>(); var id = wfContext.PrimaryEntityId; var servicefactory = context.GetExtension <IOrganizationServiceFactory>(); var service = servicefactory.CreateOrganizationService(null); AgreementService agreementService = new AgreementService(service); agreementService.DeleteAllArgementInvoiceWhithTypeEqAuthomatic(id); agreementService.CreatePaymentScheduleForEachMonth(); agreementService.SetPaymentPlanDate(); }
protected override void Execute(CodeActivityContext context) { var wfContext = context.GetExtension <IWorkflowContext>(); var servicefactory = context.GetExtension <IOrganizationServiceFactory>(); var service = servicefactory.CreateOrganizationService(null); var agreementRef = AgreementReference.Get(context); try { AgreementService agreementService = new AgreementService(service); agreementService.CreatePaymentSchedule(agreementRef); } catch (Exception ex) { throw new InvalidPluginExecutionException(ex.Message); } }
public override void PluginExecuted(PluginData pluginData) { try { AgreementService service = new AgreementService(pluginData.OrganizationService); Entities.new_agreement target = pluginData.Target.ToEntity <Entities.new_agreement>(); service.CheckForFirstAgreement(target); } catch (Exception ex) { pluginData.TracingService.Trace(ex.ToString()); throw new InvalidPluginExecutionException(ex.Message); } }
public override void Executed(WorkflowData data) { try { EntityReference agreementRef = AgreementReference.Get(data.Context); AgreementService service = new AgreementService(data.OrganizationService); IsHasRelatedInvoices.Set(data.Context, service.IsHasRelatedInvoices(agreementRef)); IsHasRelatedInvoicesWithPaidState.Set(data.Context, service.IsHasRelatedInvoicesWithPaidState(agreementRef)); IsHasRelatedInvoicesWithCommonType.Set(data.Context, service.IsHasRelatedInvoicesWithCommonType(agreementRef)); } catch (Exception ex) { data.TracingService.Trace(ex.ToString()); throw new InvalidWorkflowException(ex.Message); } }
public override void Executed(WorkflowData data) { try { EntityReference agreementRef = AgreementReference.Get(data.Context); Entities.new_agreement entity = data.Target.ToEntity <Entities.new_agreement>(); AgreementService service = new AgreementService(data.OrganizationService); service.DeleteRelatedInvoicesWithAutoType(agreementRef); service.CreatePaymentSchedule(entity); service.UpdateAgreementScheduleDate(entity); } catch (Exception ex) { data.TracingService.Trace(ex.ToString()); throw new InvalidWorkflowException(ex.Message); } }
public void Execute(IServiceProvider serviceProvider) { var traceService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); traceService.Trace("Получили ITracingService"); var pluginContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); var targetInvoice = (Entity)pluginContext.InputParameters["Target"]; var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); var service = serviceFactory.CreateOrganizationService(Guid.Empty);// null try { AgreementService invoiceService = new AgreementService(service, traceService); invoiceService.SetDateFirstCommunication(targetInvoice); } catch (Exception exc) { traceService.Trace("Ошибка " + exc.ToString()); throw new InvalidPluginExecutionException(exc.Message); } }
public HomeController() { this.objAgree = new AgreementService(); }
public AgreementController(OrderManagmentAppContext appContext, AgreementService agreementService) { _appContext = appContext; _agreementService = agreementService; }
public AgreementController() { agreementService = new AgreementService(); }