/// <summary> /// Common initialization routine /// </summary> /// <param name="userName"></param> /// <param name="mopCode"></param> protected void construct([RequiredItem()] string userName, int mopCode) { // default to unknown _paymentType = ePaymentType.Unknown; // load validator to validate if the call is valid. if it's not // do not throw an error, in other words, just use IsValid(). MethodValidator validator = new MethodValidator( MethodBase.GetCurrentMethod(), userName, mopCode); if (validator.IsValid()) { _userName = userName; // Test for negative value or zero... these are invalid if (mopCode > 0) { try { // Now translate it using DAL DalMethodOfPayment dalMop = new DalMethodOfPayment(); // get the integer value int paymentType = dalMop.GetPaymentTypeByUserMop(userName, mopCode); // set internal enumerated type _paymentType = (ePaymentType)TypeDescriptor.GetConverter(typeof( ePaymentType)).ConvertFrom(paymentType);; } // try catch //( Exception ex ) { // Publish to allow support staff to correct the problem // throw away exceptions because we have already set // _paymentType = Unknown //ExceptionManager.Publish( ex ); } } } }