/// <summary> /// 异步记录API访问日志 /// </summary> /// <param name="log"></param> /// <returns></returns> public async Task WriteApiLogAsync(LogAPI log) { await Task.Run(() => { Db.Insertable(log).ExecuteCommand(); }); }
public DataTable GetTableForAdd() { if (m_pOleDbConnection != null) { try { string commandText = "Select * From " + TableName_TempTable + " Where 1>2"; m_pOleDbDataAdapter = new OleDbDataAdapter(commandText, m_pOleDbConnection); DataSet m_pDataSet = new DataSet(); m_pOleDbDataAdapter.Fill(m_pDataSet); if (m_pDataSet.Tables != null && m_pDataSet.Tables.Count > 0) { m_pDataTable = m_pDataSet.Tables[0]; return(m_pDataTable); } return(m_pDataTable); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } } return(null); }
private void btnLastPage_Click(object sender, System.EventArgs e) { LogSysLog.nCurrentPage = LogSysLog.nTotalPage; DataTable dtab_logs = LogAPI.dispOnePageLogs(LogSysLog.nCurrentPage, LogSysLog.nPerPageLogs); this.displayFoundLogs(dtab_logs); }
public override bool CreateTable() { if (m_pOleDbConnection != null) { try { base.CreateTable(); string strCommand = "Create Table " + TableName_TempTable + "(" + FieldName_Index1 + " int," + FieldName_Index2 + " int," + FieldName_Reverse1 + " int," + FieldName_Reverse2 + " int)"; //+ FieldName_EntityID + " int primary key)"; OleDbCommand oleDbCommand = new OleDbCommand(strCommand, m_pOleDbConnection); oleDbCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } } return(false); }
public static int ExecuteSQL(string sql) { IRDBHelper helper = null; try { string strCon = ManageConfig.instance.GetConnectionStrings("SHHConnection"); helper = RDBFactory.CreateDbHelper(strCon, DatabaseType.Oracle); int count = helper.ExecuteNonQuery(sql, CommandType.Text); if (count > 0) { helper.Commit(); } return(count); } catch (Exception ex) { LogAPI.Debug(ex); return(0); } finally { if (helper != null) { helper.DisConnect(); helper = null; } } }
/// <summary> /// 普通查询 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="hql">查询语句</param> /// <returns></returns> public static List <T> GetEntitiesByHQL <T>(string hql) { BasicDataManipulation baseData = new BasicDataManipulation(); ISession Session = baseData.GetSession(); List <T> list = new List <T>(); if (Session == null) { throw new Exception("打开数据库连接失败!"); } try { NHibernate.IQuery query = Session.CreateQuery(hql); list = query.List <T>().ToList(); return(list); } catch (Exception ex) { LogAPI.Debug(ex); return(list); } finally { if (Session != null) { Session.Dispose(); Session = null; } } }
public override bool CreateTable() { if (m_pOleDbConnection != null) { try { base.CreateTable(); string strCommand = "Create Table " + TableName_TempTable + "(" + FieldName_EntityID + " int primary key," + FieldName_FeatureCode + " VARCHAR(16)," + FieldName_Representation + " VARCHAR(16)," + FieldName_PolygonType + " int," + FieldName_X + " double," + FieldName_Y + " double," + FieldName_ComposeType + " int)"; OleDbCommand oleDbCommand = new OleDbCommand(strCommand, m_pOleDbConnection); oleDbCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } } return(false); }
/// <summary> /// 普通无分页查询 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql"></param> /// <returns></returns> public static List <T> GetEntitiesListByDB <T>(string sql) { IRDBHelper helper = null; List <T> list = new List <T>(); try { string strCon = ManageConfig.instance.GetConnectionStrings("SHHConnection"); helper = RDBFactory.CreateDbHelper(strCon, DatabaseType.MSSQL); DataTable dataTable = helper.ExecuteDatatable("table", sql, true); list = TBToList.ToList <T>(dataTable); return(list); } catch (Exception ex) { LogAPI.Debug(ex); return(list); } finally { if (helper != null) { helper.DisConnect(); helper = null; } } }
public override DataTable GetRecords(string strWhere, string strGroupBy, string strOrderBy) { if (m_pOleDbConnection != null) { try { m_nCurrentRowIndex = 0; string commandText = "Select * from " + "(Select LineNodeID as LineID,X1 as PX1,Y1 as PY1,X2 as PX2,Y2 as PY2,-1 from LineNodeEx Where EntityID=-1 " + "union Select LineNodeID as LineID,X2 as PX1,Y2 as PY1,X1 as PX2,Y1 as PY2,1 from LineNodeEx Where EntityID=-1) " + "Order By PX1,PY1,PX2,PY2,LineID"; m_pOleDbDataAdapter = new OleDbDataAdapter(commandText, m_pOleDbConnection); OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(m_pOleDbDataAdapter); return(GetNextRecords()); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } } return(null); }
/// <summary> /// 赋予属性 /// </summary> /// <param name="recordNode">属性信息</param> public void AttachAttribute(RecordNode recordNode, TableStructureNode pTableStructNode) { try { if (m_pIFeature != null) { if (m_pIFeature is IAnnotationFeature) { ///添加注记数据 } else { for (int i = 0; i < pTableStructNode.FieldNodes.Count; i++) { FieldNode pFieldNode = pTableStructNode.FieldNodes[i]; string sValue = recordNode.FieldValues[i]; m_pIFeature.set_Value(pFieldNode.FieldIndex, sValue); } m_pIFeature.Store(); } } } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } }
private object delGateWayPro(object param) { System.Collections.ArrayList arrayList = param as System.Collections.ArrayList; for (int i = 0; i < arrayList.Count; i++) { string text = (string)arrayList[i]; InSnergyGateway gateWaybyGID = InSnergyGateway.GetGateWaybyGID(text); int num = InSnergyGateway.DeleteGateway(text); if (num < 0) { return(num); } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0432011", new string[] { gateWaybyGID.GatewayName, valuePair }); } else { LogAPI.writeEventLog("0432011", new string[] { gateWaybyGID.GatewayName }); } InSnergyService.Unmanage(text); } return(1); }
public void Save(bool bRelease) { if (m_pOleDbDataAdapter != null && m_pDataTable != null) { try { OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(m_pOleDbDataAdapter); m_pOleDbDataAdapter.Update(m_pDataTable); if (bRelease == true) { m_pDataTable.Rows.Clear(); m_pDataTable.Dispose(); //m_pDataSet.Tables.Clear(); //m_pDataSet.Dispose(); m_pOleDbDataAdapter.Dispose(); m_pDataTable = null; //m_pDataSet = null; m_pOleDbDataAdapter = null; //m_pDataTable.Rows.Clear(); } } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } } }
private void btnLogSearchView_Click(object sender, System.EventArgs e) { this.dataGridViewLogs.DataSource = null; this.dataGridViewLogs.Update(); int arg_1E_0 = LogSysLog.nCurrentPage; if (LogSysLog.goPage >= LogSysLog.nTotalPage) { LogSysLog.goPage = LogSysLog.nTotalPage; LogSysLog.nCurrentPage = LogSysLog.nTotalPage; } else { if (LogSysLog.goPage < 1) { LogSysLog.goPage = 1; LogSysLog.nCurrentPage = 1; } else { LogSysLog.nCurrentPage = LogSysLog.goPage; } } DataTable dtab_logs = LogAPI.dispOnePageLogs(LogSysLog.nCurrentPage, LogSysLog.nPerPageLogs); this.displayFoundLogs(dtab_logs); }
/// <summary> /// 创建空间图层 /// </summary> /// <param name="tableStructureNode">VCT表结构节点</param> /// <param name="featureCodeNode">VCT要素编码节点</param> private FeatureLayer CreateFeatureLayer(TableStructureNode tableStructureNode, FeatureCodeNode featureCodeNode) { try { FeatureLayer featureLayer = null; ///获取要素集 IFeatureDataset featureDataset = m_pIDataset as IFeatureDataset; //从配置文件读取图形类型 string sGeometryType = ""; Metadata.MetaTable pMetaTalbe = Metadata.MetaDataFile.MetaTabls[tableStructureNode.TableName] as Metadata.MetaTable; if (pMetaTalbe != null) { sGeometryType = Metadata.MetaDataFile.GraphConfig.GetGraphTypeMark(pMetaTalbe.Type); } else { LogAPI.WriteLog("未能获取【" + tableStructureNode.TableName + "】的图形类型!"); return null; } ///创建点实体 if (sGeometryType == "Point") { featureLayer = new PointLayer(); } ///创建线实体 else if (sGeometryType == "Line") { featureLayer = new LineLayer(); } ///创建面实体 else if (sGeometryType == "Polygon") { featureLayer = new PolygonLayer(); } else if (sGeometryType == "Annotation") { featureLayer = new AnnotationLayer(); } if (featureLayer != null) { featureLayer.StructureNode = tableStructureNode; IFeatureClass pFcls = CreateFeatureClass(featureDataset, tableStructureNode, featureCodeNode); featureLayer.Table = pFcls as ITable; featureLayer.UpdateFieldIndex(); return featureLayer; } } catch(Exception ex) { LogAPI.WriteErrorLog(ex); } return null; }
private static void logServiceProcessInfo() { StringBuilder sb = new StringBuilder(); sb.Append("JobInspectionService object instantiated in:\r\n"); sb.Append(LogAPI.GetProcessInfo()); LogAPI.WebServiceLog.Info(sb.ToString()); }
/// <summary> /// 将构面的环分解成线段集合 /// </summary> /// <param name="pRing">构面的环对象IRing</param> /// <param name="strFeatureCode">线的要素代码</param> /// <param name="strRepresentation">图形表现编码</param> /// <param name="nEntityID">面实体索引</param> /// <returns>VCT线段对象集合</returns> private List<LineNodeEx> GetLineByRing(IRing pRing,string strFeatureCode,string strRepresentation,int nEntityID) { try { List<LineNodeEx> pListLine = new List<LineNodeEx>(); ///获取每个环中的线段集合 ISegmentCollection pExRingSegmentCollection = pRing as ISegmentCollection; ///处理集合中的各个线段 for (int i = 0; i < pExRingSegmentCollection.SegmentCount; i++) { ISegment pSegment = pExRingSegmentCollection.get_Segment(i); LineNodeEx pLineNodeEx = new LineNodeEx();//构造VCT线段对象 pLineNodeEx.SegmentNodes = new SegmentNodes();//构造线段对应的点集合 //pLineNodeEx.IsReverse = bReverse;//设置方向 pLineNodeEx.FeatureCode = strFeatureCode;//设置要素代码 pLineNodeEx.Representation = strRepresentation; pLineNodeEx.PolygonID = nEntityID;///所属面的标识码 BrokenLineNode pBrokenLinNode = new BrokenLineNode();//构造折线 pBrokenLinNode.PointInfoNodes = new PointInfoNodes(); ILine pLine = pSegment as ILine; if (pLine != null) { pBrokenLinNode.PointInfoNodes.Add(new PointInfoNode(pLine.FromPoint.X, pLine.FromPoint.Y)); pBrokenLinNode.PointInfoNodes.Add(new PointInfoNode(pLine.ToPoint.X, pLine.ToPoint.Y)); } //////如果是反向 ////if (bReverse) ////{ //// PointInfoNodes tempPointInfoNodes = new PointInfoNodes(); //// foreach (PointInfoNode item in pBrokenLinNode.PointInfoNodes) //// { //// tempPointInfoNodes.Add(item); //// } //// pBrokenLinNode.PointInfoNodes = tempPointInfoNodes; ////} pLineNodeEx.SegmentNodes.Add(pBrokenLinNode); pListLine.Add(pLineNodeEx); } return pListLine; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
private void butDel_Click(object sender, System.EventArgs e) { if (this.lbRack.SelectedItem == null) { return; } this.closetips(); int selectedIndex = this.lbRack.SelectedIndex; string text = this.lbRack.SelectedItem.ToString(); DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Rack_delCrm, new string[] { text }), MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.Cancel) { return; } this.lbRack.Items.RemoveAt(selectedIndex); RackInfo rackInfo = (RackInfo)this.m_AllRacks[selectedIndex]; this.m_AllRacks.RemoveAt(selectedIndex); this.m_MapID2Rack.Remove(rackInfo.RackID); this.delRackUi(rackInfo.RackID); RackInfo.DeleteByID(rackInfo.RackID); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0430011", new string[] { text, valuePair }); } else { LogAPI.writeEventLog("0430011", new string[] { text }); } EcoGlobalVar.setDashBoardFlg(780uL, "", 64); if (this.lbRack.Items.Count == 0) { this.butDel.Enabled = false; this.butModify.Enabled = false; return; } if (selectedIndex < this.lbRack.Items.Count) { this.lbRack.SelectedIndex = selectedIndex; return; } this.lbRack.SelectedIndex = this.lbRack.Items.Count - 1; }
/// <summary> /// 创建线实体 /// </summary> /// <param name="pITable">数据表对象</param> /// <param name="entinyNode">VCT空间实体节点</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { try { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); LineNode pLineNode = entinyNode as LineNode; if (pLineNode != null) { ///标识码赋值 int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pLineNode.EntityID); ///要素代码赋值 int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pLineNode.FeatureCode); ///创建空间数据 int dLineNodeCount = pLineNode.SegmentNodes.Count; IPointCollection pointCollection = new PolylineClass(); for (int i = 0; i < dLineNodeCount; i++) { //11表示折线类型 if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("LINETYPE", pLineNode.SegmentNodes[i].SegmentType.ToString()) == "BrokenLine") { BrokenLineNode pBLine = pLineNode.SegmentNodes[i] as BrokenLineNode; foreach (PointInfoNode pPointInfoNode in pBLine.PointInfoNodes) { IPoint pPoint = new PointClass(); pPoint.PutCoords(pPointInfoNode.X, pPointInfoNode.Y); object objType = Type.Missing; pointCollection.AddPoint(pPoint, ref objType, ref objType); } } else { //其他类型待后续扩展 } } (this.Feature as IFeature).Shape = pointCollection as IGeometry; //feature.set_Value(); this.Feature.Store(); } } catch(Exception ex) { LogAPI.WriteErrorLog(ex); } }
public bool addRack(int column, int row, string direction, string rackNm, string rackFNm) { if (!this.checkMove(direction, row, column, -1L)) { return(false); } int i_ex; int i_ey; if (direction.Equals("H")) { i_ex = row; i_ey = column + 1; } else { i_ex = row + 1; i_ey = column; } long num = RackInfo.CreateRackInfo(rackNm, "", row, column, i_ex, i_ey, rackFNm); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0430010", new string[] { rackNm, valuePair }); } else { LogAPI.writeEventLog("0430010", new string[] { rackNm }); } this.initRackList(); bool flag = commDev.updateZoneforRack(this.m_MapID2Rack[num]); this.addRackUI(column, row, direction, rackNm, "", num); RackInfo rackInfo = this.m_MapID2Rack[num]; this.lbRack.SelectedItem = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); ulong num2 = 516uL; int appAction = 0; if (flag) { num2 |= 264uL; } EcoGlobalVar.setDashBoardFlg(num2, "", appAction); return(true); }
/// <summary> /// 分页查询 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="hql">查询语句</param> /// <param name="skip">页数</param> /// <param name="take">每页显示条数</param> /// <param name="count">总数</param> /// <returns></returns> public static List <T> GetEntitiesByHQL <T>(string hql, int skip, int take, out int count) { BasicDataManipulation baseData = new BasicDataManipulation(); ISession Session = baseData.GetSession(); List <T> list = new List <T>(); if (Session == null) { throw new Exception("打开数据库连接失败!"); } try { NHibernate.IQuery query1 = Session.CreateQuery(hql); string hqlcount = ""; int fromIndex = hql.IndexOf("from"); int toIndex = hql.IndexOf("order"); int len = 0; if (toIndex == -1) { hqlcount = "select count(*) " + hql.Substring(fromIndex); } else { len = toIndex - fromIndex; hqlcount = "select count(*) " + hql.Substring(fromIndex, len); } NHibernate.IQuery querycount = Session.CreateQuery(hqlcount); try { count = int.Parse(querycount.UniqueResult().ToString()); } catch { count = 0; } NHibernate.IQuery query = query1.SetFirstResult(skip).SetMaxResults(take); list = query.List <T>().ToList(); return(list); } catch (Exception ex) { count = 0; LogAPI.Debug(ex); return(list); } finally { if (Session != null) { Session.Dispose(); Session = null; } } }
/// <summary> /// 获取要素编码节点 /// </summary> public override FeatureCodeNode GetFeatureCodeNode() { try { return base.GetFeatureCodeNode(); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// 根据表名称获取要素代码 /// </summary> /// <param name="sTableName"></param> /// <returns></returns> public static string GetFeatureCodeByName(string sTableName) { try { return((m_pMetaTables[sTableName] as MetaTable).FeatureCode); } catch (Exception ex) { LogAPI.WriteLog("未能获取【" + sTableName + "】的要素代码,请检查该表是否在配置表中!"); return(""); } }
/// <summary> /// 根据表名称获取配置表结构 /// </summary> /// <param name="sTableName"></param> /// <returns></returns> public static MetaTable GetMetaTalbleByName(string sTableName) { try { return(m_pMetaTables[sTableName] as MetaTable); } catch (Exception ex) { LogAPI.WriteLog("未能获取【" + sTableName + "】的配置表结构,请检查该表是否在配置表中!"); return(null); } }
/// <summary> /// RDBHelper 查询分页 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sql">sql语句</param> /// <param name="skip">页数</param> /// <param name="take">每页显示条数</param> /// <param name="count">总数</param> /// <returns></returns> public static List <T> GetEntitiesListByDB <T>(string sql, int skip, int take, out int count) { IRDBHelper helper = null; List <T> list = new List <T>(); try { string strCon = ManageConfig.instance.GetConnectionStrings("SHHConnection"); helper = RDBFactory.CreateDbHelper(strCon, DatabaseType.MSSQL); if (helper != null) { string countSQL = string.Format("select count(1) as NUM from({0})", sql); DataTable dt = helper.ExecuteDatatable("table", countSQL, true); if (dt != null && dt.Rows.Count > 0) { count = int.Parse(dt.Rows[0]["NUM"].ToString()); } else { count = 0; LogAPI.Debug("查询总数失败!"); } //分页查询 string strBegin = "select * from (select a.* ,rownum rn from ( "; string strEnd = string.Format(")a where rownum < {0} ) where rn>{1} ", take, skip); string querySQL = strBegin + sql + strEnd; DataTable dataTable = helper.ExecuteDatatable("table", querySQL, true); list = TBToList.ToList <T>(dataTable); } else { count = 0; LogAPI.Debug("数据库打开失败!"); } return(list); } catch (Exception ex) { count = 0; LogAPI.Debug("查询受理列表异常:"); LogAPI.Debug(ex); return(list); } finally { if (helper != null) { helper.DisConnect(); helper = null; } } }
/// <summary> /// 创建所有空间图层 /// </summary> /// <param name="tableStructureNodes">VCT表结构节点集合</param> /// <param name="featureCodeNodes">VCT要素编码节点集合</param> public List<TableLayer> CreateFeatureLayers(List<TableStructureNode> tableStructureNodes, Hashtable featureCodeNodes) { try { if (tableStructureNodes == null || featureCodeNodes == null) return null; List<TableLayer> arrFeatureLayer = new List<TableLayer>(); IFeatureDataset featureDataset = this.m_pIDataset as IFeatureDataset; ///读取第一个数据集进行处理 if (featureDataset != null) { ////遍历表结构节点进行空间数据表创建 foreach (TableStructureNode tableStructureNode in tableStructureNodes) { FeatureCodeNode featureCodeNode = featureCodeNodes[tableStructureNode.TableName] as FeatureCodeNode; //从配置文件读取图形类型 string sGeometryType = ""; Metadata.MetaTable pMetaTalbe = Metadata.MetaDataFile.MetaTabls[tableStructureNode.TableName] as Metadata.MetaTable; ///如果当前标准不包含表则不创建 if (pMetaTalbe != null) { sGeometryType = Metadata.MetaDataFile.GraphConfig.GetGraphTypeMark(pMetaTalbe.Type); if (sGeometryType == "NoneGeometry") { ///创建属性数据表 TableLayer pTalbeLayer = CreateTableLayer(m_pWorkspace as IFeatureWorkspace, tableStructureNode, featureCodeNode); if (pTalbeLayer != null) arrFeatureLayer.Add(pTalbeLayer); } else { ///创建空间数据表 FeatureLayer featureLayer = CreateFeatureLayer(tableStructureNode, featureCodeNode); if (featureLayer != null) arrFeatureLayer.Add(featureLayer); } } } return arrFeatureLayer; } return null; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// 获取VCT表节点 /// </summary> public TableNode GetTableNode() { try { TableNode pTableNode = new TableNode(); pTableNode.TableName = (this.m_pITable as IDataset).Name; return(pTableNode); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return(null); } }
private List <FieldNode> GetFieldNodes(IFields pFields) { try { IFeatureClass pFeatureCls = this.m_pITable as IFeatureClass; List <FieldNode> pListFieldNode = new List <FieldNode>(); for (int i = 0; i < pFields.FieldCount; i++) { IField itemField = pFields.get_Field(i); ///只保持属性字段 if (itemField.Type != esriFieldType.esriFieldTypeGeometry && itemField.Type != esriFieldType.esriFieldTypeOID && itemField.Name.ToUpper() != "SHAPE_LENGTH" && itemField.Name.ToUpper() != "SHAPE_AREA" ) { if (pFeatureCls != null && pFeatureCls.FeatureType == esriFeatureType.esriFTAnnotation) { AddAnnotationFieldNode(itemField, pListFieldNode); } else { string sLine = ""; if (itemField.Precision != null && itemField.Precision != 0) { sLine = itemField.Name + HeadNode.Separator + GetVCTFieldType(itemField.Type) + HeadNode.Separator + itemField.Length + HeadNode.Separator + itemField.Precision; } else { sLine = itemField.Name + HeadNode.Separator + GetVCTFieldType(itemField.Type) + HeadNode.Separator + itemField.Length; } FieldNode pFieldNode = new FieldNode(sLine); pListFieldNode.Add(pFieldNode); } } } return(pListFieldNode); } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return(null); } }
/// <summary> /// 获取实体集合 /// </summary> public override List<FeatureEntity> GetFeatureEntitys() { try { IFeatureClass pFeatureCls = this.Table as IFeatureClass; IFeatureCursor pCursor = pFeatureCls.Search(null, false); IFeature pFeature = pCursor.NextFeature(); List<FeatureEntity> listFeatureEnty = new List<FeatureEntity>();//保存FeatureEntity while (pFeature != null) { ///add by 曾平2011-9-7 添加裁切判断 ///裁切范围为空表示不进行裁切 if (m_CutGeometry != null) { if (!FeatureInCutRegion(pFeature.Shape)) { pFeature = pCursor.NextFeature(); continue; } } PolygonEntity pPointEntity = new PolygonEntity(); pPointEntity.CutGeometry = m_CutGeometry; pPointEntity.IsCut = m_bCut; pPointEntity.Feature = pFeature; ///初始化相关数据 //pPointEntity.GetEntityNode(); pPointEntity.FeatureCode = this.FeatureCode; int nEntityIDIndex = -1; nEntityIDIndex = pFeature.Fields.FindField(m_strEntityFieldName); if(nEntityIDIndex!=-1) pPointEntity.EntityID =Convert.ToInt32( pFeature.get_Value(nEntityIDIndex)); ///设置要素代码和标识码 pPointEntity.SetFeatureKeyFieldName(m_strEntityFieldName, m_strSYDMFieldName); listFeatureEnty.Add(pPointEntity); pFeature = pCursor.NextFeature(); } m_FeatureEntys = listFeatureEnty; return listFeatureEnty; } catch (Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// 获取要素集中的最大标识码 /// </summary> /// <returns></returns> public int GetMaxEntityID() { try { int nMaxEntityID = -1;///记录最大标识码 IEnumDataset pEnumDataset = m_pIDataset.Subsets; IDataset pSet = pEnumDataset.Next(); int nEntityID = -1; ///遍历数据集获取各个表中的标识码 while (pSet != null) { ITable pTable = pSet as ITable; ///从配置表中获取标识码字段 string sEntityFiled = ""; Metadata.MetaTable pMetaTable = Metadata.MetaDataFile.GetMetaTalbleByName(pSet.Name) as Metadata.MetaTable; if (pMetaTable != null) { sEntityFiled = pMetaTable.EntityIDFiledName; ////仅读取当前标准下的数据 ICursor pCursor = pTable.Search(null, true); IRow pRow = pCursor.NextRow(); while (pRow != null) { ///获取表中的最大标识码 int nIndex = pRow.Fields.FindField(sEntityFiled); if (nIndex != -1) { //if (!VCTFile.ConvertToInt32(pRow.get_Value(nIndex).ToString(), out nEntityID)) { nEntityID = pRow.get_Value(nIndex) == null || pRow.get_Value(nIndex).ToString() == "" ? -1 : Convert.ToInt32(pRow.get_Value(nIndex)); } if (nEntityID > nMaxEntityID) nMaxEntityID = nEntityID; } pRow = pCursor.NextRow(); } } pSet = pEnumDataset.Next(); } return nMaxEntityID; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return -1; } }
public string[] GetLogFileNames(string accessToken, string logDirectoryName) { logMethodInvocation(); checkAccessToken(accessToken); try { return(LogAPI.GetLogFileNames(logDirectoryName)); } catch (Exception ex) { logException(ex); return(null); } }