Ejemplo n.º 1
0
        private void LoadRows()
        {
            if (this.Query != null)
            {
                this.Grid.NoRows = this.Query.Store.Count();

                for (int i = 0; i < this.Grid.NoRows; i++)
                {
                    Model.Item item = this.Query.Store[i];
                    int        j    = 0;

                    foreach (Model.PropertyType proptype in this.Query.Store.ItemType.SearchPropertyTypes)
                    {
                        Model.Property property = item.Property(proptype);
                        this.Grid.Rows[i].Cells[j].Binding = property;
                        j++;
                    }
                }
            }
            else
            {
                // Clear all Rows
                this.Grid.NoRows = 0;
            }
        }
Ejemplo n.º 2
0
 private void Deserialise(XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if (_Resource == null)
             {
                 if (string.Compare(ObjectDefinition.SerialisationName, reader.Name, true) == 0)
                 {
                     _Resource = new Model.Object();
                     _Resource.ObjectDefinitionID = ObjectDefinition.ObjectDefinitionID;
                     _Resource.ObjectID           = ObjectDefinition.ObjectID;
                 }
             }
             else
             {
                 if (reader.Name.Equals("Links"))
                 {
                     Links = new List <Link>();
                     Links.Deserialise(reader);
                 }
                 else
                 {
                     Model.PropertyDefinition propertyDefinition = ObjectDefinition.GetPropertyBySerialisationName(reader.Name);
                     if (propertyDefinition == null)
                     {
                         if (string.Compare(reader.Name, "InstanceID", true) == 0)
                         {
                             reader.Read();
                             _Resource.InstanceID = reader.Value;
                         }
                     }
                     else
                     {
                         Model.Property property = new Model.Property();
                         property.PropertyDefinitionID = propertyDefinition.PropertyDefinitionID;
                         property.PropertyID           = propertyDefinition.PropertyID;
                         if (propertyDefinition.IsCollection)
                         {
                             XmlReader collectionReader = reader.ReadSubtree();
                             DeserialiseItems(propertyDefinition, property, collectionReader);
                         }
                         else
                         {
                             property.Value       = new Model.PropertyValue();
                             property.Value.Value = GetValue(propertyDefinition.DataType, reader.ReadInnerXml());
                         }
                         _Resource.Properties.Add(property);
                     }
                 }
             }
         }
         else if (reader.NodeType == XmlNodeType.EndElement && string.Compare(ObjectDefinition.SerialisationName, reader.Name, true) == 0)
         {
             break;
         }
     }
 }
Ejemplo n.º 3
0
        protected void LoadRows()
        {
            // Clear current Grid Selection
            this.Grid.SelectedRows.Clear();

            if (this.Binding != null)
            {
                this.SetColumnEditing();

                Model.Item        item         = (Model.Item) this.Binding;
                List <Model.Item> currentitems = item.Relationships(this.RelationshipType).CurrentItems();

                // Set Number of Rows in Grid
                this.Grid.NoRows = currentitems.Count();

                // Load Current Items into Grid
                for (int i = 0; i < this.Grid.NoRows; i++)
                {
                    Model.Relationship relationship = (Model.Relationship)currentitems[i];

                    int j = 0;

                    foreach (Model.PropertyType proptype in this.PropertyTypes)
                    {
                        Model.Property property = null;

                        if (relationship.ItemType.Equals(proptype.Type))
                        {
                            property = relationship.Property(proptype);
                        }
                        else
                        {
                            if (relationship.Related != null)
                            {
                                property = relationship.Related.Property(proptype);
                            }
                        }

                        if (property != null)
                        {
                            this.Grid.Rows[i].Cells[j].Binding = property;
                        }
                        else
                        {
                            this.Grid.Rows[i].Cells[j].SetValue(null);
                        }

                        j++;
                    }
                }
            }
            else
            {
                // Clear all Rows
                this.Grid.NoRows = 0;
            }

            this.UpdateCommandsCanExecute();
        }
