Ejemplo n.º 1
0
 protected void ExecutePreCreate(LocalPluginContext localContext)
 {
     if (localContext == null)
     {
         throw new ArgumentNullException("localContext");
     }
     IPluginExecutionContext context = localContext.PluginExecutionContext;
     Entity targetEntity = (Entity)context.InputParameters["Target"];
     IncidentServiceEventCalc calc = new IncidentServiceEventCalc(localContext.OrganizationService, true);
     new_incidentservice new_servicecostTarget = targetEntity.ToEntity<Xrm.new_incidentservice>();
     calc.CalcIncidentService(new_servicecostTarget, null);
 }
Ejemplo n.º 2
0
        protected void ExecutePreUpdate(LocalPluginContext localContext)
        {
            if (localContext == null)
                throw new ArgumentNullException("localContext");

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            Entity targetEntity, preEntity;
            targetEntity = (Entity)context.InputParameters["Target"];
            preEntity = (Entity)context.PreEntityImages[preImageAlias];
            IncidentServiceEventCalc calc = new IncidentServiceEventCalc(localContext.OrganizationService, false);
            var new_servicecostTarget = targetEntity.ToEntity<Xrm.new_incidentservice>();

            new_incidentservice new_servicecostImage = preEntity.ToEntity<Xrm.new_incidentservice>();
            calc.CalcIncidentService(new_servicecostTarget, new_servicecostImage);
        }