public override Gvitech.CityMaker.Common.IBinaryBuffer ObjectToJson() { IBinaryBuffer buffer = null; try { buffer = new BinaryBufferClass(); Dictionary <string, string> item = new Dictionary <string, string>(); item.Add("RenderType", this._renderType.ToString()); item.Add("TextureRoof", this._textureRoof); item.Add("TextureFacade", this._textureFacade); string stringValue = JsonTool.ObjectToJson(item); buffer.FromString(stringValue); return(buffer); } catch (Exception exception) { return(null); } }
public override Gvitech.CityMaker.Common.IBinaryBuffer ObjectToJson() { IBinaryBuffer buffer = null; try { buffer = new BinaryBufferClass(); Dictionary <string, string> item = new Dictionary <string, string>(); item.Add("RenderType", this._renderType.ToString()); item.Add("TextureInside", this._textureInside); item.Add("TextureOutside", this._textureOutside); item.Add("PipeThick", this._pipeThick.ToString()); item.Add("HeightMode", this._heightMode.ToString()); item.Add("HeightParam", this._heightParam.ToString()); string stringValue = JsonTool.ObjectToJson(item); buffer.FromString(stringValue); return(buffer); } catch (Exception exception) { return(null); } }
public override Gvitech.CityMaker.Common.IBinaryBuffer ObjectToJson() { IBinaryBuffer buffer = null; try { buffer = new BinaryBufferClass(); Dictionary <string, string> item = new Dictionary <string, string>(); item.Add("ModelId", this._modelId); item.Add("IsFollowDir", this._isFollowDir.ToString()); item.Add("IsFollowSurfH", this._isFollowSurfH.ToString()); item.Add("IsFollowDia", this._isFollowDia.ToString()); item.Add("IsStretchZ", this._isStretchZ.ToString()); item.Add("IsBlendPipe", this._isBlendPipe.ToString()); item.Add("IsRotateZ", this._isRotateZ.ToString()); string stringValue = JsonTool.ObjectToJson(item); buffer.FromString(stringValue); return(buffer); } catch (Exception exception) { return(null); } }
private bool UpdateFacStyleClass(FacStyleClass style) { IFdeCursor cursor = null; IRowBuffer row = null; try { IFeatureDataSet fds = this._ds.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(false); } IObjectClass oc = fds.OpenObjectClass("OC_FacilityStyle"); if (oc == null) { return(false); } IQueryFilter filter = new QueryFilter() { WhereClause = string.Format("ObjectId = '{0}'", style.ObjectId) }; cursor = oc.Update(filter); row = cursor.NextRow(); if (row != null) { row.SetValue(row.FieldIndex("Name"), style.Name); row.SetValue(row.FieldIndex("FacClassCode"), style.FacClassCode); row.SetValue(row.FieldIndex("ObjectId"), style.ObjectId); row.SetValue(row.FieldIndex("StyleType"), style.Type.ToString()); row.SetValue(row.FieldIndex("StyleInfo"), style.ObjectToJson()); if (style.Thumbnail != null) { try { IBinaryBuffer bb = new BinaryBufferClass(); MemoryStream stream = new MemoryStream(); style.Thumbnail.Save(stream, ImageFormat.Png); bb.FromByteArray(stream.ToArray()); row.SetValue(row.FieldIndex("Thumbnail"), bb); } catch (Exception exception) { } } cursor.UpdateRow(row); return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }
private bool InsertColor() { IFdeCursor cursor = null; IRowBuffer row = null; try { IFeatureDataSet fds = this._ds.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(false); } IObjectClass oc = fds.OpenObjectClass("OC_ColorInfo"); if (oc == null) { return(false); } row = oc.CreateRowBuffer(); cursor = oc.Insert(); row.SetValue(row.FieldIndex("Name"), this._color.Name); row.SetValue(row.FieldIndex("ObjectId"), this._color.ObjectId); row.SetValue(row.FieldIndex("GroupId"), this._color.Group); row.SetValue(row.FieldIndex("Code"), this._color.Code); row.SetValue(row.FieldIndex("Type"), this._color.Type); if (this._color.Thumbnail != null) { try { IBinaryBuffer bb = new BinaryBufferClass(); MemoryStream stream = new MemoryStream(); this._color.Thumbnail.Save(stream, ImageFormat.Png); bb.FromByteArray(stream.ToArray()); row.SetValue(row.FieldIndex("Thumbnail"), bb); } catch (Exception exception) { } } row.SetValue(row.FieldIndex("Comment"), this._color.Comment); cursor.InsertRow(row); this._color.Id = cursor.LastInsertId; return(true); } catch (Exception ex) { return(false); } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }
private bool UpdateColor() { IFdeCursor cursor = null; IRowBuffer row = null; try { IFeatureDataSet fds = this._ds.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(false); } IObjectClass oc = fds.OpenObjectClass("OC_ColorInfo"); if (oc == null) { return(false); } IQueryFilter filter = new QueryFilter() { WhereClause = string.Format("ObjectId = '{0}'", this._color.ObjectId) }; cursor = oc.Update(filter); row = cursor.NextRow(); if (row != null) { row.SetValue(row.FieldIndex("Name"), this._color.Name); row.SetValue(row.FieldIndex("GroupId"), this._color.Group); row.SetValue(row.FieldIndex("Code"), this._color.Code); row.SetValue(row.FieldIndex("Type"), this._color.Type); row.SetValue(row.FieldIndex("Comment"), this._color.Comment); if (this._color.Thumbnail != null) { try { IBinaryBuffer newVal = new BinaryBufferClass(); MemoryStream stream = new MemoryStream(); this._color.Thumbnail.Save(stream, ImageFormat.Png); newVal.FromByteArray(stream.ToArray()); row.SetValue(2, newVal); } catch (Exception ex) { } } cursor.UpdateRow(row); return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }