public void Select_List_Item(string columnName) { Mapped_Fields mappedField = Bibliographic_Mapping.String_To_Mapped_Field(columnName); string listValue = Bibliographic_Mapping.Mapped_Field_To_String(mappedField); comboBox1.SelectedIndex = comboBox1.FindStringExact(listValue); }
private void write_mappings_and_constants(DataTable inputFile, List <Mapped_Fields> mapping, Constant_Fields constantCollection) { try { string mapping_name = filename + ".importdata"; StreamWriter mappingWriter = new StreamWriter(mapping_name, false); mappingWriter.WriteLine("MAPPING:"); int column = 0; foreach (Mapped_Fields mappedField in mapping) { mappingWriter.WriteLine("\t\"" + inputFile.Columns[column].ColumnName.Replace("\"", """) + "\" --> " + Bibliographic_Mapping.Mapped_Field_To_String(mappedField)); column++; } mappingWriter.WriteLine(); mappingWriter.WriteLine("CONSTANTS:"); foreach (Constant_Field_Data constantData in constantCollection.constantCollection) { if ((constantData.Data.Length > 0) && (constantData.Field != Mapped_Fields.None)) { mappingWriter.WriteLine("\t" + Bibliographic_Mapping.Mapped_Field_To_String(constantData.Field) + " <-- \"" + constantData.Data.Replace("\"", """)); } } mappingWriter.Flush(); mappingWriter.Close(); } catch (Exception ee) { MessageBox.Show("Unable to save the import data for this job. \n\n" + ee, "Error saving mapping", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public SobekCM_Item Next() { // Is this a valid row? if (row >= excelData.Rows.Count) { return(null); } // Create the object based on the column mapping SobekCM_Item returnPackage = new SobekCM_Item(); // reset the static variables in the mappings class Bibliographic_Mapping.clear_static_variables(); // Add data from each column into the bib package // Step through each column in the data row DataRow thisRow = excelData.Rows[row++]; for (int i = 0; i < excelData.Columns.Count; i++) { if ((thisRow[i] != null) && (thisRow[i].ToString().Length > 0) && (columnMaps.isMapped(i))) { Bibliographic_Mapping.Add_Data(returnPackage, thisRow[i].ToString(), columnMaps.Get_Field(i).Field); } } return(returnPackage); }
static Column_Assignment_Control() { Array enumValues = Enum.GetValues(typeof(Mapped_Fields)); mappable_fields = new string[enumValues.Length]; for (int i = 0; i < enumValues.Length; i++) { mappable_fields[i] = Bibliographic_Mapping.Mapped_Field_To_String((Mapped_Fields)enumValues.GetValue(i)); } }
public void Add_To_Package(SobekCM_Item Package) { // reset the static variables in the mappings class Bibliographic_Mapping.clear_static_variables(); // Step through each constant data and add it foreach (Constant_Field_Data thisData in constantCollection) { Bibliographic_Mapping.Add_Data(Package, thisData.Data, thisData.Field); } }
public ExcelBibliographicReader() { // Set the Gembox spreadsheet license key SpreadsheetInfo.SetLicense("EDWF-ZKV9-D793-1D2A"); // Set some defaults fileName = String.Empty; sheetName = String.Empty; excelData = null; bibMap = new Bibliographic_Mapping(); columnMaps = new Column_Field_Mapper(); }
private SobekCM_Item Load_Data_From_DataRow_And_Constants(DataRow currentRow) { // Check to see if this is a completely empty row bool empty_row = true; for (int i = 0; i < currentRow.ItemArray.Length; i++) { if (currentRow[i].ToString().Trim().Length > 0) { empty_row = false; break; } } // If this is empty, skip it if (empty_row) { return(null); } // Create the bibliographic package SobekCM_Item bibPackage = new SobekCM_Item(); // reset the static variables in the mappings class Bibliographic_Mapping.clear_static_variables(); // Step through each column in the data row and add the data into the bib package for (int i = 0; (i < inputDataTbl.Columns.Count) && (i < mapping.Count); i++) { if (currentRow[i].ToString().Length > 0) { Bibliographic_Mapping.Add_Data(bibPackage, currentRow[i].ToString(), mapping[i]); } } // Copy all user settings to this package base.Copy_User_Settings_To_Package(bibPackage); // Return the built object return(bibPackage); }