Ejemplo n.º 1
0
 /// <summary>
 /// Builds the DataTable to store the data about the pdf files
 /// </summary>
 internal void PopulateDrwgDataFromFileName()
 {
     foreach (string fileNameWithPath in drwgFileNameList)
     {
         Drwg drwg = new Drwg(fileNameWithPath);
         drwgListFiles.Add(drwg);
         drwg.ReadDrwgDataFromFileName();
     }
 }
Ejemplo n.º 2
0
        internal void AddStateToGridView(Drwg drwg, DrwgProps props, DataTable data)
        {
            HashSet <DataRow> foundRows = GetRowsBySelectQuery(props, data, true);

            foreach (DataRow row in foundRows)
            {
                row["State"] = (int)drwg.State;
            }
        }
Ejemplo n.º 3
0
 internal void PopulateDrwgDataFromMetadata()
 {
     foreach (DataRow row in MetadataDataTable.Rows)
     {
         Drwg drwg = new Drwg();
         drwg.DataFromMetadata = new DrwgProps.Source_Meta(
             row.Field <string>(fs.Number.ColumnName),
             row.Field <string>(fs.Title.ColumnName),
             row.Field <string>(fs.Revision.ColumnName),
             row.Field <string>(fs.Scale.ColumnName),
             row.Field <string>(fs.Date.ColumnName),
             row.Field <string>(fs.RevisionDate.ColumnName),
             row.Field <string>(fs.DrawingListCategory.ColumnName)
             );
         drwgListMeta.Add(drwg);
     }
 }
Ejemplo n.º 4
0
 internal void PopulateDrwgDataFromExcel()
 {
     foreach (DataTable table in ExcelDataSet.Tables)
     {
         foreach (DataRow row in table.Rows)
         {
             Drwg drwg = new Drwg();
             drwg.DataFromExcel = new DrwgProps.Source_Excel(
                 row.Field <string>(fs.Number.ColumnName),
                 row.Field <string>(fs.Title.ColumnName),
                 row.Field <string>(fs.Revision.ColumnName),
                 row.Field <string>(fs.Scale.ColumnName),
                 row.Field <string>(fs.Date.ColumnName),
                 row.Field <string>(fs.RevisionDate.ColumnName)
                 );
             drwgListExcel.Add(drwg);
         }
     }
 }
Ejemplo n.º 5
0
        internal void AggregateData()
        {
            List <Drwg> tempDrwgListFiles = new List <Drwg>(drwgListFiles);
            List <Drwg> tempDrwgListExcel = new List <Drwg>(drwgListExcel);
            List <Drwg> tempDrwgListMeta  = new List <Drwg>(drwgListMeta);

            Log.Info("Test message");
            //Compare meta and file data with one in excel
            //And match data to excel data
            foreach (Drwg drwgExcel in tempDrwgListExcel)
            {
                var query1 = tempDrwgListMeta.Where(x =>
                                                    x?.DataFromMetadata?.Number == drwgExcel.DataFromExcel.Number &&
                                                    x?.DataFromMetadata?.Revision == drwgExcel.DataFromExcel.Revision);

                if (query1.Count() > 1)
                {
                    Log.Warn("var query1 encountered count > 1.");
                }

                Drwg drwgMeta = query1.FirstOrDefault();

                var query2 = tempDrwgListFiles.Where(x =>
                                                     x?.DataFromFileName?.Number == drwgExcel.DataFromExcel.Number &&
                                                     x?.DataFromFileName?.Revision == drwgExcel.DataFromExcel.Revision);

                if (query2.Count() > 1)
                {
                    Log.Warn("var query2 encountered count > 1.");
                }

                Drwg drwgFile = query2.FirstOrDefault();

                Drwg drwgAggregated = new Drwg();
                drwgListAggregated.Add(drwgAggregated);

                drwgAggregated.DataFromFileName = drwgFile?.DataFromFileName;
                drwgAggregated.DataFromExcel    = drwgExcel?.DataFromExcel;
                drwgAggregated.DataFromMetadata = drwgMeta?.DataFromMetadata;

                if (!(drwgMeta is null))
                {
                    tempDrwgListMeta.RemoveAll(x => x.Id == drwgMeta.Id);
                }
                if (!(drwgFile is null))
                {
                    tempDrwgListFiles.RemoveAll(x => x.Id == drwgFile.Id);
                }
            }

            //Now to check if the temp collections have anything left
            //If they have that means that there's a descrepancy between data which needs located
            //Excel list should have been run to it's completion, so no need to check there.

            if (tempDrwgListFiles.Count > 0)
            {
                Log.Info("tempDrwgListFiles count {0} -> drwg(s) not in excel", tempDrwgListFiles.Count);
                foreach (Drwg drwgFile in tempDrwgListFiles)
                {
                    var query3 = tempDrwgListMeta.Where(x =>
                                                        x?.DataFromMetadata?.Number == drwgFile.DataFromFileName.Number &&
                                                        x?.DataFromMetadata?.Revision == drwgFile.DataFromFileName.Revision);

                    if (query3.Count() > 1)
                    {
                        Log.Warn("var query3 encountered count > 1.");
                    }

                    Drwg drwgMeta = query3.FirstOrDefault();

                    Drwg drwgAggregated = new Drwg();
                    drwgListAggregated.Add(drwgAggregated);

                    drwgAggregated.DataFromFileName = drwgFile?.DataFromFileName;
                    drwgAggregated.DataFromMetadata = drwgMeta?.DataFromMetadata;

                    if (!(drwgMeta is null))
                    {
                        tempDrwgListMeta.RemoveAll(x => x.Id == drwgMeta.Id);
                    }
                }
            }

            //Now to check if Meta temp collection has anything left
            if (tempDrwgListMeta.Count > 0)
            {
                Log.Warn("tempDrwgListMeta count {0} -> drwg(s) not in excel nor filedata", tempDrwgListMeta.Count);
                foreach (Drwg drwgMeta in tempDrwgListMeta)
                {
                    Drwg drwgAggregated = new Drwg();
                    drwgListAggregated.Add(drwgAggregated);

                    drwgAggregated.DataFromMetadata = drwgMeta?.DataFromMetadata;
                }
                tempDrwgListMeta.Clear();
            }
        }