public List<MilitaryStatus> GetMilitaryStatusList(PetfirstCustomer mCustomer) { List<MilitaryStatus> lstReturn = new List<MilitaryStatus>(); string cacheKey = "$MilitaryStatusList$"; object CachedList = m_Cache.Get(cacheKey) as List<MilitaryBranch>; if (CachedList == null)//get from the service { CoreServiceReference.CoreServiceClient cs = new CoreServiceClient(); CoreServiceGetMilitaryStatusResponse ccResponse = cs.GetMilitaryStatusList(); foreach (MilitaryStatus ms in ccResponse.Status) { lstReturn.Add(ms); } if (lstReturn.Count > 0) { m_Cache.Add(cacheKey, lstReturn); } else { lstReturn = null; LogException le = new LogException(); try { le.LogError(HttpContext.Current.Request.Url.AbsoluteUri, "Error retreiving military status", ccResponse.Error.ErrorText, mCustomer); ///Test email server //le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", msg, "<hr />User Input:", le.BuildUserDataString(mCustomer))); } catch (Exception ex) { ///Test email server //lblError.Text = ex.ToString(); try { le.SendErrorEmail(string.Concat(HttpContext.Current.Request.Url.AbsoluteUri, "<br/><hr />", ex.Message, "<br />StackTrace: ", ex.StackTrace, "<br /><hr />User Input:", le.BuildUserDataString(mCustomer))); } catch { } } } } else { lstReturn = (List<MilitaryStatus>)CachedList; } return lstReturn; }