Ejemplo n.º 4
0
        private static void PropertyInfo(string textRow)
        {
            var mstring = string.Join("\t", SpecialStructs.Globals.rowArray);

            Model.Property property = new Model.Property();
            //Set Property Columns default values (sometimes these fields don't have a value)
            property.LotDesc   = " ";
            property.OtherInfo = " ";
            property.SQDesc    = " ";
            property.TSYear    = 0;

            //Set the Subdivision ID for the Property Subdivision ID
            property.SubdivisionID = SpecialStructs.Globals.globalSubdivisionID;

            //  string TSyear = property.TSYear.ToString();

            property.LotDesc = DataExtraction.GetLotInfo(mstring);

            if (SpecialStructs.Globals.rowArray.Count > 2)
            {
                if (SpecialStructs.Globals.EventAbb == "BASE")
                {
                    //Expecting TSYear but got BASE so move to Other Info
                    property.OtherInfo = SpecialStructs.Globals.rowArray[2];
                }
                else
                {
                    property.TSYear = DataExtraction.ExtractTaxSaleYear(mstring);
                }
            }

            property.OtherInfo = DataExtraction.GetPlotInfo(mstring, property.TSYear, property.LotDesc);

            property.SQDesc = DataExtraction.GetSquareData(mstring);


            //  propertyDetail.Add("Shawn");
            //Insert Property
            //int propertyID = InsertProperty(subdivisionID, TSyear, property.LotDesc, property.OtherInfo, property.SQDesc ); = InsertProperty(subdivisionID, TSyear, property.LotDesc, property.OtherInfo, property.SQDesc );
            int propertyID = DataInsertion.InsertProperty(property);

            //Set the PropertyID to a global variable so it can be accessed by the PropertyDetails
            SpecialStructs.Globals.globalPropertyID = propertyID;
        }
Ejemplo n.º 5
0
 private void DeserialiseItems(Model.PropertyDefinition propertyDefinition, Model.Property property, XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if (string.Compare(propertyDefinition.CollectionItemSerialisationName, reader.Name, true) == 0)
             {
                 Model.PropertyValue propertyValue = new Model.PropertyValue();
                 propertyValue.Value = reader.ReadInnerXml();
                 if (property.Values == null)
                 {
                     property.Values = new List <Model.PropertyValue>();
                 }
                 property.Values.Add(propertyValue);
             }
         }
     }
 }
