public void insertRecommendationSettingDetail(Recommend_Setting_Value rsv) { Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@Key", rsv.Key); parameters.Add("@Value", rsv.Value); parameters.Add("@isDefault", rsv.isDedault); executeNonQuery("INSERT INTO [RS].[RECOMMEND_SETTING_VALUE_TBL]([Key] ,[Value],[isDefault])VALUES(@Key,@Value,@isDefault)", parameters); }
public List<Recommend_Setting_Value> getListRecommendationSettingValue(string Key) { Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@Key", Key); SqlDataReader reader = executeReader("SELECT ValueID,Value,isDefault FROM RS.RECOMMEND_SETTING_VALUE_TBL WHERE [Key] = @Key ORDER BY isDefault DESC", parameters); List<Recommend_Setting_Value> lstRecommendSettingValue = new List<Recommend_Setting_Value>(); while (reader.Read()) { Recommend_Setting_Value rsv = new Recommend_Setting_Value(); rsv.ValueID = reader.GetInt32(reader.GetOrdinal("ValueID")); rsv.Value = reader.GetString(reader.GetOrdinal("Value")); rsv.isDedault = reader.GetBoolean(reader.GetOrdinal("isDefault")); rsv.Key = Key; lstRecommendSettingValue.Add(rsv); } reader.Close(); return lstRecommendSettingValue; }
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; }
public void updateRecommendationSettingDetail(Recommend_Setting_Value rsv) { Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@Key", rsv.Key); parameters.Add("@Value", rsv.Value); parameters.Add("@isDefault", rsv.isDedault); parameters.Add("@ValueID", rsv.ValueID); executeNonQuery("UPDATE [RS].[RECOMMEND_SETTING_VALUE_TBL] SET [Key] = @Key ,[Value] = @Value ,[isDefault] = @isDefault WHERE ValueID = @ValueID", parameters); }