private void frmSDEConnectionDetialInfo_Load(object sender, EventArgs e) { if (this.iworkspace_0 != null) { IEnumVersionInfo versions = (this.iworkspace_0 as IVersionedWorkspace2).Versions; versions.Reset(); IVersionInfo info2 = versions.Next(); string[] items = new string[2]; while (info2 != null) { items[0] = info2.VersionName; items[1] = info2.Description; ListViewItem item = new ListViewItem(items) { Tag = info2 }; this.lvwVersions.Items.Add(item); info2 = versions.Next(); } IHistoricalWorkspace workspace = this.iworkspace_0 as IHistoricalWorkspace; IEnumHistoricalMarker historicalMarkers = workspace.HistoricalMarkers; historicalMarkers.Reset(); for (IHistoricalMarker marker2 = historicalMarkers.Next(); marker2 != null; marker2 = historicalMarkers.Next()) { this.cboHistoricalMarker.Properties.Items.Add(marker2.Name); } if (this.cboHistoricalMarker.Properties.Items.Count > 0) { this.cboHistoricalMarker.SelectedIndex = 0; } } }
public IFIDSet FindHistoricalDifferences(IWorkspace workspace, string historicalMarkerName, string tableName, esriDifferenceType differenceType) { IHistoricalWorkspace historicalWorkspace = (IHistoricalWorkspace)workspace; IHistoricalVersion historicalVersion = historicalWorkspace.FindHistoricalVersionByName(historicalWorkspace.DefaultMarkerName); IHistoricalVersion historicalVersion1 = historicalWorkspace.FindHistoricalVersionByName(historicalMarkerName); IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)historicalVersion; IFeatureWorkspace featureWorkspace1 = (IFeatureWorkspace)historicalVersion1; ITable table = featureWorkspace.OpenTable(tableName); ITable table1 = featureWorkspace1.OpenTable(tableName); IDifferenceCursor differenceCursor = ((IVersionedTable)table).Differences(table1, differenceType, null); IFIDSet fIDSetClass = new FIDSet(); IRow row = null; int num = -1; differenceCursor.Next(out num, out row); while (num != -1) { fIDSetClass.Add(num); differenceCursor.Next(out num, out row); } fIDSetClass.Reset(); return(fIDSetClass); }
public void ChangeToArchivedVersion(string taskName, string timeStamp) { this.superTabControl1.SelectedTabIndex = 1; IHistoricalWorkspace hws = Util.ServerWorkspace as IHistoricalWorkspace; IVersionedWorkspace vws = hws as IVersionedWorkspace; DateTime ts = DateTime.Parse(timeStamp); IHistoricalVersion ver = hws.FindHistoricalVersionByTimeStamp(ts); IMapAdmin3 ma = this.axMapControl2.Map as IMapAdmin3; IBasicMap bmap = this.axMapControl2.Map as IBasicMap; AppManager am = AppManager.GetInstance(); IChangeDatabaseVersion cdv = new ChangeDatabaseVersionClass(); if (am.CurrentVersion == null) { ma.FireChangeVersion(vws.DefaultVersion, ver as IVersion); cdv.Execute(vws.DefaultVersion, ver as IVersion, bmap); } else { ma.FireChangeVersion(am.CurrentVersion, ver as IVersion); cdv.Execute(am.CurrentVersion, ver as IVersion, bmap); } am.CurrentVersion = ver as IVersion; am.TaskName = taskName; LocateTask(taskName); SetUpdateGridList(taskName); }
private void FrmHistoryView_Load(object sender, EventArgs e) { ClsHistory.WorkSpace = ClsDBInfo.SdeWorkspace; m_pHistoricalWorkspace = ClsHistory.WorkSpace as IHistoricalWorkspace; ClsHistory.OpenConn(); DTPickerL.Format = DateTimePickerFormat.Custom; DTPickerL.CustomFormat = "MM/dd/yyy HH:mm:ss tt"; DTPickerL.Value = ClsHistory.GetSystemTime(); DTPickerR.Format = DateTimePickerFormat.Custom; DTPickerR.CustomFormat = "MM/dd/yyy HH:mm:ss tt"; DTPickerR.Value = ClsHistory.GetSystemTime(); ////分别添加工作空间中现有历史标记到左右Cbo ClsHistory.AddHisMarkerToCbo(ref CboMarkerL); ClsHistory.AddHisMarkerToCbo(ref CboMarkerR); rdoTimeL.Checked = true; rdoTimeR.Checked = true; m_bHasLoad = true; }
private void method_2() { if (this.iworkspace_0 != null) { this.VersionInfolist.Items.Clear(); IEnumVersionInfo versions = (this.iworkspace_0 as IVersionedWorkspace).Versions; versions.Reset(); IVersionInfo info2 = versions.Next(); string[] items = new string[5]; while (info2 != null) { string versionName = info2.VersionName; string[] strArray2 = versionName.Split(new char[] { '.' }); if (strArray2.Length > 1) { items[0] = strArray2[1]; items[1] = strArray2[0]; } else { items[0] = strArray2[0]; items[1] = ""; } items[2] = this.method_1(info2.Access); items[3] = info2.Created.ToString(); items[4] = info2.Modified.ToString(); ListViewItem item = new ListViewItem(items) { Tag = info2 }; this.VersionInfolist.Items.Add(item); if ((this.int_0 == 0) && (versionName == this.object_0.ToString())) { item.Selected = true; } info2 = versions.Next(); } IHistoricalWorkspace workspace = this.iworkspace_0 as IHistoricalWorkspace; IEnumHistoricalMarker historicalMarkers = workspace.HistoricalMarkers; historicalMarkers.Reset(); for (IHistoricalMarker marker2 = historicalMarkers.Next(); marker2 != null; marker2 = historicalMarkers.Next()) { this.cboHistoricalMarker.Properties.Items.Add(marker2.Name); if ((this.int_0 == 1) && (marker2.Name == this.object_0.ToString())) { this.cboHistoricalMarker.SelectedIndex = this.cboHistoricalMarker.Properties.Items.Count - 1; } } if ((this.cboHistoricalMarker.Properties.Items.Count > 0) && (this.cboHistoricalMarker.SelectedIndex == -1)) { this.cboHistoricalMarker.SelectedIndex = 0; } this.dateTimePicker1.Value = DateTime.Now; if (this.int_0 == 0) { this.cboVersionType.SelectedIndex = 0; this.panelHistorical.Visible = false; } else { if (this.int_0 == 2) { this.dateTimePicker1.Value = (DateTime)this.object_0; } this.cboVersionType.SelectedIndex = 1; this.panelTransaction.Visible = false; this.cboVersionType_SelectedIndexChanged(this, new EventArgs()); this.rdoHistoryType_SelectedIndexChanged(this, new EventArgs()); } } }