private void HandleClosedDate(DataMap resultObject, ApplicationMetadata application)
        {
            var status     = resultObject.GetAttribute("status");
            var statusDate = resultObject.GetAttribute("statusdate");

            resultObject.SetAttribute("#closeddate", "CLOSED".Equals(status) ? statusDate : "");
        }
        private void HandleClosedDate(DataMap resultObject, ApplicationMetadata application)
        {
            var status     = resultObject.GetAttribute("status");
            var statusDate = resultObject.GetAttribute("statusdate");

            if ("CLOSED".Equals(status))
            {
                resultObject.Attributes["#closeddate"] = statusDate;
            }
            else
            {
                resultObject.Attributes["#closeddate"] = "";
            }
        }
Beispiel #3
0
        public SortedSet <IAssociationOption> GetAvailableImacsFromAsset(DataMap asset)
        {
            var toFilter           = ImacAssetHelper.GetImacOptionsFromStatus((string)asset.GetAttribute(AssetConstants.StatusColumn));
            var classstructure     = (string)asset.GetAttribute(AssetConstants.ClassStructureIdColumn);
            var assetStatus        = (string)asset.GetAttribute(AssetConstants.StatusColumn);
            var fromClassStructure = ImacAssetHelper.GetImacOptionsFromClassStructure(classstructure);

            if (AssetConstants.Idle.Equals(assetStatus) && IsStdAsset(classstructure))
            {
                //HAP-683 constraint
                toFilter.Add(ImacConstants.Replace);
            }
            toFilter.UnionWith(fromClassStructure);
            return(new SortedSet <IAssociationOption>(ImacConstants.DefaultTemplateOptions.Where(w => toFilter.All(a => a != w.Value))));
        }
Beispiel #4
0
        public IEnumerable <IAssociationOption> FilterAvailableStatus(DataMap currentWorkorder, IEnumerable <AssociationOption> loadedAssociations)
        {
            var currentStatus         = (string)currentWorkorder.GetAttribute("status");
            var filterAvailableStatus = loadedAssociations as AssociationOption[] ?? loadedAssociations.ToArray();

            if (currentStatus == null)
            {
                return(new List <AssociationOption> {
                    filterAvailableStatus.First(l => l.Value == "OPEN")
                });
            }
            var currentOption = filterAvailableStatus.FirstOrDefault(l => l.Value == currentStatus);

            if (currentOption == null)
            {
                return(filterAvailableStatus);
            }

            if (currentStatus == "APPR" || currentStatus == "WAPPR")
            {
                return(filterAvailableStatus);
            }
            if (currentStatus == "COMP")
            {
                return(new List <AssociationOption> {
                    currentOption, filterAvailableStatus.First(l => l.Value == "CLOSE")
                });
            }
            return(new List <AssociationOption> {
                currentOption
            });
        }
        private void FillCreationFromAssetData(DataMap resultObject)
        {
            resultObject.SetAttribute("#availableimacoptions", GetImacDataSet().GetAvailableImacsFromAsset(resultObject));
            var attribute = (List <Dictionary <string, object> >)resultObject.GetAttribute("assetcustodian_");

            resultObject.SetAttribute("#iscustodian", attribute.Any(a => a["personid"].Equals(SecurityFacade.CurrentUser(false).MaximoPersonId)));
        }
