Example #1
0
        void ReleaseDesignerOutlets()
        {
            if (LocationTableView != null)
            {
                LocationTableView.Dispose();
                LocationTableView = null;
            }

            if (DateColumn != null)
            {
                DateColumn.Dispose();
                DateColumn = null;
            }

            if (LocationColumn != null)
            {
                LocationColumn.Dispose();
                LocationColumn = null;
            }

            if (mainMapView != null)
            {
                mainMapView.Dispose();
                mainMapView = null;
            }
        }
Example #2
0
        public void OnDeserializedMethod_Sets_HumanAddress_To_Null_For_Empty_HumanAddressJsonString_Member(string input)
        {
            var locationColumn = new LocationColumn()
            {
                HumanAddressJsonString = input
            };

            Assert.IsNull(locationColumn.HumanAddress);

            locationColumn.OnDeserializedMethod(new StreamingContext());

            Assert.IsNull(locationColumn.HumanAddress);
        }
Example #3
0
        /// <summary>
        /// Raises the <see cref="ColumnChanged" /> event.
        /// </summary>
        /// <param name="column">The <see cref="LocationColumn"/> which has raised the event.</param>
        /// <param name="value">The changed value.</param>
        public virtual void OnColumnChanged(LocationColumn column, object value)
        {
            if (!SuppressEntityEvents)
            {
                LocationEventHandler handler = ColumnChanged;
                if (handler != null)
                {
                    handler(this, new LocationEventArgs(column, value));
                }

                // warn the parent list that i have changed
                OnEntityChanged();
            }
        }
Example #4
0
        /// <summary>
        /// Raises the <see cref="ColumnChanging" /> event.
        /// </summary>
        /// <param name="column">The <see cref="LocationColumn"/> which has raised the event.</param>
        /// <param name="value">The changed value.</param>
        public virtual void OnColumnChanging(LocationColumn column, object value)
        {
            if (IsEntityTracked && EntityState != EntityState.Added && !EntityManager.TrackChangedEntities)
            {
                EntityManager.StopTracking(entityTrackingKey);
            }

            if (!SuppressEntityEvents)
            {
                LocationEventHandler handler = ColumnChanging;
                if (handler != null)
                {
                    handler(this, new LocationEventArgs(column, value));
                }
            }
        }
        private static string generateEntityLine <T>(T entity, IEnumerable <PropertyInfo> propertiesToExport, string delimiter)
        {
            StringBuilder lineBuilder = new StringBuilder();

            foreach (var property in propertiesToExport)
            {
                //get the raw value as an object
                object propertyValue = property.GetValue(entity);
                //what will eventually be appended to the line for this property
                string toAppend;

                //the whitelist contains types that can be written directly as strings
                if (!jsonSerializeWhiteList.Contains(property.PropertyType))
                {
                    //this property is not a "simple" type - special consideration should be taken for serialization

                    //locations should be exported in Socrata's desired upload format for *SV: (lat, long)
                    if (property.PropertyType == typeof(LocationColumn))
                    {
                        LocationColumn value = property.GetValue(entity) as LocationColumn;
                        if (String.IsNullOrEmpty(value.Latitude) || String.IsNullOrEmpty(value.Longitude))
                        {
                            toAppend = String.Empty;
                        }
                        else
                        {
                            toAppend = String.Format("({0},{1})", value.Latitude, value.Longitude);
                        }
                    }
                    else
                    {
                        toAppend = propertyValue.ToJsonString();
                    }
                }
                else
                {
                    //this property is a "simple" type, get its normalized string representation
                    toAppend = propertyValue.SafeToString().NormalizeQuotes().EscapeDoubleQuotes();
                }

                //append this property's value to the line and wrap in quotes for safety
                lineBuilder.AppendFormat(@"""{0}""{1}", toAppend, delimiter);
            }

            return(lineBuilder.ToString().TrimEnd(delimiter.ToCharArray()));
        }
Example #6
0
        public void OnDeserializedMethod_Sets_HumanAddress_Member_From_HumanAddressJsonString_Member()
        {
            var locationColumn = new LocationColumn()
            {
                HumanAddressJsonString = json
            };

            Assert.IsNull(locationColumn.HumanAddress);

            locationColumn.OnDeserializedMethod(new StreamingContext());

            Assert.IsNotNull(locationColumn.HumanAddress);
            Assert.AreEqual(address, locationColumn.HumanAddress.Address);
            Assert.AreEqual(city, locationColumn.HumanAddress.City);
            Assert.AreEqual(state, locationColumn.HumanAddress.State);
            Assert.AreEqual(zip, locationColumn.HumanAddress.Zip);
        }
Example #7
0
        public void OnSerializingMethod_Sets_HumanAddressJsonString_Member_From_HumanAddress_Member()
        {
            var locationColumn = new LocationColumn()
            {
                HumanAddress = new HumanAddress()
                {
                    Address = address,
                    City    = city,
                    State   = state,
                    Zip     = zip
                }
            };

            Assert.IsNull(locationColumn.HumanAddressJsonString);

            locationColumn.OnSerializingMethod(new StreamingContext());

            Assert.AreEqual(json, locationColumn.HumanAddressJsonString);
        }
Example #8
0
        /// <summary>
        /// Determines whether the property value has changed from the original data.
        /// </summary>
        /// <param name="column">The column.</param>
        /// <returns>
        ///     <c>true</c> if the property value has changed; otherwise, <c>false</c>.
        /// </returns>
        public bool IsPropertyChanged(LocationColumn column)
        {
            switch (column)
            {
            case LocationColumn.StkId:
                return(entityData.StkId != _originalData.StkId);

            case LocationColumn.LocId:
                return(entityData.LocId != _originalData.LocId);

            case LocationColumn.Description:
                return(entityData.Description != _originalData.Description);

            case LocationColumn.Status:
                return(entityData.Status != _originalData.Status);

            default:
                return(false);
            }
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:LocationComparer"/> class.
 /// </summary>
 /// <param name="column">The column to sort on.</param>
 public LocationComparer(LocationColumn column)
 {
     this.whichComparison = column;
 }
Example #10
0
 ///<summary>
 /// Initalizes a new Instance of the LocationEventArgs class.
 ///</summary>
 public LocationEventArgs(LocationColumn column, object value)
 {
     this.column = column;
     this.value  = value;
 }
Example #11
0
 ///<summary>
 /// Initalizes a new Instance of the LocationEventArgs class.
 ///</summary>
 public LocationEventArgs(LocationColumn column)
 {
     this.column = column;
 }
Example #12
0
 /// <summary>
 /// Raises the <see cref="ColumnChanged" /> event.
 /// </summary>
 /// <param name="column">The <see cref="LocationColumn"/> which has raised the event.</param>
 public virtual void OnColumnChanged(LocationColumn column)
 {
     OnColumnChanged(column, null);
     return;
 }