private DataRow AddComponent(CCMModelItem ccmModelItem, ref int nodeId) { var dr = Dt.NewRow(); dr["ID"] = ++nodeId; var key = ccmModelItem.ComponentKey.ToString(); if (_keysIds.ContainsKey(key)) { return(dr); } // _keysIds[key] = (int)dr["ID"]; _keysIds[key] = ++nodeId;; UpdateDataRowFromModelItem(dr, ccmModelItem); Dt.Rows.Add(dr); return(dr); }
private void UpdateDataRowFromModelItem(DataRow dr, CCMModelItem modelItem) { var componentKey = modelItem.ComponentKey; var attributes = modelItem.Attributes; dr["Type"] = componentKey.Type; dr["Name"] = componentKey.Name; dr["Host"] = componentKey.Host; dr["NodeID"] = componentKey.NodeId; dr["ApplType"] = componentKey.ApplType; dr["ApplVersion"] = componentKey.ApplVer; dr["CMVer"] = componentKey.CMVer; dr["Extension"] = componentKey.Extension; dr["CurrentState"] = attributes.CurrentState; dr["DesiredState"] = attributes.DesiredState; dr["LastUpdate"] = "19/19/19"; dr["Status"] = attributes.Status; dr["StatusMessage"] = "Message"; dr["OSType"] = attributes.OSType; dr["Version"] = attributes.Version; dr["PrimaryHost"] = attributes.DBHost; dr["PrimaryHost"] = attributes.PrimaryHost; dr["SecondaryHost"] = attributes.SecondaryHost; dr["PrimaryDBHost"] = attributes.PrimaryDBHost; dr["SecondaryDBHost"] = attributes.SecondaryDBHost; dr["AdminAgentStatus"] = attributes.AdminAgentStatus; dr["DisplayedType"] = modelItem.ComponentKey.Type; dr["AdditionalAttributes"] = attributes.AdditionalAttributes; dr["ComponentItem"] = modelItem; dr["TreeDisplayName"] = "TreeDisplayName"; dr["GridDisplayName"] = "GridDisplayName"; dr["GridDisplayDBHost"] = attributes.DBHost; dr["GridDisplayHost"] = attributes.PrimaryHost; dr["GridDisplayMessage"] = "Message"; dr["CurrentStateString"] = attributes.CurrentState; dr["EntryNodeType"] = ""; dr["StatusString"] = attributes.Status; }