ArcGISCompare.msAccProcs.LoadAllMappings C# (CSharp) Method

LoadAllMappings() public method

public LoadAllMappings ( ListBox lstBox, IWorkspace sWkSpc, IWorkspace dWkSpc ) : int
lstBox System.Windows.Forms.ListBox
sWkSpc IWorkspace
dWkSpc IWorkspace
return int
        public int LoadAllMappings(ListBox lstBox, IWorkspace sWkSpc, IWorkspace dWkSpc)
        {
            OleDbCommand theCMD;
              OleDbDataReader theReader;
              int retVal = 0;
              String theSQL = "";
              int ser = 0;
              int srcG, destG, geomT, fCount;
              String srcC, destC;
              FeatureMappingData theMap;

              try
              {
            // retrieve the contents of the FeatureMappings table
            theSQL = "SELECT * FROM [FeatureMappings]";
            theCMD = new OleDbCommand(theSQL, theConn);

            checkOpen();
            theReader = theCMD.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            while (theReader.Read())
            {
              // the serial number is key to tracking linkages of the objects while in the database
              ser = theReader.GetInt32(0);      // FeatureMappings.SerialNumber
              srcC = theReader.GetString(2);    // FeatureMappings.sourceClass
              destC = theReader.GetString(3);   // FeatureMappings.destinationClass
              srcG = theReader.GetInt32(4);     // FeatureMappings.sourceGeom
              destG = theReader.GetInt32(5);    // FeatureMappings.destinationGeom
              geomT = theReader.GetInt32(6);    // FeatureMappings.geomTransform
              fCount = theReader.GetInt32(7);   // FeatureMappings.featureCount

              // create the FeatureMappingData object and add to the lstMappings ListBox
              theMap = new FeatureMappingData("", srcC, destC, (esriGeometryType)srcG, (esriGeometryType)destG, ser);
              lstBox.Items.Add(theMap);
              Application.DoEvents();
              theMap.UpdateFeatureCount(fCount);
              theMap.zmTransform = theMap.CalcMZTransform(sWkSpc, dWkSpc);

              // get associated AttributeMappingData objects based on the SerialNumber (ser)
              LoadAttributeMappings(theMap, dWkSpc, ser);

              // get prior DataLoadError objects based on the SerialNumber (ser)
              LoadDataErrors(theMap, ser);
            }

            retVal = ser + 1;
            return retVal;
              }
              catch (Exception ex) { return -1; }
        }