Example #1
0
        public Boolean WriteAttributeMapping(AttributeMappingData theDMap)
        {
            OleDbCommand theCMD;
              String theSQL = "";

              try
              {
            checkOpen();
            theSQL = "INSERT INTO [AttributeMappings] ([SerialNumber], [sourceClass], [destinationClass], [sourceField], [sourceDT], [sourceLength], [sourceEnum], [destinationField], [destinationDT], [destinationLength], [destinationEnum], [valueCount], [constant], [results], [Transform]) VALUES (" + theDMap.serialNumber + ", '" + theDMap.srcFC + "', '" + theDMap.destFC + "', '" + theDMap.srcAtt + "', " + numericDataType(theDMap.srcDT) + ", " + theDMap.srcLen.ToString() + ", '" + theDMap.srcEnum + "', '" + theDMap.destAtt + "', " + numericDataType(theDMap.destDT) + ", " + theDMap.destLen.ToString() + ", '" + theDMap.destEnum + "', " + theDMap.valueCount + ", '" + theDMap.constant + "', '" + theDMap.results + "', " + theDMap.transform + ")";
            theCMD = new OleDbCommand(theSQL, theConn);
            theCMD.ExecuteNonQuery();
            return true;
              }
              catch (Exception ex)
              {
            return false;
              }
        }
Example #2
0
        public Boolean LoadDataLoss(AttributeMappingData theAMap, int ser)
        {
            OleDbCommand theCMD;
              OleDbDataReader theReader;
              ValueData theS, theD;
              String theSQL = "";
              int theOID;
              String srcC, destC, srcF, theMsg;
              //DataLossEntries theEMap;

              try
              {
            theSQL = "SELECT [sourceClass], [destinationClass], [sourceFieldName], [srcObjectID], [dataLoadError] FROM [DataLossProblems] WHERE [SerialNumber] = " + ser;
            theCMD = new OleDbCommand(theSQL, theConn);

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

            while (theReader.Read())
            {
              srcC = theReader.GetString(0);
              destC = theReader.GetString(1);
              srcF = theReader.GetString(2);
              theOID = theReader.GetInt32(3);
              theMsg = theReader.GetString(4);

              //theEMap = new DataLossEntries(ser, srcC, destC, srcF, theOID, theMsg);

              //theAMap.AddDataLoss(theEMap);
            }

            return true;
              }
              catch (Exception ex) { return false; }
        }
Example #3
0
        public Boolean LoadValueMappings(AttributeMappingData theAMap)
        {
            OleDbCommand theCMD;
              OleDbDataReader theReader;
              ValueData theS, theD;
              String theSQL = "";
              int vCount;
              String srcV, destV;
              ValueMappingData theMap;

              try
              {
            theSQL = "SELECT [sourceValue], [destinationValue], [valueCount] FROM [ValueMappings] WHERE [serialNumber] = " + theAMap.serialNumber + " AND [srcFieldName] = '" + theAMap.srcAtt + "' AND [destFieldName] = '" + theAMap.destAtt + "'";
            theCMD = new OleDbCommand(theSQL, theConn);

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

            while (theReader.Read())
            {
              srcV = theReader.GetString(0);
              destV = theReader.GetString(1);
              vCount = 0;

              theS = new ValueData(theAMap.srcFC, srcV, theAMap.srcEnum);

              theD = new ValueData(theAMap.destFC, destV, theAMap.destEnum);

              theMap = new ValueMappingData(theAMap, theS, theD);

              theAMap.AddValueConversion(theMap);
            }

            return true;
              }
              catch (Exception ex) { return false; }
        }
Example #4
0
 private void lstAttMappings_SelectedIndexChanged(object sender, EventArgs e)
 {
     tcTop.TabPages.Remove(tabPage3);
     if (lstAttMappings.SelectedItems.Count == 1 && tcTop.TabPages.Count == 2)
     {
         theAMap = (AttributeMappingData)lstAttMappings.SelectedItem;
         lstAttMappings.ContextMenuStrip = conMenu;
     }
     lstAttMappings.ContextMenuStrip = null;
     lbSrcAttributes.SelectedIndex = getAttributeOrder(theAMap.srcAtt, lbSrcAttributes);
     lbDestAttributes.SelectedIndex = getAttributeOrder(theAMap.destAtt, lbDestAttributes);
 }
