public void ChangeHistoricalVersionByTimeStamp(IGraphicsContainer igraphicsContainer_0, IFeatureWorkspace ifeatureWorkspace_0, object object_0) { try { if ((((igraphicsContainer_0 != null) && (ifeatureWorkspace_0 != null)) && (object_0 != null)) && (ifeatureWorkspace_0 is IHistoricalWorkspace)) { object obj2; object obj3; (ifeatureWorkspace_0 as IWorkspace).ConnectionProperties.GetAllProperties(out obj2, out obj3); IPropertySet connectionProperties = new PropertySetClass(); for (int i = 0; i < ((System.Array)obj2).Length; i++) { switch (((System.Array)obj2).GetValue(i).ToString().ToUpper()) { case "SERVER": connectionProperties.SetProperty("SERVER", ((System.Array)obj3).GetValue(i)); break; case "INSTANCE": connectionProperties.SetProperty("INSTANCE", ((System.Array)obj3).GetValue(i)); break; case "DATABASE": connectionProperties.SetProperty("DATABASE", ((System.Array)obj3).GetValue(i)); break; case "USER": connectionProperties.SetProperty("USER", ((System.Array)obj3).GetValue(i)); break; case "PASSWORD": connectionProperties.SetProperty("PASSWORD", ((System.Array)obj3).GetValue(i)); break; case "AUTHENTICATION_MODE": connectionProperties.SetProperty("AUTHENTICATION_MODE", ((System.Array)obj3).GetValue(i)); break; } } connectionProperties.SetProperty("HISTORICAL_TIMESTAMP", object_0); connectionProperties.GetAllProperties(out obj2, out obj3); IWorkspaceFactory factory = new SdeWorkspaceFactoryClass(); IWorkspace workspace = factory.Open(connectionProperties, 0); if (workspace != null) { workspace.ConnectionProperties.GetAllProperties(out obj2, out obj3); this.ChangeVersion(igraphicsContainer_0, ifeatureWorkspace_0, workspace as IFeatureWorkspace); } } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
/// <summary> /// Uses the FindAddressCandidates method to geocode a single address /// </summary> /// <param name="address">Input address</param> /// <returns>IPropertySet that contains the matched address</returns> public virtual IPropertySet MatchAddress(IPropertySet address) { _log.Debug("IAddressGeocoding MatchAddress"); IPropertySet resultSet = new PropertySetClass(); try { IArray addressCandidates = FindAddressCandidates(address); if (addressCandidates.Count < 1) throw new Exception(); resultSet = addressCandidates.get_Element(0) as IPropertySet; object names; object values; // Get the name and value of all the properties in the property set resultSet.GetAllProperties(out names, out values); String[] nameArray = names as String[]; object[] valueArray = values as object[]; _log.Debug("MatchAddress Input address columns:" + string.Concat(nameArray)); // Add the Status Field to the Result List<string> matchNames = new List<string>(nameArray); List<object> matchValues = new List<object>(valueArray); matchNames.Insert(1, "Status"); matchValues.Insert(1, "M"); // Set the field names and values for the matched address names = matchNames.ToArray() as object; values = matchValues.ToArray() as object; resultSet.SetProperties(names, values); return resultSet; } catch (Exception ex) { _log.Error("An error ocurred during MatchAddress: " + ex.Message); // Return an empty address match to prevent errors IGeometry emptyPoint = new PointClass() as IGeometry; emptyPoint.SetEmpty(); resultSet.SetProperties(new string[] { "Shape", "Status", "Score", "Match_addr" }, new object[] { emptyPoint, "U", null, null }); return resultSet; } }