Ejemplo n.º 1
0
        private bool UpdateFacClassReg(FacClassReg reg)
        {
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                IFeatureDataSet fds = this._dsPipe.OpenFeatureDataset("DataSet_BIZ");
                if (fds == null)
                {
                    return(false);
                }
                IObjectClass oc = fds.OpenObjectClass("OC_FacilityClass");
                if (oc == null)
                {
                    return(false);
                }

                IQueryFilter filter = new QueryFilter()
                {
                    WhereClause = string.Format("FacClassCode = '{0}'", reg.FacClassCode),
                    SubFields   = "oid,LocationType,TurnerStyle,FacilityType,Comment"
                };
                cursor = oc.Update(filter);
                row    = cursor.NextRow();
                if (row != null)
                {
                    row.SetValue(1, reg.LocationType.ToString());
                    row.SetValue(2, reg.TurnerStyle.ToString());
                    row.SetValue(3, reg.FacilityType.Name);
                    row.SetValue(4, reg.Comment);
                    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;
                }
            }
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }
Ejemplo n.º 3
0
        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;
                }
            }
        }