Example #5
0
        public Boolean LoadAttributeMappings(FeatureMappingData theMap, IWorkspace theWS, int serial)
        {
            OleDbCommand theCMD;
              OleDbDataReader theReader;
              String theSQL = "";
              int srcDT, destDT, srcL, destL, fCount;
              String srcC, destC, srcF, destF, srcE, destE, constant, result;
              AttributeMappingData theAMap;

              try
              {
            theSQL = "SELECT * FROM [AttributeMappings] WHERE [SerialNumber] = " + serial.ToString();
            theCMD = new OleDbCommand(theSQL, theConn);

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

            while (theReader.Read())
            {
              srcC = theReader.GetString(1);
              destC = theReader.GetString(2);
              srcF = theReader.GetString(3);
              destF = theReader.GetString(7);
              srcDT = theReader.GetInt32(4);
              destDT = theReader.GetInt32(8);
              srcL = theReader.GetInt32(5);
              destL = theReader.GetInt32(9);
              srcE = theReader.GetString(6);
              destE = theReader.GetString(10);
              constant = theReader.GetString(12);
              result = theReader.GetString(13);
              fCount = theReader.GetInt32(11);

              IField theSF = new FieldClass();
              IFieldEdit theES = (IFieldEdit)theSF;
              theES.Name_2 = srcF;
              theES.AliasName_2 = srcF;
              theES.Type_2 = ToESRIDataType(srcDT);
              theES.Length_2 = srcL;

              IFields destFld = GeoDbProcs.GetFeatureClassFields(theWS, destC);

              int theIndex = destFld.FindField(destF);

              if (theIndex >= 0)
              {
            IField theDF = destFld.get_Field(theIndex);
            AttributeData theS = new AttributeData(srcC, theSF, fCount);
            AttributeData theD = new AttributeData(destC, theDF, fCount);
            theAMap = new AttributeMappingData(theMap, theS, theD);

            theAMap.AddResults(result);
            theAMap.constant = constant;
            theMap.AddTransform(theAMap);

            LoadValueMappings(theAMap);

            LoadDataLoss(theAMap, serial);
              }
            }

            return true;
              }
              catch (Exception ex) { return false; }
        }
Example #6
0
        private void mnuInsertConstant_Click(object sender, EventArgs e)
        {
            dlgConstant theDlg = new dlgConstant();

            AttributeData theItem = (AttributeData)lbDestAttributes.SelectedItem;
            theDlg.lblInsertHere.Text = theMap.destFC + " --- " + theItem.Name;
            theDlg.lblDataType.Text = MiscProcs.UnBuildDataType(theItem.dataType, theItem.charLength);
            theDlg.lblLength.Text = theItem.charLength.ToString();
            theDlg.forNulls.Text = "F";

            if (theItem.enumName != "")
            {
                theDlg.lblEnum.Text = theItem.enumName;
            }

            if (theItem.usesConstant)
            {
            }

            DialogResult theRes = theDlg.ShowDialog(this);

            if (theRes == DialogResult.OK)
            {
                AttributeData EmptyAttribute = new AttributeData(theMap.srcFC, null, 0);

                theAMap = new AttributeMappingData(theMap, EmptyAttribute, theItem);
                theAMap.constant = theDlg.txtConst.Text;

                lstAttMappings.Items.Add(theAMap);
                theAMap.transform = 20;
                theMap.AddTransform(theAMap);

                theItem.numMappings += 1;
                theItem.usesConstant = true;
            }
        }
Example #7
0
 internal ValueMappingData(AttributeMappingData aMap, ValueData sourceV, ValueData destV)
 {
   this.serialNumber = aMap.serialNumber;
   this.srcFC = aMap.srcFC;
   this.destFC = aMap.destFC;
   this.srcAtt = aMap.srcAtt;
   this.srcEnum = aMap.srcEnum;
   this.destEnum = aMap.destEnum;
   this.destAtt = aMap.destAtt;
   this.srcV = sourceV.value;
   this.destV = destV.value;
 }
Example #8
0
 public void AddTransform(AttributeMappingData theAMap)
 {
   if (theTransforms == null)
   {
     System.Array.Resize(ref this.theTransforms, 1);
     this.theTransforms[0] = theAMap;
   }
   else
   {
     System.Array.Resize(ref this.theTransforms, this.theTransforms.Length + 1);
     this.theTransforms[this.theTransforms.Length - 1] = theAMap;
   }
 }
Example #9
0
    internal static ICodedValueDomain GetFieldEnumeration(IWorkspace theWS, String which, AttributeMappingData theAMap)
    {
      IDomain theD;
      ICodedValueDomain theCVD = null;

      IWorkspaceDomains theDWS = (IWorkspaceDomains)theWS;

      if (which == "Source")
      {
        theD = theDWS.get_DomainByName(theAMap.srcEnum);
      }
      else
      {
        theD = theDWS.get_DomainByName(theAMap.destEnum);
      }

      if (theD != null) { theCVD = (ICodedValueDomain)theD; }

      return theCVD;
    }
Example #10
0
    internal static int GetValueOccurrences(IWorkspace theWS, String which, AttributeMappingData theMap, String theV)
    {
      IFeatureClass theFC = null;
      String fieldName = "";
      esriFieldType theT = esriFieldType.esriFieldTypeString;

      ISQLSyntax theS = (ISQLSyntax)theWS;
      switch (which)
      {
        case "Template":
          theFC = GetFeatureClass(theWS, theMap.srcFC);
          fieldName = theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix) + theMap.srcAtt + theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
          theT = theMap.srcDT;
          break;
        case "Implementation":
          theFC = GetFeatureClass(theWS, theMap.destFC);
          fieldName = theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix) + theMap.destAtt + theS.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
          theT = theMap.destDT;
          break;
      }

      IQueryFilter theQF = new QueryFilterClass();
      switch (theT)
      {
        case esriFieldType.esriFieldTypeString:
          if (theV == "") { theQF.WhereClause = fieldName + " IS NOT NULL AND " + fieldName + " <> ''"; }
          else { theQF.WhereClause = fieldName + " = '" + theV + "'"; }
          break;
        case esriFieldType.esriFieldTypeInteger:
          if (theV == "") { theQF.WhereClause = fieldName + " IS NOT NULL AND " + fieldName + " <> 0"; }
          else { theQF.WhereClause = fieldName + " = " + theV; }
          break;
      }

      return theFC.FeatureCount(theQF);
    }