Ejemplo n.º 1
0
        //============================================================================*
        // Import()
        //============================================================================*

        public virtual bool Import(cRWXMLDocument XMLDocument, XmlNode XMLThisNode, cDataFiles DataFiles)
        {
            XmlNode XMLNode = XMLThisNode.FirstChild;

            while (XMLNode != null)
            {
                switch (XMLNode.Name)
                {
                case "Manufacturer":
                    Manufacturer = DataFiles.GetManufacturerByName(XMLNode.FirstChild.Value);
                    break;

                case "PartNumber":
                case "Model":
                    m_strPartNumber = XMLNode.FirstChild.Value;
                    break;

                case "SerialNumber":
                    m_strSerialNumber = XMLNode.FirstChild.Value;
                    break;

                case "Description":
                    m_strDescription = XMLNode.FirstChild.Value;
                    break;

                case "AcquiredFrom":
                case "Source":
                    m_strSource = XMLNode.FirstChild.Value;
                    break;

                case "PurchaseDate":
                case "DatePurchased":
                    DateTime.TryParse(XMLNode.FirstChild.Value, out m_Date);
                    break;

                case "PurchasePrice":
                case "Price":
                case "Cost":
                    Double.TryParse(XMLNode.FirstChild.Value, out m_dPrice);
                    break;

                case "Notes":
                    m_strNotes = XMLNode.FirstChild.Value;
                    break;

                default:
                    break;
                }

                XMLNode = XMLNode.NextSibling;
            }

            return(Validate());
        }
Ejemplo n.º 2
0
		//============================================================================*
		// Import()
		//============================================================================*

		public virtual bool Import(cRWXMLDocument XMLDocument, XmlNode XMLThisNode, cDataFiles DataFiles)
			{
			XmlNode XMLNode = XMLThisNode.FirstChild;

			while (XMLNode != null)
				{
				switch (XMLNode.Name)
					{
					case "SupplyType":
						XMLDocument.Import(XMLNode, out m_eType);
						break;
					case "FirearmType":
						XMLDocument.Import(XMLNode, out m_eFirearmType);
						break;
					case "Manufacturer":
						m_Manufacturer = DataFiles.GetManufacturerByName(XMLNode.FirstChild.Value);
						break;
					case "CrossUse":
						XMLDocument.Import(XMLNode, out m_fCrossUse);
						break;
					case "MinStockLevel":
						XMLDocument.Import(XMLNode, out m_dMinimumStockLevel);
						break;
					case "Quantity":
						XMLDocument.Import(XMLNode, out m_dQuantity);
						break;
					case "Cost":
						XMLDocument.Import(XMLNode, out m_dCost);
						break;
					case "Checked":
						XMLDocument.Import(XMLNode, out m_fChecked);
						break;
					case "Transactions":
					case "TransactionList":
						m_TransactionList.Import(XMLDocument, XMLNode, DataFiles, this);
						break;
					default:
						break;
					}

				XMLNode = XMLNode.NextSibling;
				}

			return (true);
			}