コード例 #1
0
        /// <summary>
        /// Read a list of people froman Excel file
        /// </summary>
        /// <param name="folder">Folder where the People file is located</param>
        /// <param name="filename">Name of the People file</param>
        public People(string folder, string filename)
        {
            DataTable results;

            if (filename.ToLower().EndsWith(".csv"))
            {
                results = CSVReader.CSVReader.ReadCSVFile(folder + "\\" + filename, true);
            }
            else
            {
                results = NpoiHelper.ReadExcelFileToDataTable(folder, filename);
            }
            CreatePersonsFromDataTable(results);
        }
コード例 #2
0
        /// <summary>
        /// Initialize the journal weights file
        /// </summary>
        /// <param name="JournalWeightsFilename">Filename of the journal weights file</param>
        public Reports(Database DB, string JournalWeightsFilename)
        {
            PeopleReportSections = DefaultPeopleReportSections();

            string[]  Columns = { "JOURNAL TITLE", "JIF" };
            DataTable Results = NpoiHelper.ReadExcelFileToDataTable(
                Path.GetDirectoryName(JournalWeightsFilename),
                Path.GetFileName(JournalWeightsFilename));

            // Populate the Weights hash table (which was declared to be case-insensitive)
            Weights = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
            foreach (DataRow Row in Results.Rows)
            {
                if (!Weights.ContainsKey(Row["JOURNAL TITLE"].ToString()))
                {
                    Weights.Add(Row["JOURNAL TITLE"].ToString(), Convert.ToSingle(Row["JIF"]));
                }
            }

            this.PubTypes = new PublicationTypes(DB);
            this.DB       = DB;
        }