Exemple #1
0
 public void insertRecommendationSetting(Recommendation_Setting rs)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("@Key", rs.Key);
     parameters.Add("@DataType", rs.DataType);
     parameters.Add("@Description", rs.Description);
     executeNonQuery("INSERT INTO [RS].[RECOMMEND_SETTING_TBL]([Key],[DataType],[Description]) VALUES(@Key ,@DataType,@Description)", parameters);
 }
Exemple #2
0
 public List<Recommendation_Setting> getListRecommendationSetting()
 {
     List<Recommendation_Setting> lstRecommendationSetting = new List<Recommendation_Setting>();
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     SqlDataReader reader = executeReader("SELECT RS.RECOMMEND_SETTING_TBL.[Key],RS.RECOMMEND_SETTING_TBL.[DataType],RS.RECOMMEND_SETTING_TBL.[Description] FROM RS.RECOMMEND_SETTING_TBL,RS.DATATYPE_TBL WHERE RS.RECOMMEND_SETTING_TBL.DataType = RS.DATATYPE_TBL.DataType  ", parameters);
     while (reader.Read())
     {
         Recommendation_Setting cs = new Recommendation_Setting();
         cs.Key = reader.GetString(reader.GetOrdinal("Key"));
         cs.DataType = reader.GetString(reader.GetOrdinal("DataType"));
         cs.Description = reader.GetString(reader.GetOrdinal("Description"));
         lstRecommendationSetting.Add(cs);
     }
     reader.Close();
     return lstRecommendationSetting;
 }
        public void updateRecommendationSetting(Recommendation_Setting rs)
        {
            Recommendation_DAO dao = null;
            try
            {
                dao = new Recommendation_DAO();
                dao.beginTransaction();
                dao.updateRecommendationSetting(rs);
                List<Recommend_Setting_Value> lstAvailable = dao.getListRecommendationSettingValue(rs.Key);
                foreach (Recommend_Setting_Value avai in lstAvailable)
                {
                    bool isDeleted = true;
                    foreach (Recommend_Setting_Value val in rs.Values)
                    {
                        if (val.ValueID == avai.ValueID)
                        {
                            isDeleted = false;
                            break;
                        }
                    }
                    if (isDeleted)
                        dao.deleteRecommendationSettingDetail(avai.ValueID);
                }

                foreach (Recommend_Setting_Value val in rs.Values)
                {
                    if (val.ValueID != -1)
                    {
                        dao.updateRecommendationSettingDetail(val);
                    }
                    else
                    {
                        dao.insertRecommendationSettingDetail(val);
                    }
                }
                dao.commitTransaction();
            }
            catch (Exception ex)
            {
                dao.rollbackTransaction();
                throw ex;
            }
        }
 public void insertRecommendationSetting(Recommendation_Setting rs)
 {
     Recommendation_DAO dao = null;
     try
     {
         dao = new Recommendation_DAO();
         dao.beginTransaction();
         dao.insertRecommendationSetting(rs);
         foreach (Recommend_Setting_Value val in rs.Values)
         {
             dao.insertRecommendationSettingDetail(val);
         }
         dao.commitTransaction();
     }
     catch (Exception ex)
     {
         dao.rollbackTransaction();
         throw ex;
     }
 }
        public List<Recommendation_Setting> GetRecommendationSetting()
        {
            List<Recommendation_Setting> list = new List<Recommendation_Setting>();
            Recommendation_Setting item = null;
            string str = "SELECT [Key], [DataType],[Description] FROM [RS].[RECOMMEND_SETTING_TBL]";
            SqlDataReader dr = executeReader(str);
            while (dr.Read())
            {
                item = new Recommendation_Setting();
                item.Key = dr[0].ToString();
                item.DataType = dr[1].ToString();
                item.Description = dr[2].ToString();
                item.Values = null;
                list.Add(item);
            }
            dr.Close();
            //-------------------------------
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                     Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("@Key1", list[i].Key);
                    Recommend_Setting_Value it = null;
                    list[i].Values = new List<Recommend_Setting_Value>();
                    str = "SELECT [Key], [Value], [isDefault] FROM [RS].[RECOMMEND_SETTING_VALUE_TBL] WHERE [Key] = @Key1";
                    SqlDataReader dr1 = executeReader(str, parameters);
                    while (dr1.Read())
                    {
                        it = new Recommend_Setting_Value();
                        it.Key = dr1[0].ToString();
                        it.Value = dr1[1].ToString();
                        it.isDedault = Convert.ToBoolean(dr1[2]);
                        list[i].Values.Add(it);
                    }
                    dr1.Close();
                }
            }

            return list;
        }
Exemple #6
0
 public void updateRecommendationSetting(Recommendation_Setting rs)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("@Key", rs.Key);
     parameters.Add("@DataType", rs.DataType);
     parameters.Add("@Description", rs.Description);
     executeNonQuery("UPDATE [RS].[RECOMMEND_SETTING_TBL] SET [Key] = @Key ,[DataType] = @DataType ,[Description] = @Description WHERE [Key] = @Key", parameters);
 }