示例#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);
        }
示例#3
0
        public override void BeforeCreation(MaximoOperationExecutionContext maximoTemplateData)
        {
            var user = SecurityFacade.CurrentUser();
            var sr   = maximoTemplateData.IntegrationObject;

            w.SetValue(sr, "ACTLABHRS", 0);
            w.SetValue(sr, "ACTLABCOST", 0);
            w.SetValueIfNull(sr, "REPORTDATE", DateTime.Now.FromServerToRightKind());

            var crudData = (CrudOperationData)maximoTemplateData.OperationData;

            LongDescriptionHandler.HandleLongDescription(sr, crudData);

            //HandleAttachmentAndScreenshot(crudData, sr, maximoTemplateData.ApplicationMetadata);

            base.BeforeCreation(maximoTemplateData);
        }
        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);
        }
示例#5
0
        public static void HandleWorkLogs(CrudOperationData entity, object rootObject)
        {
            var user        = SecurityFacade.CurrentUser();
            var worklogs    = (IEnumerable <CrudOperationData>)entity.GetRelationship("worklog");
            var newWorkLogs = worklogs.Where(r => r.GetAttribute("worklogid") == null);
//            var association =entity.EntityMetadata.Associations.First(a => a.To == "worklog");
            var recordKey = entity.Id;

            w.CloneArray(worklogs, rootObject, "WORKLOG", delegate(object integrationObject, CrudOperationData crudData) {
                ReflectionUtil.SetProperty(integrationObject, "action", ProcessingActionType.AddChange.ToString());
                w.SetValueIfNull(integrationObject, "worklogid", -1);
                w.SetValue(integrationObject, "recordkey", recordKey);
                w.SetValueIfNull(integrationObject, "class", entity.TableName);

                w.CopyFromRootEntity(rootObject, integrationObject, "siteid", user.SiteId);
                w.CopyFromRootEntity(rootObject, integrationObject, "orgid", user.OrgId);
                w.CopyFromRootEntity(rootObject, integrationObject, "createby", user.Login, "CHANGEBY");
                w.CopyFromRootEntity(rootObject, integrationObject, "createdate", DateTime.Now.FromServerToRightKind());
                w.CopyFromRootEntity(rootObject, integrationObject, "modifydate", DateTime.Now.FromServerToRightKind());
                w.SetValueIfNull(integrationObject, "logtype", "CLIENTNOTE");

                LongDescriptionHandler.HandleLongDescription(integrationObject, crudData);
            });
        }