Exemplo n.º 1
0
        /// <summary>
        /// Loads as list of default countries from market.xml
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public static CountryInfo[] GetDefaultCountries()
        {
            List <CountryInfo> countries = new List <CountryInfo>();

            XParseDocument xmlDoc = MyHelper.ParseXmlDocument(Properties.Resources.market);

            XParseElement[] cntNodes = XPath.GetElements("//Resources/Countries/Country", xmlDoc);
            System.Globalization.CultureInfo convCulture = new System.Globalization.CultureInfo("en-US");

            foreach (XParseElement cntNode in cntNodes)
            {
                for (Country cnt = 0; cnt <= Country.VN; cnt++)
                {
                    if (cnt.ToString() == MyHelper.GetXmlAttributeValue(cntNode, "ID"))
                    {
                        CurrencyInfo cntCur = null;
                        string       curID  = MyHelper.GetXmlAttributeValue(cntNode, "Currency");
                        foreach (CurrencyInfo cur in DefaultCurrencies)
                        {
                            if (cur.ID.ToString() == curID)
                            {
                                cntCur = cur;
                                break;
                            }
                        }

                        XParseElement             dstNodes = XPath.GetElement("DaylightSavingTimes", cntNode);
                        List <DaylightSavingTime> dstList  = new List <DaylightSavingTime>();
                        foreach (XParseElement dstNode in dstNodes.Elements())
                        {
                            if (dstNode.Name.LocalName == "DST")
                            {
                                DateTime dstStart = Convert.ToDateTime(MyHelper.GetXmlAttributeValue(dstNode, "Start"), convCulture);
                                DateTime dstEnd   = Convert.ToDateTime(MyHelper.GetXmlAttributeValue(dstNode, "End"), convCulture);
                                dstList.Add(new DaylightSavingTime(dstStart, dstEnd));
                            }
                        }
                        countries.Add(new CountryInfo(cnt, MyHelper.GetXmlAttributeValue(cntNode, "Name"), cntCur, dstList.ToArray()));
                        break;
                    }
                }
            }
            return(countries.ToArray());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Overloaded constructor
 /// </summary>
 /// <param name="baseCur"></param>
 /// <param name="depCur"></param>
 /// <remarks></remarks>
 public YCurrencyID(CurrencyInfo baseCur, CurrencyInfo depCur)
 {
     this.BaseCurrency = baseCur;
     this.DepCurrency  = depCur;
 }
Exemplo n.º 3
0
 public CountryInfo(Country id, string name, CurrencyInfo cur)
 {
     mID       = id;
     mName     = name;
     mCurrency = cur;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <remarks></remarks>
 public YCurrencyID()
 {
     mBaseCurrency = null;
     mDepCurrency  = null;
 }