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


C# Story.Item_AddNew方法代码示例

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


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

示例1: CreateStoryFromXLTemplate


//.........这里部分代码省略.........
            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}";

                Item risk = story.Item_FindByExternalId(_riskId) ?? story.Item_AddNew(title, false);
                risk.ExternalId = _riskId;
                risk.Description = XL1.Sheets[sheet].Cells(3, 19).Text;
                risk.Category = catRisk;
                SetAttributeWithLogging(log, risk, attClassification, XL1.Sheets[sheet].Cells(2, 4).Text);
                SetAttributeWithLogging(log, risk, attRiskLevel, level);
                SetAttributeWithLogging(log, risk, attDirectorate, directorate);

                SetAttributeWithLogging(log, risk, attRiskOwner, XL1.Sheets[sheet].Cells(6, 4).Text);
                SetAttributeWithLogging(log, risk, attManager, XL1.Sheets[sheet].Cells(7, 4).Text);
                SetAttributeWithLogging(log, risk, attImapactedArea, LookupRiskLabel(XL1.Sheets[sheet].Cells(8, 4).Text));
                SetAttributeWithLogging(log, risk, attControlRating, XL1.Sheets[sheet].Cells(9, 4).Text);
                SetAttributeWithLogging(log, risk, attVersion, XL1.Sheets[sheet].Cells(10, 4).Text);
                SetAttributeWithLogging(log, risk, attLastUpdate, XL1.Sheets[sheet].Cells(11, 4).Text);

                // gross
                SetAttributeWithLogging(log, risk, attGrossImpact, LookupRiskLabel(XL1.Sheets[sheet].Cells(15, 4).Text));
                SetAttributeWithLogging(log, risk, attGrossLikelihood, LookupRiskLabel(XL1.Sheets[sheet].Cells(15, 7).Text));
                SetAttributeWithLogging(log, risk, attGrossFinance, LookupRiskLabel(XL1.Sheets[sheet].Cells(15, 10).Text));
                SetAttributeWithLogging(log, risk, attGrossRating, XL1.Sheets[sheet].Cells(15, 12).Text);
                // target
                SetAttributeWithLogging(log, risk, attTargetImpact, LookupRiskLabel(XL1.Sheets[sheet].Cells(16, 4).Text));
                SetAttributeWithLogging(log, risk, attTargetLikelihood, LookupRiskLabel(XL1.Sheets[sheet].Cells(16, 7).Text));
                SetAttributeWithLogging(log, risk, attTargetFinance, LookupRiskLabel(XL1.Sheets[sheet].Cells(16, 10).Text));
                SetAttributeWithLogging(log, risk, attTargetRating, XL1.Sheets[sheet].Cells(16, 12).Text);

                SetAttributeWithLogging(log, risk, attLikelihoodSafety, LookupRiskLabel(XL1.Sheets[sheet].Cells(20, 37).Text));
                SetAttributeWithLogging(log, risk, attImpactSafety, LookupRiskLabel(XL1.Sheets[sheet].Cells(20, 35).Text));
                SetAttributeWithLogging(log, risk, attAppetiteSafety, LookupYesNoRiskLabel(XL1.Sheets[sheet].Cells(22, 35).Text));
                SetAttributeWithLogging(log, risk, attRationaleSafety, XL1.Sheets[sheet].Cells(20, 19).Text);

                SetAttributeWithLogging(log, risk, attLikelihoodPerformance, LookupRiskLabel(XL1.Sheets[sheet].Cells(25, 37).Text));
                SetAttributeWithLogging(log, risk, attImpactPerformance, LookupRiskLabel(XL1.Sheets[sheet].Cells(25, 35).Text));
开发者ID:Rusty,项目名称:RiskBowTieNWR,代码行数:67,代码来源:RiskModel.cs


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