public List<MilitaryBranch> GetMilitaryBranchList(PetfirstCustomer mCustomer) { List<MilitaryBranch> lstReturn = new List<MilitaryBranch>(); string cacheKey = "$MilitaryBranchList$"; object CachedList = m_Cache.Get(cacheKey) as List<MilitaryBranch>; if (CachedList == null)//get from the service { CoreServiceReference.CoreServiceClient cs = new CoreServiceClient(); CoreServiceGetMilitaryBranchResponse ccResponse = cs.GetMilitaryBranchList(); foreach (MilitaryBranch mb in ccResponse.Branches) { lstReturn.Add(mb); } 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 branches", 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<MilitaryBranch>)CachedList; } return lstReturn; }