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;
        }
 private void LoggingError(string ops, string msg)
 {
     LogException le = new LogException();
     try
     {
         le.LogError(this.Request.Url.AbsoluteUri, string.Concat("Error during ", ops), msg, mCustomer);
     }
     catch (Exception ex)
     {
         try
         {
             le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", ex.Message, "<br />StackTrace: ", ex.StackTrace, "<br /><hr />User Input:", le.BuildUserDataString(mCustomer)));
         }
         catch { }
     }
 }
 private void DisplayError(string ops, string msg, bool bDisplay)
 {
     if (bDisplay)
     {
         if (mCustomer != null)
             lblError.Text = string.Format((string)System.Configuration.ConfigurationManager.AppSettings["FriendlyErrorMsg"], ops, mCustomer.CallCenter);
         else
             lblError.Text = string.Format((string)System.Configuration.ConfigurationManager.AppSettings["FriendlyErrorMsg"], ops, "855-270-PETS(7387)");
     }
     LogException le = new LogException();
     try
     {
         le.LogError(this.Request.Url.AbsoluteUri, ops, msg, mCustomer);//log to table
     }
     catch (Exception ex1)
     {
         try//log failed, send out email
         {
             le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", ex1.ToString(), "<br /><hr />User Input:", le.BuildUserDataString(mCustomer)));
         }
         catch { }
     }
 }
        public PetColor[] GetColorList(PetfirstCustomer mCustomer)
        {
            PetColor[] lstReturn = null;
            string cacheKey = "$ColorList$";
            object CachedList = m_Cache.Get(cacheKey) as PetColor[];
            if (CachedList == null)//get from the service
            {
                CoreServiceReference.CoreServiceClient cs = new CoreServiceClient();
                CoreServiceGetColorListResponse ccResponse = cs.GetColorList();
                //insert select breed on the top
                if (string.IsNullOrEmpty(ccResponse.Error.ErrorText))//check error
                {
                    if (ccResponse.Colors !=null)
                    {
                        lstReturn = ccResponse.Colors;
                        m_Cache.Add(cacheKey, lstReturn);
                    }
                }
                else
                {
                    lstReturn = null;
                    LogException le = new LogException();
                    try
                    {

                        le.LogError(HttpContext.Current.Request.Url.AbsoluteUri, "Error during getting color list", 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 = (PetColor[])CachedList;
            }
            return lstReturn;
        }
        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;
        }
 private void displayError(string ops, string msg, Label lbl)
 {
     LogException le = new LogException();
     try
     {
         if (lbl != null && mCustomer != null)
             lbl.Text = string.Format((string)System.Configuration.ConfigurationManager.AppSettings["FriendlyErrorMsg"], ops, mCustomer.CallCenter);
         else if (lbl != null)
             lbl.Text = string.Format((string)System.Configuration.ConfigurationManager.AppSettings["FriendlyErrorMsg"], ops, "855-270-PETS (7387)");
         le.LogError(this.Request.Url.AbsoluteUri, string.Concat("Error during ", ops), msg, mCustomer);
         ///Test email server
         //le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", msg, "<hr />User Input:", le.BuildUserDataString(mCustomer)));
     }
     catch (Exception ex)
     {
         try
         {
             le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", ex.Message, "<br />StackTrace: ", ex.StackTrace, "<br /><hr />User Input:", le.BuildUserDataString(mCustomer)));
         }
         catch { }
     }
 }
 private void displayApplyError(string ops, string msg)
 {
     LogException le = new LogException();
     try
     {
         lblApplyError.Text = string.Format((string)System.Configuration.ConfigurationManager.AppSettings["FriendlyErrorMsg"], ops, mCustomer.CallCenter);
         le.LogError(this.Request.Url.AbsoluteUri, string.Concat("Error during ", ops), msg, mCustomer);
     }
     catch (Exception ex)
     {
         ///Test email server
         //lblError.Text = ex.ToString();
         try
         {
             le.SendErrorEmail(string.Concat(Request.Url.AbsoluteUri, "<br/><hr />", ex.Message, "<br />StackTrace: ", ex.StackTrace, "<br /><hr />User Input:", le.BuildUserDataString(mCustomer)));
         }
         catch { }
     }
 }