Пример #1
0
 /// <summary>
 /// Converts DataTable into list of BaselineDefinition
 /// </summary>
 /// <param name="pBLDefs">Data table to convert</param>
 /// <returns>The converted BaselineDefinition list.</returns>
 public static List<BaselineDefinition> fromDataContainerToBaselinesDefinitionsList(DataContainer pBLDefs)
 {
     List<BaselineDefinition> lBLDefs = new List<BaselineDefinition>();
     pBLDefs.restart();
     while (pBLDefs.read())
     {
         BaselineDefinition lBLDef = new BaselineDefinition();
         for (int i = 0; i < pBLDefs.fieldCount(); i++)
         {
             switch (pBLDefs.getName(i))
             {
                 case "BaselineVersion":
                     lBLDef.BaselineVersion = pBLDefs.getValue(i);
                     break;
                 case "BaselineDescription":
                     lBLDef.BaselineDescription = pBLDefs.getValue(i);
                     break;
                 case "BaselineCreationDate":
                     DateTime lTmpDT = new DateTime();
                     DateTime.TryParse(pBLDefs.getValue(i), out lTmpDT);
                     lBLDef.BaselineCreationDate = lTmpDT;
                     break;
                 case "PISBaseDataPackageVersion":
                 case "UndefinedBaselinePISBaseVersion":
                     lBLDef.PISBaseDataPackageVersion = pBLDefs.getValue(i);
                     break;
                 case "PISMissionDataPackageVersion":
                 case "UndefinedBaselinePISMissionVersion":
                     lBLDef.PISMissionDataPackageVersion = pBLDefs.getValue(i);
                     break;
                 case "PISInfotainmentDataPackageVersion":
                 case "UndefinedBaselinePISInfotainmentVersion":
                     lBLDef.PISInfotainmentDataPackageVersion = pBLDefs.getValue(i);
                     break;
                 case "LMTDataPackageVersion":
                 case "UndefinedBaselineLmtVersion":
                     lBLDef.LMTDataPackageVersion = pBLDefs.getValue(i);
                     break;
                 default:
                     break;
             }
         }
         lBLDefs.Add(lBLDef);   
     }
     return lBLDefs;
 }
Пример #2
0
        /// <summary>
        /// Converts from BaselineDefinition to DataContainer.
        /// </summary>
        /// <param name="pBLDef">The BaselineDefinition instance</param>
        /// <returns>The resulting DataContainer</returns>
        public static DataContainer fromBaselineDefinitionToDataContainer(BaselineDefinition pBLDef)
        {
            DataContainer lBlDefCont = new DataContainer();
            lBlDefCont.Columns = new List<string>();
            lBlDefCont.Rows = new List<string>();
            lBlDefCont.Columns.Add("BaselineVersion");
            lBlDefCont.Columns.Add("BaselineDescription");
            lBlDefCont.Columns.Add("BaselineCreationDate");
            lBlDefCont.Columns.Add("PISBaseDataPackageVersion");
            lBlDefCont.Columns.Add("PISMissionDataPackageVersion");
            lBlDefCont.Columns.Add("PISInfotainmentDataPackageVersion");
            lBlDefCont.Columns.Add("LMTDataPackageVersion");

            lBlDefCont.Rows.Add(pBLDef.BaselineVersion);
            lBlDefCont.Rows.Add(pBLDef.BaselineDescription);
            lBlDefCont.Rows.Add(pBLDef.BaselineCreationDate.ToString());
            lBlDefCont.Rows.Add(pBLDef.PISBaseDataPackageVersion);
            lBlDefCont.Rows.Add(pBLDef.PISMissionDataPackageVersion);
            lBlDefCont.Rows.Add(pBLDef.PISInfotainmentDataPackageVersion);
            lBlDefCont.Rows.Add(pBLDef.LMTDataPackageVersion);
            
            return lBlDefCont;

        }