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; }
/// <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; }
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; } }
public YCurrencyID() { mBaseCurrency = null; mDepCurrency = null; }