Example #1
0
        public Settings GetRecommendationSeting(Predict_DAO_MCol a)
        {
            Settings st = new Settings();

            try
            {
                List <Recommendation_Setting> listCs = a.GetRecommendationSetting();

                if (null != listCs && listCs.Count > 0)
                {
                    foreach (var item in listCs)
                    {
                        if (item.Key.Equals(ConstantValues.nb_R1))
                        {
                            foreach (var cs_detail in item.Values)
                            {
                                if (cs_detail.isDedault.Equals(true))
                                {
                                    st.nbR1 = Convert.ToInt32(cs_detail.Value.Trim());
                                    break;
                                }
                            }
                        }
                        else
                        if (item.Key.Equals(ConstantValues.nb_R2))
                        {
                            foreach (var cs_detail in item.Values)
                            {
                                if (cs_detail.isDedault.Equals(true))
                                {
                                    st.nbR2 = Convert.ToInt32(cs_detail.Value.Trim());
                                    break;
                                }
                            }
                        }
                        else if (item.Key.Equals(ConstantValues.nb_R3))
                        {
                            foreach (var cs_detail in item.Values)
                            {
                                if (cs_detail.isDedault.Equals(true))
                                {
                                    st.nbR3 = Convert.ToInt32(cs_detail.Value.Trim());
                                    break;
                                }
                            }
                        }
                        else if (item.Key.Equals(ConstantValues.param_R4))
                        {
                            foreach (var cs_detail in item.Values)
                            {
                                if (cs_detail.isDedault.Equals(true))
                                {
                                    st.paramR4 = Convert.ToDouble(cs_detail.Value.Trim(), CultureInfo.CreateSpecificCulture("en-GB"));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                a.rollbackTransaction();
                throw ex;
            }
            return(st);
        }