private void btn_Save_Click(object sender, EventArgs e) { try { IRowBuffer myRowBuffer = this.dgv_FieldValue.Tag as IRowBuffer; for (int i = 0; i < this.dgv_FieldValue.Rows.Count; i++) { DataGridViewRow myViewRow = this.dgv_FieldValue.Rows[i]; if (myViewRow.Tag == null) { continue; } EditField editfield = myViewRow.Tag as EditField; if (myViewRow.Cells["fieldvalue"].Value == null || string.IsNullOrEmpty(myViewRow.Cells["fieldvalue"].Value.ToString())) { if (editfield.fieldInfo.Nullable) { myRowBuffer.SetNull(editfield.fieldIndex); } } else { IDomain dm = editfield.fieldInfo.Domain; if (dm == null || dm.DomainType == gviDomainType.gviDomainRange) { myRowBuffer.SetValue(editfield.fieldIndex, myViewRow.Cells["fieldvalue"].Value); } else { myRowBuffer.SetValue(editfield.fieldIndex, this.GetDomainNameValuePair(dm)[myViewRow.Cells["fieldvalue"].Value.ToString()]); } } } fc.Store(myRowBuffer); MessageBox.Show("保存编辑成功!"); (this.Owner as MainForm).UnhighlightRcFeature(fc, fid); this.Close(); } catch { MessageBox.Show("保存编辑失败!"); } }
private void tsb_Insert_Click(object sender, EventArgs e) { this.cmdManager.StartCommand(); //克隆当前选中要素,将z值提高10米,作为新的行进行插入 IRowBuffer row = curSelectFc.GetRow(curSelectFid).Clone(false); int geoPos = curSelectFc.GetFields().IndexOf("Geometry"); if (geoPos != -1) { IModelPoint geo = row.GetValue(geoPos) as IModelPoint; geo.Z = geo.Z + 10; row.SetValue(geoPos, geo); } row.SetNull(0); this.cmdManager.InsertFeature(curSelectFc as IObjectClass, row); this.axRenderControl1.FeatureManager.CreateFeature(curSelectFc, row); this.tsb_Redo.Enabled = this.cmdManager.CanRedo; this.tsb_Undo.Enabled = this.cmdManager.CanUndo; this.tsb_Insert.Enabled = false; }
private void AddRecord() { try { this.beforeRowBufferMap.Clear(); SelectCollection.Instance().Clear(); DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } IFeatureLayer fl = featureClassInfo.GetFeatureLayer(); if (fl == null) { return; } IFieldInfoCollection fields = fc.GetFields(); int indexGeo = fields.IndexOf(fl.GeometryFieldName); if (indexGeo == -1) { return; } IFieldInfo fiGeo = fields.Get(indexGeo); if (fiGeo == null || fiGeo.GeometryDef == null) { return; } IGeometry geo = this._drawTool.GetGeo(); if (geo.GeometryType != gviGeometryType.gviGeometryPolygon) { return; } IPolygon polygon = geo as IPolygon; IPolygon geoOut = this._geoFact.CreateGeometry(gviGeometryType.gviGeometryPolygon, fiGeo.GeometryDef.VertexAttribute) as IPolygon; for (int i = 0; i < polygon.ExteriorRing.PointCount; i++) { IPoint ptGet = polygon.ExteriorRing.GetPoint(i); IPoint pttemp = ptGet.Clone2(fiGeo.GeometryDef.VertexAttribute) as IPoint; if (fiGeo.GeometryDef.HasZ) { pttemp.SetCoords(ptGet.X, ptGet.Y, ptGet.Z, 0, 0); } else { pttemp.SetCoords(ptGet.X, ptGet.Y, 0, 0, 0); } geoOut.ExteriorRing.AppendPoint(pttemp); } IRowBufferCollection rowCol = new RowBufferCollection(); IRowBufferFactory fac = new RowBufferFactory(); IRowBuffer row = fac.CreateRowBuffer(fields); row.SetValue(indexGeo, geoOut); foreach (DataRow dr in this._dt.Rows) { IFieldInfo fi = dr["F"] as IFieldInfo; if (fi == null) { continue; } string fn = fi.Name; int index = fields.IndexOf(fn); if (index != -1) { if (dr["FV"] == null) { row.SetNull(index); } else { string strobj = dr["FV"].ToString(); bool bRes = false; switch (fi.FieldType) { case gviFieldType.gviFieldBlob: case gviFieldType.gviFieldGeometry: case gviFieldType.gviFieldUnknown: break; case gviFieldType.gviFieldFloat: float f; bRes = float.TryParse(strobj, out f); if (bRes) { row.SetValue(index, f); } else { row.SetNull(index); } break; case gviFieldType.gviFieldDouble: double d; bRes = double.TryParse(strobj, out d); if (bRes) { row.SetValue(index, d); } else { row.SetNull(index); } break; case gviFieldType.gviFieldFID: case gviFieldType.gviFieldUUID: case gviFieldType.gviFieldInt16: Int16 i16; bRes = Int16.TryParse(strobj, out i16); if (bRes) { row.SetValue(index, i16); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt32: Int32 i32; bRes = Int32.TryParse(strobj, out i32); if (bRes) { row.SetValue(index, i32); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt64: Int64 i64; bRes = Int64.TryParse(strobj, out i64); if (bRes) { row.SetValue(index, i64); } else { row.SetNull(index); } break;; case gviFieldType.gviFieldString: row.SetValue(index, strobj); break; case gviFieldType.gviFieldDate: DateTime dt; bRes = DateTime.TryParse(strobj, out dt); if (bRes) { row.SetValue(index, dt); } else { row.SetNull(index); } break; default: break; } } } } rowCol.Add(row); beforeRowBufferMap[featureClassInfo] = rowCol; UpdateDatabase(); } catch (Exception ex) { } }
private void AddRecord() { try { this.beforeRowBufferMap.Clear(); SelectCollection.Instance().Clear(); if (reg == null || tc == null) { return; } FacStyleClass style = this.cmbStyle.EditValue as FacStyleClass; if (style == null) { return; } SubClass sc = this.cmbClassify.EditValue as SubClass; DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } IResourceManager manager = fc.FeatureDataSet as IResourceManager; if (manager == null) { return; } IFeatureLayer fl = featureClassInfo.GetFeatureLayer(); if (fl == null) { return; } IFieldInfoCollection fields = fc.GetFields(); int indexOid = fields.IndexOf(fc.FidFieldName); if (indexOid == -1) { return; } int mpindex = fields.IndexOf(fl.GeometryFieldName); if (mpindex == -1) { return; } int indexShape = fields.IndexOf("Shape"); if (indexShape == -1) { return; } int indexFootPrint = fields.IndexOf("FootPrint"); if (indexFootPrint == -1) { return; } int indexStyleId = fields.IndexOf("StyleId"); if (indexStyleId == -1) { return; } int indexFacilityId = fields.IndexOf("FacilityId"); if (indexFacilityId == -1) { return; } IFieldInfo fiShape = fields.Get(indexShape); if (fiShape == null || fiShape.GeometryDef == null) { return; } IGeometry geo = this._drawTool.GetGeo(); if (geo.GeometryType != gviGeometryType.gviGeometryPoint) { return; } IPoint pt = geo as IPoint; IPoint geoOut = pt.Clone2(fiShape.GeometryDef.VertexAttribute) as IPoint; if (fiShape.GeometryDef.HasZ) { geoOut.SetCoords(pt.X, pt.Y, pt.Z, 0, 0); } else { geoOut.SetCoords(pt.X, pt.Y, 0, 0, 0); } IQueryFilter filter = new QueryFilter(); filter.WhereClause = "1=1"; filter.ResultBeginIndex = 0; filter.ResultLimit = 1; filter.PostfixClause = "ORDER BY " + fc.FidFieldName + " desc"; IFdeCursor cursor = null; cursor = fc.Search(filter, false); IRowBuffer rowtemp = cursor.NextRow(); int oid = 0; if (rowtemp != null) { oid = int.Parse(rowtemp.GetValue(indexOid).ToString()); } if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } IRowBufferFactory fac = new RowBufferFactory(); IRowBuffer row = fac.CreateRowBuffer(fields); row.SetValue(indexOid, oid + 1); row.SetValue(indexShape, geoOut); row.SetValue(indexFootPrint, geoOut.Clone2(gviVertexAttribute.gviVertexAttributeNone)); row.SetValue(indexStyleId, style.ObjectId); row.SetValue(indexFacilityId, BitConverter.ToString(ObjectIdGenerator.Generate()).Replace("-", string.Empty).ToLowerInvariant()); if (sc != null) { int indexClassify = fields.IndexOf(this._classifyName); int indexGroupId = fields.IndexOf("GroupId"); if (indexClassify != -1 && indexGroupId != -1) { row.SetValue(indexClassify, sc.Name); row.SetValue(indexGroupId, sc.GroupId); } } foreach (DataRow dr in this._dt.Rows) { IFieldInfo fi = dr["F"] as IFieldInfo; if (fi == null) { continue; } string fn = fi.Name; int index = fields.IndexOf(fn); if (index != -1) { if (dr["FV"] == null) { row.SetNull(index); } else { string strobj = dr["FV"].ToString(); bool bRes = false; switch (fi.FieldType) { case gviFieldType.gviFieldBlob: case gviFieldType.gviFieldGeometry: case gviFieldType.gviFieldUnknown: break; case gviFieldType.gviFieldFloat: float f; bRes = float.TryParse(strobj, out f); if (bRes) { row.SetValue(index, f); } else { row.SetNull(index); } break; case gviFieldType.gviFieldDouble: double d; bRes = double.TryParse(strobj, out d); if (bRes) { row.SetValue(index, d); } else { row.SetNull(index); } break; case gviFieldType.gviFieldFID: case gviFieldType.gviFieldUUID: case gviFieldType.gviFieldInt16: Int16 i16; bRes = Int16.TryParse(strobj, out i16); if (bRes) { row.SetValue(index, i16); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt32: Int32 i32; bRes = Int32.TryParse(strobj, out i32); if (bRes) { row.SetValue(index, i32); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt64: Int64 i64; bRes = Int64.TryParse(strobj, out i64); if (bRes) { row.SetValue(index, i64); } else { row.SetNull(index); } break;; case gviFieldType.gviFieldString: row.SetValue(index, strobj); break; case gviFieldType.gviFieldDate: DateTime dt; bRes = DateTime.TryParse(strobj, out dt); if (bRes) { row.SetValue(index, dt); } else { row.SetNull(index); } break; default: break; } } } } Fac plf = new PipeNodeFac(reg, style, row, tc); IModelPoint mp = null; IModel finemodel = null; IModel simplemodel = null; string name = ""; if (UCAuto3DCreate.RebuildModel(plf, style, out mp, out finemodel, out simplemodel, out name)) { if (finemodel == null || mp == null) { return; } mp.ModelEnvelope = finemodel.Envelope; row.SetValue(mpindex, mp); //if (mc != null) //{ // if (indexClassify != -1 && indexGroupid != -1) // { // } //} bool bRes = false; if (!string.IsNullOrEmpty(mp.ModelName)) { if (!manager.ModelExist(mp.ModelName)) { if (manager.AddModel(mp.ModelName, finemodel, simplemodel)) { bRes = true; } } else { if (manager.UpdateModel(mp.ModelName, finemodel) && manager.UpdateSimplifiedModel(mp.ModelName, simplemodel)) { bRes = true; } } } if (!bRes) { return; } IRowBufferCollection rowCol = new RowBufferCollection(); rowCol.Add(row); beforeRowBufferMap[featureClassInfo] = rowCol; UpdateDatabase(); app.Current3DMapControl.FeatureManager.RefreshFeatureClass(fc); } } catch (Exception ex) { } }
private void sbtn_Split_Click(object sender, System.EventArgs e) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } if (System.Windows.Forms.DialogResult.No != XtraMessageBox.Show("模型拆分不支持撤销操作,是否继续?", "询问", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation)) { IFeatureClass featureClass = null; IFdeCursor fdeCursor = null; app.Current3DMapControl.PauseRendering(false); WaitDialogForm waitDialogForm = null; try { int count = SelectCollection.Instance().GetCount(true); if (count <= 0) { XtraMessageBox.Show("未选中要拆分的模型!"); } else { if (this._renderGeo == null || this._renderGeo.GetFdeGeometry() == null) { XtraMessageBox.Show("请先绘制或选择拆分多边形!"); } else { IMultiPolygon multiPolygon = null; if (this.radioGroup1.SelectedIndex == 1) { IGeometryFactory geometryFactory = new GeometryFactoryClass(); multiPolygon = (geometryFactory.CreateGeometry(gviGeometryType.gviGeometryMultiPolygon, gviVertexAttribute.gviVertexAttributeZ) as IMultiPolygon); multiPolygon.AddPolygon(this._renderGeo.GetFdeGeometry() as IPolygon); } else { if (this.radioGroup1.SelectedIndex == 0) { multiPolygon = (this._renderGeo.GetFdeGeometry() as IMultiPolygon); } } if (multiPolygon == null) { XtraMessageBox.Show("获取裁剪多边形失败!"); } else { waitDialogForm = new WaitDialogForm(string.Empty, "正在拆分模型,请稍后..."); HashMap featureClassInfoMap = SelectCollection.Instance().FeatureClassInfoMap; System.Collections.Hashtable hashtable = new System.Collections.Hashtable(); foreach (DF3DFeatureClass featureClassInfo in featureClassInfoMap.Keys) { if (featureClassInfo.GetFeatureLayer().GeometryType == gviGeometryColumnType.gviGeometryColumnModelPoint) { System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>(); System.Collections.Generic.List <int> list2 = new System.Collections.Generic.List <int>(); IRowBufferCollection rowBufferCollection = new RowBufferCollectionClass(); IRowBufferCollection rowBufferCollection2 = new RowBufferCollectionClass(); ResultSetInfo resultSetInfo = featureClassInfoMap[featureClassInfo] as ResultSetInfo; DataTable resultSetTable = resultSetInfo.ResultSetTable; if (resultSetTable.Rows.Count >= 1) { featureClass = featureClassInfo.GetFeatureClass(); IResourceManager resourceManager = featureClass.FeatureDataSet as IResourceManager; string fidFieldName = featureClass.FidFieldName; int num = featureClass.GetFields().IndexOf(fidFieldName); foreach (DataRow dataRow in resultSetTable.Rows) { int num2 = int.Parse(dataRow[fidFieldName].ToString()); IRowBuffer row = featureClass.GetRow(num2); int position = row.FieldIndex(featureClassInfo.GetFeatureLayer().GeometryFieldName); IModelPoint modelPoint = row.GetValue(position) as IModelPoint; if (modelPoint != null) { Gvitech.CityMaker.Resource.IModel model = resourceManager.GetModel(modelPoint.ModelName); IGeometryConvertor geometryConvertor = new GeometryConvertorClass(); Gvitech.CityMaker.Resource.IModel model2 = null; Gvitech.CityMaker.Resource.IModel model3 = null; IModelPoint modelPoint2 = null; IModelPoint modelPoint3 = null; bool flag = geometryConvertor.SplitModelPointByPolygon2D(multiPolygon, model, modelPoint, out model2, out modelPoint2, out model3, out modelPoint3); if (flag && model2 != null && !model2.IsEmpty && modelPoint2 != null && model3 != null && !model3.IsEmpty && modelPoint3 != null) { System.Guid guid = System.Guid.NewGuid(); string text = guid.ToString(); resourceManager.AddModel(text, model2, null); resourceManager.RebuildSimplifiedModel(text); guid = System.Guid.NewGuid(); string text2 = guid.ToString(); resourceManager.AddModel(text2, model3, null); resourceManager.RebuildSimplifiedModel(text2); modelPoint3.ModelName = text2; row.SetValue(position, modelPoint3); rowBufferCollection.Add(row); list.Add(num2); modelPoint2.ModelName = text; IRowBuffer rowBuffer = row.Clone(false); rowBuffer.SetNull(num); rowBuffer.SetValue(position, modelPoint2); fdeCursor = featureClass.Insert(); fdeCursor.InsertRow(rowBuffer); int lastInsertId = fdeCursor.LastInsertId; rowBuffer.SetValue(num, lastInsertId); rowBufferCollection2.Add(rowBuffer); list2.Add(lastInsertId); System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor); fdeCursor = null; } } } featureClass.UpdateRows(rowBufferCollection, false); app.Current3DMapControl.FeatureManager.EditFeatures(featureClass, rowBufferCollection); app.Current3DMapControl.FeatureManager.CreateFeatures(featureClass, rowBufferCollection2); hashtable[featureClassInfo] = list2; //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); featureClass = null; System.Runtime.InteropServices.Marshal.ReleaseComObject(resourceManager); resourceManager = null; } } } SelectCollection.Instance().UpdateSelection(hashtable); base.Close(); base.DialogResult = System.Windows.Forms.DialogResult.OK; } } } } catch (System.Runtime.InteropServices.COMException ex) { XtraMessageBox.Show(ex.Message); } catch (System.UnauthorizedAccessException var_35_4EC) { XtraMessageBox.Show("拒绝访问"); } catch (System.Exception ex2) { XtraMessageBox.Show(ex2.Message); } finally { if (waitDialogForm != null) { waitDialogForm.Close(); } if (fdeCursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor); fdeCursor = null; } //if (featureClass != null && System.Runtime.InteropServices.Marshal.IsComObject(featureClass)) //{ // System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); // featureClass = null; //} app.Current3DMapControl.ResumeRendering(); } } }
private void AddRecord(IGeometry geo) { try { if (geo.GeometryType != gviGeometryType.gviGeometryModelPoint) { return; } this.beforeRowBufferMap.Clear(); SelectCollection.Instance().Clear(); DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } IFeatureDataSet fds = fc.FeatureDataSet; if (fds == null) { return; } IFeatureLayer fl = featureClassInfo.GetFeatureLayer(); if (fl == null) { return; } IFieldInfoCollection fields = fc.GetFields(); int indexGeo = fields.IndexOf(fl.GeometryFieldName); if (indexGeo == -1) { return; } IFieldInfo fiGeo = fields.Get(indexGeo); if (fiGeo == null || fiGeo.GeometryDef == null) { return; } IModelPoint pt = geo as IModelPoint; string mname = Path.GetFileNameWithoutExtension(pt.ModelName); IEnvelope envelope = ImportOsg(fc, pt.ModelName); if (envelope == null) { return; } IModelPoint geoOut = pt.Clone2(fiGeo.GeometryDef.VertexAttribute) as IModelPoint; if (fiGeo.GeometryDef.HasZ) { geoOut.SetCoords(pt.X, pt.Y, pt.Z, 0, 0); } else { geoOut.SetCoords(pt.X, pt.Y, 0, 0, 0); } geoOut.ModelName = mname; geoOut.ModelEnvelope = new EnvelopeClass { MinX = envelope.MinX, MaxX = envelope.MaxX, MinY = envelope.MinY, MaxY = envelope.MaxY, MinZ = envelope.MinZ, MaxZ = envelope.MaxZ }; IRowBufferCollection rowCol = new RowBufferCollection(); IRowBufferFactory fac = new RowBufferFactory(); IRowBuffer row = fac.CreateRowBuffer(fields); row.SetValue(indexGeo, geoOut); foreach (DataRow dr in this._dt.Rows) { IFieldInfo fi = dr["F"] as IFieldInfo; if (fi == null) { continue; } string fn = fi.Name; int index = fields.IndexOf(fn); if (index != -1) { if (dr["FV"] == null) { row.SetNull(index); } else { string strobj = dr["FV"].ToString(); bool bRes = false; switch (fi.FieldType) { case gviFieldType.gviFieldBlob: case gviFieldType.gviFieldGeometry: case gviFieldType.gviFieldUnknown: break; case gviFieldType.gviFieldFloat: float f; bRes = float.TryParse(strobj, out f); if (bRes) { row.SetValue(index, f); } else { row.SetNull(index); } break; case gviFieldType.gviFieldDouble: double d; bRes = double.TryParse(strobj, out d); if (bRes) { row.SetValue(index, d); } else { row.SetNull(index); } break; case gviFieldType.gviFieldFID: case gviFieldType.gviFieldUUID: case gviFieldType.gviFieldInt16: Int16 i16; bRes = Int16.TryParse(strobj, out i16); if (bRes) { row.SetValue(index, i16); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt32: Int32 i32; bRes = Int32.TryParse(strobj, out i32); if (bRes) { row.SetValue(index, i32); } else { row.SetNull(index); } break; case gviFieldType.gviFieldInt64: Int64 i64; bRes = Int64.TryParse(strobj, out i64); if (bRes) { row.SetValue(index, i64); } else { row.SetNull(index); } break;; case gviFieldType.gviFieldString: row.SetValue(index, strobj); break; case gviFieldType.gviFieldDate: DateTime dt; bRes = DateTime.TryParse(strobj, out dt); if (bRes) { row.SetValue(index, dt); } else { row.SetNull(index); } break; default: break; } } } } rowCol.Add(row); beforeRowBufferMap[featureClassInfo] = rowCol; UpdateDatabase(); Clear(); (this._drawTool as Draw3DModel).Set3DModelFilePath(this.beFilePath.Text); } catch (Exception ex) { } }
public string UpdateRowBuffer(ref IRowBuffer row, string fieldName, System.Collections.Generic.IList <RegexDataStruct> regexDataList) { string result = string.Empty; try { int num = row.FieldIndex(fieldName); if (num != -1) { IFieldInfo fieldInfo = row.Fields.Get(num); if (regexDataList == null) { if (fieldInfo.Nullable) { row.SetNull(num); } } else { switch (fieldInfo.FieldType) { case gviFieldType.gviFieldInt16: case gviFieldType.gviFieldInt32: case gviFieldType.gviFieldInt64: case gviFieldType.gviFieldFloat: case gviFieldType.gviFieldDouble: { double num2 = 0.0; string text = ""; foreach (RegexDataStruct current in regexDataList) { double num3 = 0.0; if (current.CharType == CharactorType.ConstKey) { bool flag = double.TryParse(current.Key, out num3); if (flag) { string a; if ((a = text) != null) { if (!(a == "+")) { if (!(a == "-")) { if (!(a == "*")) { if (a == "/") { if (flag && num3.CompareTo(0.0) != 0) { num2 /= num3; continue; } continue; } } else { if (flag) { num2 *= num3; continue; } continue; } } else { if (flag) { num2 -= num3; continue; } continue; } } else { if (flag) { num2 += num3; continue; } continue; } } num2 = num3; } } else { if (current.CharType == CharactorType.FieldKey) { int num4 = row.FieldIndex(current.Key); if (num4 != -1 && !row.IsNull(num4)) { bool flag = double.TryParse(row.GetValue(num4).ToString(), out num3); if (flag) { string a2; if ((a2 = text) != null) { if (!(a2 == "+")) { if (!(a2 == "-")) { if (!(a2 == "*")) { if (a2 == "/") { if (flag && num3.CompareTo(0.0) != 0) { num2 /= num3; continue; } continue; } } else { if (flag) { num2 *= num3; continue; } continue; } } else { if (flag) { num2 -= num3; continue; } continue; } } else { if (flag) { num2 += num3; continue; } continue; } } num2 = num3; } } } else { if (current.CharType == CharactorType.OptionKey) { text = current.Key; } } } } row.SetValue(num, num2); result = num2.ToString(); break; } case gviFieldType.gviFieldString: { RegexDataStruct regexDataStruct = regexDataList[0]; if (regexDataStruct.CharType == CharactorType.ConstKey) { result = regexDataStruct.Key; if (!string.IsNullOrEmpty(regexDataStruct.Key)) { row.SetValue(num, regexDataStruct.Key); } else { row.SetNull(num); } } else { if (regexDataStruct.CharType == CharactorType.FieldKey) { int num5 = row.FieldIndex(regexDataStruct.Key); if (num5 != -1) { if (row.IsNull(num5)) { row.SetNull(num); } else { object value = row.GetValue(num5); row.SetValue(num, value); result = value.ToString(); } } } } break; } case gviFieldType.gviFieldDate: { RegexDataStruct regexDataStruct2 = regexDataList[0]; if (regexDataStruct2.CharType == CharactorType.ConstKey) { if (string.IsNullOrEmpty(regexDataStruct2.Key)) { row.SetNull(num); } else { System.DateTime dateTime; bool flag2 = System.DateTime.TryParse(regexDataStruct2.Key, out dateTime); if (flag2) { row.SetValue(num, dateTime); result = dateTime.ToString(); } } } else { if (regexDataStruct2.CharType == CharactorType.FieldKey) { int num6 = row.FieldIndex(regexDataStruct2.Key); if (num6 != -1) { if (row.IsNull(num6)) { row.SetNull(num); } else { object value2 = row.GetValue(num6); row.SetValue(num, value2); result = value2.ToString(); } } } } break; } } } } } catch (System.Exception e) { LoggingService.Error(e.Message); } return(result); }