/// <summary> /// 增加一条数据 /// </summary> public bool Add(LingLong.Admin.Model.t_reward_distribution model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_reward_distribution("); strSql.Append("DistributionName,PlatformRatio,AgentRatio,StoreRatio,BusinessRatio,IsDefault,IsUse,IsDeleted,DeleterUserId,LastModificationTime,LastModifierUserId,CreationTime,CreatorUserId)"); strSql.Append(" values ("); strSql.Append("@DistributionName,@PlatformRatio,@AgentRatio,@StoreRatio,@BusinessRatio,@IsDefault,@IsUse,@IsDeleted,@DeleterUserId,@LastModificationTime,@LastModifierUserId,@CreationTime,@CreatorUserId)"); MySqlParameter[] parameters = { new MySqlParameter("@DistributionName", MySqlDbType.VarChar, 50), new MySqlParameter("@PlatformRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@AgentRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@StoreRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@BusinessRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@IsDefault", MySqlDbType.Int16, 4), new MySqlParameter("@IsUse", MySqlDbType.Int16, 4), new MySqlParameter("@IsDeleted", MySqlDbType.Int16, 4), new MySqlParameter("@DeleterUserId", MySqlDbType.Int64, 20), new MySqlParameter("@LastModificationTime", MySqlDbType.DateTime), new MySqlParameter("@LastModifierUserId", MySqlDbType.Int64, 20), new MySqlParameter("@CreationTime", MySqlDbType.DateTime), new MySqlParameter("@CreatorUserId", MySqlDbType.Int64, 20) }; parameters[0].Value = model.DistributionName; parameters[1].Value = model.PlatformRatio; parameters[2].Value = model.AgentRatio; parameters[3].Value = model.StoreRatio; parameters[4].Value = model.BusinessRatio; parameters[5].Value = model.IsDefault; parameters[6].Value = model.IsUse; parameters[7].Value = model.IsDeleted; parameters[8].Value = model.DeleterUserId; parameters[9].Value = model.LastModificationTime; parameters[10].Value = model.LastModifierUserId; parameters[11].Value = model.CreationTime; parameters[12].Value = model.CreatorUserId; int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public LingLong.Admin.Model.t_reward_distribution GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,DistributionName,PlatformRatio,AgentRatio,StoreRatio,BusinessRatio,IsDefault,IsUse,IsDeleted,DeleterUserId,LastModificationTime,LastModifierUserId,CreationTime,CreatorUserId from t_reward_distribution "); strSql.Append(" where ID=@ID"); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.Int32) }; parameters[0].Value = ID; LingLong.Admin.Model.t_reward_distribution model = new LingLong.Admin.Model.t_reward_distribution(); DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public LingLong.Admin.Model.t_reward_distribution DataRowToModel(DataRow row) { LingLong.Admin.Model.t_reward_distribution model = new LingLong.Admin.Model.t_reward_distribution(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["DistributionName"] != null) { model.DistributionName = row["DistributionName"].ToString(); } if (row["PlatformRatio"] != null && row["PlatformRatio"].ToString() != "") { model.PlatformRatio = decimal.Parse(row["PlatformRatio"].ToString()); } if (row["AgentRatio"] != null && row["AgentRatio"].ToString() != "") { model.AgentRatio = decimal.Parse(row["AgentRatio"].ToString()); } if (row["StoreRatio"] != null && row["StoreRatio"].ToString() != "") { model.StoreRatio = decimal.Parse(row["StoreRatio"].ToString()); } if (row["BusinessRatio"] != null && row["BusinessRatio"].ToString() != "") { model.BusinessRatio = decimal.Parse(row["BusinessRatio"].ToString()); } if (row["IsDefault"] != null && row["IsDefault"].ToString() != "") { model.IsDefault = int.Parse(row["IsDefault"].ToString()); } if (row["IsUse"] != null && row["IsUse"].ToString() != "") { model.IsUse = int.Parse(row["IsUse"].ToString()); } if (row["IsDeleted"] != null && row["IsDeleted"].ToString() != "") { model.IsDeleted = int.Parse(row["IsDeleted"].ToString()); } if (row["DeleterUserId"] != null && row["DeleterUserId"].ToString() != "") { model.DeleterUserId = long.Parse(row["DeleterUserId"].ToString()); } if (row["LastModificationTime"] != null && row["LastModificationTime"].ToString() != "") { model.LastModificationTime = DateTime.Parse(row["LastModificationTime"].ToString()); } if (row["LastModifierUserId"] != null && row["LastModifierUserId"].ToString() != "") { model.LastModifierUserId = long.Parse(row["LastModifierUserId"].ToString()); } if (row["CreationTime"] != null && row["CreationTime"].ToString() != "") { model.CreationTime = DateTime.Parse(row["CreationTime"].ToString()); } if (row["CreatorUserId"] != null && row["CreatorUserId"].ToString() != "") { model.CreatorUserId = long.Parse(row["CreatorUserId"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LingLong.Admin.Model.t_reward_distribution model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_reward_distribution set "); strSql.Append("DistributionName=@DistributionName,"); strSql.Append("PlatformRatio=@PlatformRatio,"); strSql.Append("AgentRatio=@AgentRatio,"); strSql.Append("StoreRatio=@StoreRatio,"); strSql.Append("BusinessRatio=@BusinessRatio,"); strSql.Append("IsDefault=@IsDefault,"); strSql.Append("IsUse=@IsUse,"); strSql.Append("IsDeleted=@IsDeleted,"); strSql.Append("DeleterUserId=@DeleterUserId,"); strSql.Append("LastModificationTime=@LastModificationTime,"); strSql.Append("LastModifierUserId=@LastModifierUserId,"); strSql.Append("CreationTime=@CreationTime,"); strSql.Append("CreatorUserId=@CreatorUserId"); strSql.Append(" where ID=@ID"); MySqlParameter[] parameters = { new MySqlParameter("@DistributionName", MySqlDbType.VarChar, 50), new MySqlParameter("@PlatformRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@AgentRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@StoreRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@BusinessRatio", MySqlDbType.Decimal, 10), new MySqlParameter("@IsDefault", MySqlDbType.Int16, 4), new MySqlParameter("@IsUse", MySqlDbType.Int16, 4), new MySqlParameter("@IsDeleted", MySqlDbType.Int16, 4), new MySqlParameter("@DeleterUserId", MySqlDbType.Int64, 20), new MySqlParameter("@LastModificationTime", MySqlDbType.DateTime), new MySqlParameter("@LastModifierUserId", MySqlDbType.Int64, 20), new MySqlParameter("@CreationTime", MySqlDbType.DateTime), new MySqlParameter("@CreatorUserId", MySqlDbType.Int64, 20), new MySqlParameter("@ID", MySqlDbType.Int32, 11) }; parameters[0].Value = model.DistributionName; parameters[1].Value = model.PlatformRatio; parameters[2].Value = model.AgentRatio; parameters[3].Value = model.StoreRatio; parameters[4].Value = model.BusinessRatio; parameters[5].Value = model.IsDefault; parameters[6].Value = model.IsUse; parameters[7].Value = model.IsDeleted; parameters[8].Value = model.DeleterUserId; parameters[9].Value = model.LastModificationTime; parameters[10].Value = model.LastModifierUserId; parameters[11].Value = model.CreationTime; parameters[12].Value = model.CreatorUserId; parameters[13].Value = model.ID; int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LingLong.Admin.Model.t_reward_distribution model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(LingLong.Admin.Model.t_reward_distribution model) { return(dal.Add(model)); }