Exemple #1
0
        /// <summary>
        /// Stores the address.
        /// </summary>
        /// <param name="address">Address of the area.</param>
        /// <param name="subNode">Subnode.</param>
        void StoreAddress(Estate.Address address, XmlNode subNode)
        {
            XmlNode addressNode = this.CreateNode(subNode, EtqDireccion, "");

            // Floor
            this.CreateNode(addressNode, EtqFloor, address.Floor.ToString());

            // Door
            this.CreateNode(addressNode, EtqDoor, address.Floor.ToString());

            // Street
            this.CreateNode(addressNode, EtqStreet, address.Street);

            // Street number
            this.CreateNode(addressNode, EtqStreetNumber, address.StreetNumber.ToString());

            // City
            this.CreateNode(addressNode, EtqCity, address.City);

            // Province
            this.CreateNode(addressNode, EtqProvince, address.Province);

            // Postal code
            this.CreateNode(addressNode, EtqPostalCode, address.PostalCode.ToString());
        }
Exemple #2
0
        void LoadEstate(Place place, XmlNode n)
        {
            string id              = "";
            string name            = "";
            string refCatastral    = "";
            double area            = 0;
            double valor           = 0;
            double precioDeVenta   = 0;
            string nombreComprador = "";
            bool   esUrbana        = false;
            string observaciones   = "";

            Estate.Address d = null;

            // Load
            ExtractAttributes(n, ref id, ref name);

            foreach (XmlNode x in n.ChildNodes)
            {
                if (x.Name.ToUpper() == EtqArea)
                {
                    area = Convert.ToDouble(x.InnerText, CultureInfo.InvariantCulture);
                }
                else
                if (x.Name.ToUpper() == EtqValor)
                {
                    valor = Convert.ToDouble(x.InnerText, CultureInfo.InvariantCulture);
                }
                else
                if (x.Name.ToUpper() == EtqObs)
                {
                    observaciones = x.InnerText;
                }
                else
                if (x.Name.ToUpper() == EtqRefCatastral)
                {
                    refCatastral = x.InnerText;
                }
                else
                if (x.Name.ToUpper() == EtqTipo)
                {
                    if (x.InnerText.ToUpper() == EtqUrbana)
                    {
                        esUrbana = true;
                    }
                    else
                    if (x.InnerText.ToUpper() == EtqRustica)
                    {
                        esUrbana = false;
                    }
                    else
                    {
                        this.IncorrectLabelError(
                            "Tipo de finca no comprendido en "
                            + name + '(' + id + ')'
                            );
                    }
                }
                else
                if (x.Name.ToUpper() == EtqVendido)
                {
                    foreach (XmlNode nv in x.Attributes)
                    {
                        if (nv.Name.ToUpper() == EtqNombre)
                        {
                            nombreComprador = nv.InnerText;
                        }
                        else
                        if (nv.Name.ToUpper() == EtqPrecio)
                        {
                            precioDeVenta = Convert.ToDouble(nv.InnerText, CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            this.IncorrectLabelError("info de venta no válida");
                        }
                    }
                }
                else
                if (x.Name.ToUpper() == EtqDireccion)
                {
                    d = new Estate.Address();
                    foreach (XmlNode nd in x.ChildNodes)
                    {
                        if (nd.Name.ToUpper() == EtqStreetNumber)
                        {
                            d.StreetNumber = Convert.ToInt32(nd.InnerText);
                        }
                        else
                        if (nd.Name.ToUpper() == EtqFloor)
                        {
                            d.Floor = Convert.ToInt32(nd.InnerText);
                        }
                        else
                        if (nd.Name.ToUpper() == EtqPostalCode)
                        {
                            d.PostalCode = Convert.ToInt32(nd.InnerText);
                        }
                        else
                        if (nd.Name.ToUpper() == EtqDoor)
                        {
                            d.Door = nd.InnerText;
                        }
                        else
                        if (nd.Name.ToUpper() == EtqStreet)
                        {
                            d.Street = nd.InnerText;
                        }
                        else
                        if (nd.Name.ToUpper() == EtqCity)
                        {
                            d.City = nd.InnerText;
                        }
                        else
                        if (nd.Name.ToUpper() == EtqProvince)
                        {
                            d.Province = nd.InnerText;
                        }
                    }
                }
            }

            Estate f = this.InsertEstate(place, id, name, area);

            f.Valor = valor;

            if (f.IsUrban != esUrbana)
            {
                f.IsUrban = esUrbana;
            }

            if (d != null)
            {
                f.ponDireccion(d);
            }

            if (!string.IsNullOrEmpty(refCatastral))
            {
                f.RefCatastral = refCatastral;
            }

            if (!string.IsNullOrEmpty(observaciones))
            {
                f.Remarks = observaciones;
            }

            if (precioDeVenta > 0.0 ||
                nombreComprador.Length > 0)
            {
                f.fueVendido(nombreComprador, precioDeVenta);
            }
        }