Exemple #1
0
 public CountryInfo(string id, string name, CurrencyInfo cur)
 {
     if (string.IsNullOrEmpty(id)) throw new ArgumentException("ID is NULL.", "id");
     if (string.IsNullOrEmpty(name)) throw new ArgumentException("Name is NULL.", "name");
     if (cur == null) throw new ArgumentException("Currency is NULL.", "cur");
     this.ID = id;
     this.Name = name;
     this.Currency = cur;
 }
Exemple #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;
 }
Exemple #3
0
        public YCurrencyID GetYCurrencyIDFromString(string id)
        {
            string idStr = id.ToUpper();
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\A[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]=X\z");
            if (idStr.Length == 8 && regex.Match(idStr).Success)
            {
                CurrencyInfo b = null;
                CurrencyInfo dep = null;
                string baseStr = idStr.Substring(0, 3);
                string depStr = idStr.Substring(3, 3);
                foreach (CurrencyInfo cur in mCurrencies)
                {
                    if (baseStr == cur.ID) { b = new CurrencyInfo(cur.ID, cur.Name); }
                    else if (depStr == cur.ID) { dep = new CurrencyInfo(cur.ID, cur.Name); }

                    if (b != null && dep != null) { return new YCurrencyID(b, dep); }
                }

                return null;
            }
            else
            {
                return null;
            }
        }
Exemple #4
0
 public YCurrencyID()
 {
     mBaseCurrency = null;
     mDepCurrency = null;
 }