Beispiel #6
0
        private void FetchRemarks(DataMap resultObject)
        {
            var ciId            = resultObject.GetAttribute("ciid");
            var extraAttributte = GetDAO().FindSingleByQuery <ExtraAttributes>(ExtraAttributes.ByMaximoTABLEIdAndAttribute, "ci", ciId.ToString(), "remarks");

            if (extraAttributte != null)
            {
                resultObject.SetAttribute(extraAttributte.AttributeName, extraAttributte.AttributeValue);
            }
        }
        private void HandleAffectDateAndTime(DataMap resultObject, ApplicationMetadata application)
        {
            var originalDateTime = resultObject.GetAttribute("affecteddate", true);

            resultObject.Attributes["#affecteddateonly"] = originalDateTime;
            resultObject.Attributes["#affectedtime"]     = originalDateTime;

            var user = SecurityFacade.CurrentUser();

            resultObject.Attributes["isitcortom"] = ShouldShowITC(user);
        }
        private void HandleAssetTree(DataMap resultObject)
        {
            var childs = ((IEnumerable <Dictionary <string, object> >)resultObject.GetAttribute("childassets_")).ToList();

            foreach (var item in childs)
            {
                item["label"]    = item[("hlagdescription2")];
                item["children"] = new List <Dictionary <string, object> >();
            }

            var currentAsset = new Dictionary <string, object>();

            currentAsset["assetid"]  = resultObject.GetAttribute("assetid");
            currentAsset["label"]    = resultObject.GetAttribute("hlagdescription2");
            currentAsset["selected"] = "selected";
            currentAsset["children"] = childs;
            var rootNode = currentAsset;

            if (resultObject.GetAttribute("parentasset_.assetid") != null)
            {
                var parent = new Dictionary <string, object>();
                parent["assetid"]  = resultObject.GetAttribute("parentasset_.assetid");
                parent["label"]    = resultObject.GetAttribute("parentasset_.hlagdescription2");
                parent["children"] = new List <Dictionary <string, object> >()
                {
                    currentAsset
                };
                rootNode = parent;
            }

            resultObject.Attributes["#assettree"] = new List <Dictionary <string, object> > {
                rootNode
            };
        }
        private void JoinHistoryData(DataMap resultObject)
        {
            var assetId = resultObject.GetAttribute("itdextid");

            if (assetId == null)
            {
                return;
            }

            var histTickets = resultObject.GetAttribute("histticket");

            // The workorder grid was replaced by IMAC grid

            var woData = GetDAO().FindByQuery <HistWorkorder>(HistWorkorder.ByAssetnum, assetId.ToString());

            foreach (var row in woData)
            {
                var list = (IList <Dictionary <string, object> >)resultObject.Attributes["imac_"];
                list.Add(row.toAttributeHolder());
            }


            var ticketData = GetDAO().FindByQuery <HistTicket>(HistTicket.ByAssetnum, assetId.ToString());
            var ticketList = (IList <Dictionary <string, object> >)resultObject.Attributes["ticket_"];
            var imacList   = (IList <Dictionary <string, object> >)resultObject.Attributes["imac_"];

            foreach (var row in ticketData)
            {
                var attributeHolder = row.toAttributeHolder();
                if (row.Classification != null && row.Classification.StartsWith("8151"))
                {
                    imacList.Add(attributeHolder);
                }
                else
                {
                    ticketList.Add(attributeHolder);
                }
            }
        }
        private bool LevelMatches(DataMap change, IDictionary <string, object> approval)
        {
            var approverLevel = approval[ApproverConstants.ApprovalLevel.ToLower()];
            var changeLevel   = change.GetAttribute(ApproverConstants.ChangeLevel.ToLower());

            Log.DebugFormat("approverLevel {0} changeLevel {1}", approverLevel, changeLevel);
            if (approverLevel == null)
            {
                return(changeLevel == null);
            }
            if (changeLevel == null)
            {
                return(false);
            }
            return(approverLevel.ToString().EqualsIc(changeLevel.ToString()));
        }
Beispiel #11
0
        private static void HandleCreationSummary(DataMap resultObject)
        {
            var list = resultObject.GetAttribute("attachment_");
            var sb   = new StringBuilder();

            foreach (var dictionary in (IEnumerable <Dictionary <string, object> >)list)
            {
                sb.Append("<p>");
                var urlDescription = AttachmentHandler.BuildFileName(dictionary["docinfo_.urlname"] as string);
                if (urlDescription == null)
                {
                    //keep description
                    dictionary["urldescription"] = dictionary["description"];
                }
                else
                {
                    dictionary["urldescription"] = urlDescription;
                }
                sb.Append(dictionary["urldescription"]);
                sb.Append("</p>");
            }
            resultObject.Attributes.Add("#attachmentsummary", sb.ToString());
        }