private void GetMaintenanceFeature()
 {
     string maintLayerName = string.Empty;
     foreach (MgLayerBase layer in this._helper.Map.GetLayers())
     {
         if (layer.GetName().StartsWith("Maint_"))
         {
             maintLayerName = layer.GetName();
             break;
         }
     }
     if (string.IsNullOrEmpty(maintLayerName))
     {
         this.ChangeMode(false);
     }
     else
     {
         this._feature = Feature.GetSingleFeature(this._helper, string.Format("UID={0} AND FeatureSource='{1}'", this._uid, this._parentLayer.GetFeatureSourceId()), maintLayerName);
         if ((this._feature == null) || (this._feature.UID == 0))
         {
             this.ChangeMode(false);
         }
         else
         {
             this.ChangeMode(true);
             this._feature.Properties["OperationType"].AviableValues = new List<string>();
             this._feature.Properties["OperationType"].AviableValues.Add("לא מוגדר");
             this._feature.Properties["OperationType"].AviableValues.Add("שבר");
             this._feature.Properties["OperationType"].AviableValues.Add("מונעת");
             this._feature.Properties["OperationType"].AviableValues.Add("מתוכננת");
             this._feature.Properties["Status"].AviableValues = new List<string>();
             this._feature.Properties["Status"].AviableValues.Add("פתוח");
             this._feature.Properties["Status"].AviableValues.Add("סגור");
             this._feature.Properties["Status"].AviableValues.Add("בטיפול");
             this._feature.Properties["Status"].AviableValues.Add("מושהה");
             this._feature.Properties["InfrastructureType"].IsReadOnly = true;
             this._feature.InsertToLog = true;
             FeatureLog log = new FeatureLog(this._helper, this._feature);
             this.featureLogControl.LogSource = log;
             this.MaintenanceEditorControl.Filter = string.Format("FeatId={0}", this._feature.FeatId);
             this.MaintenanceEditorControl.Activate(this._helper, this._feature);
             this.MaintenanceEditorControl.Visible = true;
             this.MaintenanceEditorControl.FeatureCard_Init();
         }
     }
 }
Beispiel #2
0
        public object Clone()
        {
            Feature feature = new Feature
            {
            Layer = this.Layer,
            _helper = this._helper,
            _dataSet = this._dataSet,
            _identityFieldName = this._identityFieldName,
            Properties = new Dictionary<string, FeatureProperty>()
            };

            foreach (KeyValuePair<string, FeatureProperty> p in this.Properties)
            {
            feature.Properties.Add(p.Key, (FeatureProperty) p.Value.Clone());
            }
            return feature;
        }
Beispiel #3
0
 public static Feature GetSingleFeature(HtzMgHelper helper, string filter, string layerName, string uidKey)
 {
     Feature result = null;
     if (helper.Map.GetLayers().Contains(layerName))
     {
         MgLayer layer = (MgLayer)helper.Map.GetLayers().GetItem(layerName);
         if (string.IsNullOrEmpty(filter))
         {
             return result;
         }
         MgFeatureQueryOptions opt = new MgFeatureQueryOptions();
         opt.SetFilter(filter);
         MgFeatureReader reader = helper.FeatureService.SelectFeatures(new MgResourceIdentifier(layer.FeatureSourceId), layer.FeatureClassName, opt);
         if (reader.ReadNext())
         {
             result = new Feature(helper, layerName, "", uidKey);
             result.FillValues(reader);
             result.FillLookUpValues();
         }
     }
     return result;
 }
Beispiel #4
0
 public static List<Feature> GetFeatures(HtzMgHelper helper, string filter, string layerName)
 {
     List<Feature> result = new List<Feature>();
     MgLayer layer = helper.Map.GetLayers().GetItem(layerName) as MgLayer;
     Feature prototype = new Feature(helper, layerName, "");
     MgFeatureQueryOptions opt = new MgFeatureQueryOptions();
     if (!string.IsNullOrEmpty(filter))
     {
         opt.SetFilter(filter);
     }
     MgFeatureReader reader = helper.FeatureService.SelectFeatures(new MgResourceIdentifier(layer.FeatureSourceId), layer.FeatureClassName, opt);
     while (reader.ReadNext())
     {
         Feature f = prototype.Clone() as Feature;
         f.FillValues(reader);
         result.Add(f);
     }
     return result;
 }
Beispiel #5
0
 public static List<Feature> GetFeatures(HtzMgHelper helper, MgSelection selection, string layerName)
 {
     MgFeatureReader reader;
     List<Feature> result = new List<Feature>();
     MgLayer layer = (MgLayer)helper.Map.GetLayers().GetItem(layerName);
     if ((selection != null) && (selection.GetLayers() != null))
     {
         string filter = selection.GenerateFilter(layer, layer.FeatureClassName);
         MgFeatureQueryOptions opt = new MgFeatureQueryOptions();
         opt.SetFilter(filter);
         reader = helper.FeatureService.SelectFeatures(new MgResourceIdentifier(layer.FeatureSourceId), layer.FeatureClassName, opt);
     }
     else
     {
         reader = helper.FeatureService.SelectFeatures(new MgResourceIdentifier(layer.FeatureSourceId), layer.FeatureClassName, null);
     }
     if (reader.ReadNext())
     {
         Feature prototype = new Feature(helper, layerName, "");
         Feature f1 = prototype.Clone() as Feature;
         f1.FillValues(reader);
         result.Add(f1);
         while (reader.ReadNext())
         {
             Feature f = prototype.Clone() as Feature;
             f.FillValues(reader);
             result.Add(f);
         }
     }
     return result;
 }
 public void Activate(HtzMgHelper helper, Feature feature)
 {
     this._helper = helper;
     this._feature = feature;
     this._activated = true;
 }