//public static bool CopyShp(string strSource, string targetPath,string targetName) //{ // FeatureClassToFeatureClass gpCopyFeatureClass = new FeatureClassToFeatureClass(); // gpCopyFeatureClass.in_features = strSource; // gpCopyFeatureClass.out_path = targetPath; // gpCopyFeatureClass.out_name = targetName; // Geoprocessor geoProcessor = new Geoprocessor(); // geoProcessor.OverwriteOutput = true; // try // { // IGeoProcessorResult gpResult = geoProcessor.Execute(gpCopyFeatureClass, null) as IGeoProcessorResult; // //System.Runtime.InteropServices.Marshal.FinalReleaseComObject(geoProcessor); // return gpResult.Status == esriJobStatus.esriJobSucceeded; // } // catch // { // if (geoProcessor.MessageCount > 2) // { // //ErrorMessage = geoProcessor.GetMessage(2); // } // else // { // object objArg = geoProcessor.MaxSeverity; // //ErrorMessage = geoProcessor.GetMessages(ref objArg); // } // return false; // } // //CopyFeatures gpCopy = new CopyFeatures(); // //gpCopy.in_features = strSource; // //gpCopy.out_feature_class = strTarget; // //Geoprocessor geoProcessor = new Geoprocessor(); // //geoProcessor.OverwriteOutput = true; // //try // //{ // // IGeoProcessorResult gpResult = geoProcessor.Execute(gpCopy, null) as IGeoProcessorResult; // // //System.Runtime.InteropServices.Marshal.FinalReleaseComObject(geoProcessor); // // return gpResult.Status == esriJobStatus.esriJobSucceeded; // //} // //catch // //{ // // if (geoProcessor.MessageCount > 2) // // { // // // ErrorMessage = geoProcessor.GetMessage(2); // // } // // else // // { // // // object objArg = geoProcessor.MaxSeverity; // // // ErrorMessage = geoProcessor.GetMessages(ref objArg); // // } // // return false; // //} //} //private static bool ImportModelToShp(string shpFile, string excelFile) //{ // //ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass(); // //IWorkspace wsShp = wsf.OpenFromFile(Path.GetDirectoryName(shpFile), 0); // //IFeatureClass fClass = (wsShp as IFeatureWorkspace).OpenFeatureClass(Path.GetFileNameWithoutExtension(shpFile)); //} public static List<VersionInfo> GetVersionList(string projectID) { if (!Environment.AdodbHelper.TableExists("GH_Version")) { Environment.AdodbHelper.ExecuteSQL(@"Create table GH_Version ( VersionDate varchar(255), VersionFile varchar(255), Description varchar(4000), ProjectID varchar(32) not null)" ); } List<VersionInfo> dicVersion = new List<VersionInfo>(); try { DataTable tVersion = Environment.AdodbHelper.OpenTable("GH_Version"); int dIndex = tVersion.Columns.IndexOf("VersionDate"); int fIndex = tVersion.Columns.IndexOf("VersionFile"); int desIndex = tVersion.Columns.IndexOf("Description"); DataRow[] c = tVersion.Select( string.Format("Projectid='{0}'", projectID)); foreach (DataRow rowVersion in c) { VersionInfo vInfo = new VersionInfo(); vInfo.Date = rowVersion[dIndex] as string; vInfo.VersionFile = rowVersion[fIndex] as string; vInfo.Description = rowVersion[desIndex] as string; dicVersion.Add(vInfo); } } catch { return null; } return dicVersion; }
private void tBar_ValueChanged(object sender, EventArgs e) { if (m_VersionList == null) { tBtnDelete.Enabled = false; tBtnView.Enabled = false; return; } if (tBar.Value==0 || tBar.Value > m_VersionList.Count ) { tBtnDelete.Enabled = false; tBtnView.Enabled = false; return; } m_SelectedVersion = this.m_VersionList[tBar.Value-1]; tBtnView.Enabled= tBtnDelete.Enabled = (m_SelectedVersion != null); lblDate.Text = m_SelectedVersion.Date; labelControl6.Text = m_SelectedVersion.Description; if (cbView.Checked) { ViewVersion(); } }