Пример #1
0
        public override void BeforeUpdate(MaximoOperationExecutionContext maximoTemplateData)
        {
            var user = SecurityFacade.CurrentUser();
            var sr   = maximoTemplateData.IntegrationObject;

            WorkLogHandler.HandleWorkLogs((CrudOperationData)maximoTemplateData.OperationData, sr);
            w.SetValueIfNull(sr, "ACTLABHRS", 0.0);
            w.SetValueIfNull(sr, "ACTLABCOST", 0.0);
            w.SetValueIfNull(sr, "CHANGEDATE", DateTime.Now.FromServerToRightKind(), true);
            w.SetValueIfNull(sr, "CHANGEBY", user.Login);
            w.SetValueIfNull(sr, "REPORTDATE", DateTime.Now.FromServerToRightKind());

            var crudData = ((CrudOperationData)maximoTemplateData.OperationData);

            LongDescriptionHandler.HandleLongDescription(sr, crudData);
            var attachments = crudData.GetRelationship("attachment");

            foreach (var attachment in (IEnumerable <CrudOperationData>)attachments)
            {
                var attachmentString = attachment.GetUnMappedAttribute("newattachment");
                var attachmentPath   = attachment.GetUnMappedAttribute("newattachment_path");
                if (attachmentString != null && attachmentPath != null)
                {
                    AttachmentHandler.HandleAttachments(sr, attachmentString, attachmentPath,
                                                        maximoTemplateData.ApplicationMetadata);
                }
            }
            //HandleSolutions(maximoTemplateData, crudData, sr);
            base.BeforeUpdate(maximoTemplateData);
        }
        private void CommonsBefore(MaximoOperationExecutionContext maximoTemplateData)
        {
            var entity = (CrudOperationData)maximoTemplateData.OperationData;

            LongDescriptionHandler.HandleLongDescription(maximoTemplateData.IntegrationObject, entity);
            var maximoWo = maximoTemplateData.IntegrationObject;
            var metadata = maximoTemplateData.ApplicationMetadata;

            SetDefaultValues(maximoWo);
            WorkLogHandler.HandleWorkLogs(entity, maximoWo);
            HandleMaterials(maximoTemplateData, entity, maximoWo);
            HandleLabors(entity, maximoWo);
            HandleAttachments(entity, maximoWo, metadata);
        }
        public override void BeforeUpdate(MaximoOperationExecutionContext maximoTemplateData)
        {
            var user = SecurityFacade.CurrentUser();
            var sr   = maximoTemplateData.IntegrationObject;

            w.SetValueIfNull(sr, "ACTLABHRS", 0.0);
            w.SetValueIfNull(sr, "ACTLABCOST", 0.0);
            w.SetValueIfNull(sr, "CHANGEDATE", DateTime.Now.FromServerToRightKind(), true);
            w.SetValueIfNull(sr, "CHANGEBY", user.Login);
            w.SetValueIfNull(sr, "REPORTDATE", DateTime.Now.FromServerToRightKind());
            WorkLogHandler.HandleWorkLogs((CrudOperationData)maximoTemplateData.OperationData, sr);

            var crudData = ((CrudOperationData)maximoTemplateData.OperationData);

            LongDescriptionHandler.HandleLongDescription(sr, crudData);
            var attachments = crudData.GetRelationship("attachment");

            foreach (var attachment in (IEnumerable <CrudOperationData>)attachments)
            {
                HandleAttachmentAndScreenshot(attachment, sr, maximoTemplateData.ApplicationMetadata);
            }
            base.BeforeUpdate(maximoTemplateData);
        }