当前位置: 首页>>代码示例>>C#>>正文


C# Story.Attribute_FindByName方法代码示例

本文整理汇总了C#中Story.Attribute_FindByName方法的典型用法代码示例。如果您正苦于以下问题:C# Story.Attribute_FindByName方法的具体用法?C# Story.Attribute_FindByName怎么用?C# Story.Attribute_FindByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Story的用法示例。


在下文中一共展示了Story.Attribute_FindByName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateStoryFromXLTemplate

        public static void CreateStoryFromXLTemplate(Story story, string XLFilename, Logger log, bool deleteItems)
        {
            EnsureStoryHasRightStructure(story, log);

            // get categories
            var catRisk = story.Category_FindByName(_risk);
            var catEWI = story.Category_FindByName(_ewi);
            var catCause = story.Category_FindByName(_cause);
            var catCauseControl = story.Category_FindByName(_causeControls);
            var catCauseAction = story.Category_FindByName(_causeControlActions);
            var catConsequence = story.Category_FindByName(_consequence);
            var catConsequenceControl = story.Category_FindByName(_consequenceControls);
            var catConsequenceAction = story.Category_FindByName(_consequenceActions);

            // get attributes
            var attLikelihood = story.Attribute_FindByName(_attrLikelihood);
            var attImpact = story.Attribute_FindByName(_attrImpact);
            var attRationale = story.Attribute_FindByName(_attrRationale);

            var attLikelihoodSafety = story.Attribute_FindByName(_attrLikelihoodSafety);
            var attImpactSafety = story.Attribute_FindByName(_attrImpactSafety);
            var attAppetiteSafety = story.Attribute_FindByName(_attrRiskAppetiteSafety);
            var attRationaleSafety = story.Attribute_FindByName(_attrRationaleSafety);

            var attLikelihoodPerformance = story.Attribute_FindByName(_attrLikelihoodPerformance);
            var attImpactPerformance = story.Attribute_FindByName(_attrImpactPerformance);
            var attAppetitePerformace = story.Attribute_FindByName(_attrRiskAppetitePerformance);
            var attRationalePerformance = story.Attribute_FindByName(_attrRationalePerformance);

            var attLikelihoodValue = story.Attribute_FindByName(_attrLikelihoodValue);
            var attImpactValue = story.Attribute_FindByName(_attrImpactValue);
            var attAppetiteValue = story.Attribute_FindByName(_attrRiskAppetiteValue);
            var attRationaleValue = story.Attribute_FindByName(_attrRationaleValue);

            var attLikelihoodPolitical = story.Attribute_FindByName(_attrLikelihoodPolitical);
            var attImpactPolitical = story.Attribute_FindByName(_attrImpactPolitical);
            var attAppetitePolitical = story.Attribute_FindByName(_attrRiskAppetitePolitical);
            var attRationalePolitical = story.Attribute_FindByName(_attrRationalePolitical);

            var attGrossImpact = story.Attribute_FindByName(_attrGrossImpact);
            var attGrossLikelihood = story.Attribute_FindByName(_attrGrossLkelihood);
            var attGrossFinance = story.Attribute_FindByName(_attrGrossFinance);
            var attGrossRating = story.Attribute_FindByName(_attrGrossRating);
            var attTargetImpact = story.Attribute_FindByName(_attrTargetImpact);
            var attTargetLikelihood = story.Attribute_FindByName(_attrTargetLkelihood);
            var attTargetFinance = story.Attribute_FindByName(_attrTargetFinance);
            var attTargetRating = story.Attribute_FindByName(_attrTargetRating);

            var attControlRating = story.Attribute_FindByName(_attrControlRating);
            var attImapactedArea = story.Attribute_FindByName(_attrImpactedArea);
            var attRiskOwner = story.Attribute_FindByName(_attrRiskOwner);
            var attControlOwner = story.Attribute_FindByName(_attrControlOwner);
            var attActionOwner = story.Attribute_FindByName(_attrActionOwner);
            var attBasisOfOpinion = story.Attribute_FindByName(_attrBasisOfOpinion);
            var attLinkedControls = story.Attribute_FindByName(_attrLinkedControls);
            var attLinkedControlsTypes = story.Attribute_FindByName(_attrLinkedControlsTypes);
            var attBaseline = story.Attribute_FindByName(_attrBaseline);
            var attRevision = story.Attribute_FindByName(_attrRevision);
            var attPercComplete = story.Attribute_FindByName(_attrPercComplete);
            var attSortOrder = story.Attribute_FindByName(_attrOrder);
            //var attPrior = story.Attribute_FindByName(_attrPrior);
            var attCurrent = story.Attribute_FindByName(_attrCurrent);
            var attWithinTolerance = story.Attribute_FindByName(_attrWithinTolerance);
            var attControlOpinion = story.Attribute_FindByName(_attrControlOpinion);
            var attPriority = story.Attribute_FindByName(_attrPriority);
            var attStatus = story.Attribute_FindByName(_attrStatus);
            var attClassification = story.Attribute_FindByName(_attrClassification);
            var attVersion = story.Attribute_FindByName(_attrVersion);
            var attLastUpdate = story.Attribute_FindByName(_attrlastUpdate);
            var attManager = story.Attribute_FindByName(_attrManager);
            var attRiskLevel = story.Attribute_FindByName(_attrRiskLevel);
            var attReportingPriority = story.Attribute_FindByName(_attrReportingPriority);
            var attDirectorate = story.Attribute_FindByName(_attrDirectorate);


            try
            {

                var XL1 = new Application();
                var pathMlstn = XLFilename;
                log.Log($"Opening Excel Doc " + pathMlstn);
                var wbBowTie = XL1.Workbooks.Open(pathMlstn);
                var sheet = 1;

                // validate template is correct version
                var version = XL1.Sheets["Version Control"].Cells[1, 26].Text;
                if (version != "SCApproved")
                {
                    log.Log($"Spreadhseet is not in the approved version, missing 'SCApproved' at Z1 in 'Version Control' ");
                    KillProcessByMainWindowHwnd(XL1.Application.Hwnd);
                    return;
                }


                // set the story name
                var level = XL1.Sheets[sheet].Cells(3, 4).Text;
                var directorate = XL1.Sheets[sheet].Cells(4, 4).Text;
                var title = XL1.Sheets[sheet].Cells(5, 4).Text;
                
                story.Name = $"L{level}_{GetShortenedDirectorate(directorate)}_{title}";
//.........这里部分代码省略.........
开发者ID:Rusty,项目名称:RiskBowTieNWR,代码行数:101,代码来源:RiskModel.cs

示例2: EnsureAttributeExists

 private static Attribute EnsureAttributeExists(Attribute attrib, Story destination)
 {
     var attDest = destination.Attribute_FindByName(attrib.Name);
     if (attDest == null)
     {
         attDest = destination.Attribute_Add(attrib.Name, attrib.Type);
         foreach (var lab in attrib.Labels)
         {
             attDest.Labels_Add(lab.Text, lab.Color);
         }
     }
     return attDest;
 }
开发者ID:Rusty,项目名称:RiskBowTieNWR,代码行数:13,代码来源:RiskModel.cs

示例3: LoadPanelData

        private static void LoadPanelData(Item item, Story story, string category, string[] attributes, double[] widths)
        {
            if (attributes.Length+2 != widths.Length)
            {
                throw new Exception("attributes and widths must match");
            }

            var sortby = story.Attribute_FindByName("SortOrder");
            
            // add attributes so it won't blow up below
            foreach (var attribute in attributes)
            {
                if (story.Attribute_FindByName(attribute) == null)
                    story.Attribute_Add(attribute, Attribute.AttributeType.List);
            }

            var table1 = new HTMLTable(attributes.Length + 2);
            int col = 0;
            table1.SetValue(0, col++, "#");
            table1.SetValue(0, col++, "Name");
            foreach (var attribute in attributes)
            {
                table1.SetValue(0, col++, attribute);
            }

            int row = 1;
            foreach (var item2 in story.Items.OrderBy(i => i.GetAttributeValueAsDouble(sortby)))
            {
                if (item2.Category.Name == category)
                {
                    col = 0;
                    table1.SetValue(row, col++, item2.GetAttributeValueAsDouble(sortby).ToString());
                    table1.SetValue(row, col++, item2.Name);
                    foreach (var attribute in attributes)
                    {
                        //Debug.WriteLine($"Attrubute = '{attribute}'");
                        var att = story.Attribute_FindByName(attribute);
                        //Debug.WriteLine($"Attrubute.Name = '{att.Name}'");
                        var text = item2.GetAttributeValueAsTextWithPrefixAndSuffix(att);
                        //Debug.WriteLine($"Text = '{text}'");
                        string color = item2.GetAttributeValueAsColorText(att);
                        table1.SetValue(row, col++, text, color);
                    }
                    row++;
                }
            }

            // set the col width
            for (int c=0;c<widths.Length; c++)
            {
                table1.SetColWidth(c, widths[c]);
            }

            var panel = item.Panel_FindByTitle(category);
            if (panel == null)
                panel = item.Panel_Add(category, Panel.PanelType.RichText);
            panel.Data = table1.GetHTML;

        }
开发者ID:Rusty,项目名称:RiskBowTieNWR,代码行数:59,代码来源:RiskModel.cs

示例4: EnsureStoryHasRightStructure

 public static void EnsureStoryHasRightStructure(Story story, Logger log)
 {
     // make sure all categories we need exist
     foreach (var c in _categoryNames)
     {
         if (story.Category_FindByName(c) == null) // catagory does not exist
         {
             log.Log($"Adding Category '{c}'");
             story.Category_AddNew(c);
         }
     }
     // make sure all attributes we need exist
     foreach (var a in _textFields)
     {
         if (story.Attribute_FindByName(a) == null)
         {
             log.Log($"Adding Text Attribute '{a}'");
             story.Attribute_Add(a, Attribute.AttributeType.Text);
         }
     }
     foreach (var a in _dateFields)
     {
         if (story.Attribute_FindByName(a) == null)
         {
             log.Log($"Adding Date Attribute '{a}'");
             story.Attribute_Add(a, Attribute.AttributeType.Date);
         }
     }
     foreach (var a in _numberFields)
     {
         if (story.Attribute_FindByName(a) == null)
         {
             log.Log($"Adding Number Attribute '{a}'");
             story.Attribute_Add(a, Attribute.AttributeType.Numeric);
         }
     }
     foreach (var a in _listFields)
     {
         if (story.Attribute_FindByName(a) == null)
         {
             log.Log($"Adding List Attribute '{a}'");
             story.Attribute_Add(a, Attribute.AttributeType.List);
         }
     }
     // reserved list attributes need VL,L,M,H,VH values
     foreach (var a in _listRiskFields)
     {
         if (story.Attribute_FindByName(a) == null)
         {
             log.Log($"Adding List Attribute '{a}'");
             var att = story.Attribute_Add(a, Attribute.AttributeType.List);
             foreach (var l in _riskLabels)
             {
                 log.Log($"Adding List Label '{l}'");
                 att.Labels_Add(l);
             }
         }
     }
 }
开发者ID:Rusty,项目名称:RiskBowTieNWR,代码行数:59,代码来源:RiskModel.cs


注:本文中的Story.Attribute_FindByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。