public List<Breed> GetBreedList(int sid, PetfirstCustomer mCustomer) { List<Breed> lstReturn = null; string cacheKey = string.Concat("$BreedList_sid$" ,sid); object CachedList = m_Cache.Get(cacheKey) as List<Breed>; if (CachedList == null)//get from the service { CoreServiceReference.CoreServiceClient cs = new CoreServiceClient(); CoreServiceGetBreedListRequest cRequest = new CoreServiceGetBreedListRequest(); cRequest.SpeciesId = sid; CoreServiceGetBreedListResponse cbResponse = cs.GetBreedList(cRequest); //insert select breed on the top if (string.IsNullOrEmpty(cbResponse.Error.ErrorText))//check error { if (cbResponse.Breeds != null) { lstReturn = ModifyMixedBreed(sid, cbResponse.Breeds); m_Cache.Add(cacheKey, lstReturn); } } else { lstReturn = null; LogException le = new LogException(); try { le.LogError(HttpContext.Current.Request.Url.AbsoluteUri, "Error during getting breed list", cbResponse.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<Breed>)CachedList; } return lstReturn; }