Ejemplo n.º 6
0
 public void Serialise(XmlWriter writer)
 {
     writer.WriteStartElement(ObjectDefinition.SerialisationName);
     if (Links != null)
     {
         Links.Serialise(writer);
     }
     if (!string.IsNullOrEmpty(_Resource.InstanceID))
     {
         Model.XmlHelper.WriteElement(writer, "InstanceID", _Resource.InstanceID);
     }
     foreach (Model.PropertyDefinition propertyDefinition in ObjectDefinition.Properties)
     {
         Model.Property property = _Resource.GetProperty(propertyDefinition.PropertyID);
         if (property != null)
         {
             if (propertyDefinition.IsCollection)
             {
                 if ((property.Values != null) && (property.Values.Count > 0))
                 {
                     string itemName = propertyDefinition.CollectionItemSerialisationName;
                     if (string.IsNullOrEmpty(itemName))
                     {
                         itemName = StringUtils.ToSingular(propertyDefinition.SerialisationName);
                     }
                     writer.WriteStartElement(propertyDefinition.SerialisationName);
                     foreach (Model.PropertyValue item in property.Values)
                     {
                         Model.XmlHelper.WriteElement(writer, itemName, item.Value);
                     }
                     writer.WriteEndElement();
                 }
             }
             else
             {
                 Model.XmlHelper.WriteElement(writer, propertyDefinition.SerialisationName, property.Value.Value);
             }
         }
     }
     writer.WriteEndElement();
 }
            public static int InsertProperty(Model.Property property)
            {
                int id = 0;

                #region insert

                var cn = OpenOrGetConnection();
                {
                    using (OleDbCommand cmd = new OleDbCommand("SELECT tblProperty.propertyID FROM tblProperty WHERE tblProperty.subdivisionID = (?) AND tblProperty.lotDesc = (?) AND tblProperty.tsYear = (?) AND tblProperty.otherInfo = (?) AND tblProperty.sqDesc = (?)", cn))
                    {
                        cmd.Parameters.AddWithValue("", property.SubdivisionID);
                        cmd.Parameters.AddWithValue("", property.LotDesc);
                        cmd.Parameters.AddWithValue("", property.TSYear != 0 ? (object)property.TSYear: DBNull.Value);
                        cmd.Parameters.AddWithValue("", property.OtherInfo);
                        cmd.Parameters.AddWithValue("", property.SQDesc);
                        id = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    if (id != 0)
                    {
                        return(id);
                    }
                    using (OleDbCommand cmd = new OleDbCommand(
                               "INSERT INTO tblProperty (subdivisionID, lotDesc, tsYear, otherInfo, sqDesc) VALUES (?,?,?,?,?)",
                               cn))
                    {
                        cmd.Parameters.AddWithValue("", property.SubdivisionID);
                        cmd.Parameters.AddWithValue("", property.LotDesc);
                        cmd.Parameters.AddWithValue("", property.TSYear != 0 ? (object)property.TSYear: DBNull.Value);
                        cmd.Parameters.AddWithValue("", property.OtherInfo);
                        cmd.Parameters.AddWithValue("", property.SQDesc);
                        cmd.ExecuteNonQuery();

                        cmd.CommandText = "SELECT @@IDENTITY";
                        id = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                }

                #endregion

                return(id);
            }
Ejemplo n.º 8
0
        public void JsonSchema_Multiple_Properties_Same_Numeric_Type_Multiplicity_1()
        {
            var model = new CogsModel();

            var type = new Model.ItemType();

            type.Name        = "Reusable1";
            type.Description = "Description One";

            var property1 = new Model.Property();

            property1.Name        = "Property1";
            property1.Description = "Description One";
            property1.DataType    = new Model.DataType {
                Name = "int"
            };
            property1.MinCardinality = "0";
            property1.MaxCardinality = "1";
            type.Properties.Add(property1);

            var property2 = new Model.Property();

            property2.Name        = "Property2";
            property2.Description = "Description Two";
            property2.DataType    = new Model.DataType {
                Name = "int"
            };
            property2.MinCardinality = "0";
            property2.MaxCardinality = "1";
            type.Properties.Add(property2);


            model.ItemTypes.Add(type);

            var jsonPublisher = new JsonPublisher();

            jsonPublisher.TargetDirectory = Environment.CurrentDirectory;
            jsonPublisher.Publish(model);

            Assert.True(true);
        }
Ejemplo n.º 9
0
 public void Serialise(JsonWriter writer)
 {
     writer.WriteObject();
     if (Links != null)
     {
         Links.Serialise(writer);
     }
     if (!string.IsNullOrEmpty(_Resource.InstanceID))
     {
         writer.WriteMember("InstanceID");
         writer.WriteValue(_Resource.InstanceID);
     }
     foreach (Model.PropertyDefinition propertyMetadata in ObjectDefinition.Properties)
     {
         Model.Property property = _Resource.GetProperty(propertyMetadata.PropertyID);
         if (property != null)
         {
             if (propertyMetadata.IsCollection)
             {
                 if ((property.Values != null) && (property.Values.Count > 0))
                 {
                     writer.WriteMember(propertyMetadata.SerialisationName);
                     writer.WriteArray();
                     foreach (Model.PropertyValue item in property.Values)
                     {
                         Serialise(writer, propertyMetadata.DataType, item);
                     }
                     writer.WriteEndArray();
                 }
             }
             else
             {
                 writer.WriteMember(propertyMetadata.SerialisationName);
                 Serialise(writer, propertyMetadata.DataType, property.Value);
             }
         }
     }
     writer.WriteEndObject();
 }
Ejemplo n.º 10
0
 public abstract MatchResult IsMatch(Model.Property agencyProperty, List <Model.Property> databaseProperty);
Ejemplo n.º 11
0
        private void Deserialise(JsonReader reader)
        {
            Model.PropertyDefinition propertyDefinition = null;
            Model.Property           property           = null;
            bool isID = false;

            while (reader.Read())
            {
                switch (reader.State)
                {
                case TJsonReaderState.NotSet:
                    break;

                case TJsonReaderState.Array:
                    break;

                case TJsonReaderState.BOF:
                    break;

                case TJsonReaderState.Boolean:
                    if (propertyDefinition != null)
                    {
                        Model.PropertyValue propertyValue = new Model.PropertyValue(reader.AsBoolean.ToString());
                        if (propertyDefinition.IsCollection)
                        {
                            if (property.Values == null)
                            {
                                property.Values = new List <Model.PropertyValue>();
                            }
                            property.Values.Add(propertyValue);
                        }
                        else
                        {
                            property.Value = new Model.PropertyValue(propertyValue.Value);
                        }
                    }
                    break;

                case TJsonReaderState.EndArray:
                    propertyDefinition = null;
                    break;

                case TJsonReaderState.EndObject:
                    break;

                case TJsonReaderState.EOF:
                    break;

                case TJsonReaderState.Member:
                    if (reader.Text.Equals("Links"))
                    {
                        Links = new List <Link>();
                        Links.Deserialise(reader);
                    }
                    else
                    {
                        propertyDefinition = ObjectDefinition.GetPropertyBySerialisationName(reader.Text);
                        if (propertyDefinition == null)
                        {
                            isID = string.Compare(reader.Text, "InstanceID", true) == 0;
                        }
                        else
                        {
                            isID     = false;
                            property = new Model.Property();
                            property.PropertyDefinitionID = propertyDefinition.PropertyDefinitionID;
                            property.PropertyID           = propertyDefinition.PropertyID;
                            if (_Resource != null)
                            {
                                _Resource.Properties.Add(property);
                            }
                        }
                    }
                    break;

                case TJsonReaderState.Null:
                    break;

                case TJsonReaderState.Number:
                    if (propertyDefinition != null)
                    {
                        Model.PropertyValue propertyValue = new Model.PropertyValue(reader.Text);
                        if (propertyDefinition.IsCollection)
                        {
                            if (property.Values == null)
                            {
                                property.Values = new List <Model.PropertyValue>();
                            }
                            property.Values.Add(propertyValue);
                        }
                        else
                        {
                            property.Value = new Model.PropertyValue(propertyValue.Value);
                        }
                    }
                    break;

                case TJsonReaderState.Object:
                    if (_Resource == null)
                    {
                        _Resource = new Model.Object();
                        _Resource.ObjectDefinitionID = ObjectDefinition.ObjectDefinitionID;
                        _Resource.ObjectID           = ObjectDefinition.ObjectID;
                    }
                    break;

                case TJsonReaderState.String:
                    if (propertyDefinition == null)
                    {
                        if (isID)
                        {
                            _Resource.InstanceID = reader.Text;
                        }
                    }
                    else
                    {
                        string text;
                        if (propertyDefinition.DataType == Model.TPropertyDataType.DateTime)
                        {
                            text = GetDateTimeString(reader.Text);
                        }
                        else
                        {
                            text = reader.Text;
                        }
                        Model.PropertyValue propertyValue = new Model.PropertyValue(text);
                        if (propertyDefinition.IsCollection)
                        {
                            if (property.Values == null)
                            {
                                property.Values = new List <Model.PropertyValue>();
                            }
                            property.Values.Add(propertyValue);
                        }
                        else
                        {
                            property.Value = new Model.PropertyValue(propertyValue.Value);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 12
0
        public bool Execute(Client client, Guid objectDefinitionID, string instanceID, Model.Property property)
        {
            bool result = false;

            Service.ILWM2MServerService service = GetService(client.Server);
            lock (service)
            {
                result = service.ExecuteResource(client.ClientID, objectDefinitionID, instanceID, property.PropertyDefinitionID);
            }
            return(result);
        }
Ejemplo n.º 13
0
 public ViewModel.Property CreateProperty(Model.Property Property, System.Boolean SubstitueStringForText)
 {
     ViewModel.Property viewmodelproperty = this.CreateProperty(Property.Type, SubstitueStringForText);
     viewmodelproperty.Binding = Property;
     return(viewmodelproperty);
 }
Ejemplo n.º 14
0
 private void Deserialise(XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if (_Resource == null)
             {
                 if (string.Compare(ObjectDefinition.SerialisationName, reader.Name, true) == 0)
                 {
                     _Resource = new Model.Object();
                     _Resource.ObjectDefinitionID = ObjectDefinition.ObjectDefinitionID;
                     _Resource.ObjectID = ObjectDefinition.ObjectID;
                 }
             }
             else
             {
                 if (reader.Name.Equals("Links"))
                 {
                     Links = new List<Link>();
                     Links.Deserialise(reader);
                 }
                 else
                 {
                     Model.PropertyDefinition propertyDefinition = ObjectDefinition.GetPropertyBySerialisationName(reader.Name);
                     if (propertyDefinition == null)
                     {
                         if (string.Compare(reader.Name, "InstanceID", true) == 0)
                         {
                             reader.Read();
                             _Resource.InstanceID = reader.Value;
                         }
                     }
                     else
                     {
                         Model.Property property = new Model.Property();
                         property.PropertyDefinitionID = propertyDefinition.PropertyDefinitionID;
                         property.PropertyID = propertyDefinition.PropertyID;
                         if (propertyDefinition.IsCollection)
                         {
                             XmlReader collectionReader = reader.ReadSubtree();
                             DeserialiseItems(propertyDefinition, property, collectionReader);
                         }
                         else
                         {
                             property.Value = new Model.PropertyValue();
                             property.Value.Value = GetValue(propertyDefinition.DataType, reader.ReadInnerXml());
                         }
                         _Resource.Properties.Add(property);
                     }
                 }
             }
         }
         else if (reader.NodeType == XmlNodeType.EndElement && string.Compare(ObjectDefinition.SerialisationName, reader.Name, true) == 0)
         {
             break;
         }
     }
 }
Ejemplo n.º 15
0
 private void Deserialise(JsonReader reader)
 {
     Model.PropertyDefinition propertyDefinition = null;
     Model.Property property = null;
     bool isID = false;
     while (reader.Read())
     {
         switch (reader.State)
         {
             case TJsonReaderState.NotSet:
                 break;
             case TJsonReaderState.Array:
                 break;
             case TJsonReaderState.BOF:
                 break;
             case TJsonReaderState.Boolean:
                 if (propertyDefinition != null)
                 {
                     Model.PropertyValue propertyValue = new Model.PropertyValue(reader.AsBoolean.ToString());
                     if (propertyDefinition.IsCollection)
                     {
                         if (property.Values == null)
                             property.Values = new List<Model.PropertyValue>();
                         property.Values.Add(propertyValue);
                     }
                     else
                     {
                         property.Value = new Model.PropertyValue(propertyValue.Value);
                     }
                 }
                 break;
             case TJsonReaderState.EndArray:
                 propertyDefinition = null;
                 break;
             case TJsonReaderState.EndObject:
                 break;
             case TJsonReaderState.EOF:
                 break;
             case TJsonReaderState.Member:
                 if (reader.Text.Equals("Links"))
                 {
                     Links = new List<Link>();
                     Links.Deserialise(reader);
                 }
                 else
                 {
                     propertyDefinition = ObjectDefinition.GetPropertyBySerialisationName(reader.Text);
                     if (propertyDefinition == null)
                     {
                         isID = string.Compare(reader.Text, "InstanceID", true) == 0;
                     }
                     else
                     {
                         isID = false;
                         property = new Model.Property();
                         property.PropertyDefinitionID = propertyDefinition.PropertyDefinitionID;
                         property.PropertyID = propertyDefinition.PropertyID;
                         if (_Resource != null)
                             _Resource.Properties.Add(property);
                     }
                 }
                 break;
             case TJsonReaderState.Null:
                 break;
             case TJsonReaderState.Number:
                 if (propertyDefinition != null)
                 {
                     Model.PropertyValue propertyValue = new Model.PropertyValue(reader.Text);
                     if (propertyDefinition.IsCollection)
                     {
                         if (property.Values == null)
                             property.Values = new List<Model.PropertyValue>();
                         property.Values.Add(propertyValue);
                     }
                     else
                     {
                         property.Value = new Model.PropertyValue(propertyValue.Value);
                     }
                 }
                 break;
             case TJsonReaderState.Object:
                 if (_Resource == null)
                 {
                     _Resource = new Model.Object();
                     _Resource.ObjectDefinitionID = ObjectDefinition.ObjectDefinitionID;
                     _Resource.ObjectID = ObjectDefinition.ObjectID;
                 }
                 break;
             case TJsonReaderState.String:
                 if (propertyDefinition == null)
                 {
                     if (isID)
                         _Resource.InstanceID = reader.Text;
                 }
                 else
                 {
                     string text;
                     if (propertyDefinition.DataType == Model.TPropertyDataType.DateTime)
                     {
                         text = GetDateTimeString(reader.Text);
                     }
                     else
                     {
                         text = reader.Text;
                     }
                     Model.PropertyValue propertyValue = new Model.PropertyValue(text);
                     if (propertyDefinition.IsCollection)
                     {
                         if (property.Values == null)
                             property.Values = new List<Model.PropertyValue>();
                         property.Values.Add(propertyValue);
                     }
                     else
                     {
                         property.Value = new Model.PropertyValue(propertyValue.Value);
                     }
                 }
                 break;
             default:
                 break;
         }
     }
 }