public static System.Collections.Hashtable Update(Model.TicketBonus model, System.Collections.Hashtable MyHs) { foreach (yny_002.Model.BonusGift item in model.GiftList) { DAL.BonusGift.Update(item, MyHs); } Model = null; return(DAL.TicketBonus.Update(model, MyHs)); }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(Model.TicketBonus model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update TicketBonus set "); strSql.Append(" Percents = @Percents , "); strSql.Append(" StartTime = @StartTime , "); strSql.Append(" EndTime = @EndTime , "); strSql.Append(" BonusPlan = @BonusPlan , "); strSql.Append(" Money = @Money , "); strSql.Append(" PlayBonus = @PlayBonus , "); strSql.Append(" AboutBonus = @AboutBonus , "); strSql.Append(" TicketState = @TicketState "); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Percents", SqlDbType.Int, 4), new SqlParameter("@StartTime", SqlDbType.DateTime), new SqlParameter("@EndTime", SqlDbType.DateTime), new SqlParameter("@BonusPlan", SqlDbType.VarChar, 10), new SqlParameter("@Money", SqlDbType.Decimal), new SqlParameter("@PlayBonus", SqlDbType.Int, 4), new SqlParameter("@AboutBonus", SqlDbType.VarChar, 250), new SqlParameter("@TicketState", SqlDbType.Bit, 1) }; parameters[0].Value = model.Percents; parameters[1].Value = model.StartTime; parameters[2].Value = model.EndTime; parameters[3].Value = model.BonusPlan; parameters[4].Value = model.Money; parameters[5].Value = model.PlayBonus; parameters[6].Value = model.AboutBonus; parameters[7].Value = model.TicketState; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
private static Model.TicketBonus DataRowToModel(DataRow row) { if (row != null) { Model.TicketBonus model = new Model.TicketBonus(); if (row["Percents"].ToString() != "") { model.Percents = int.Parse(row["Percents"].ToString()); } if (row["PlayBonus"].ToString() != "") { model.PlayBonus = int.Parse(row["PlayBonus"].ToString()); } if (row["StartTime"].ToString() != "") { model.StartTime = DateTime.Parse(row["StartTime"].ToString()); } if (row["EndTime"].ToString() != "") { model.EndTime = DateTime.Parse(row["EndTime"].ToString()); } if (row["Money"].ToString() != "") { model.Money = decimal.Parse(row["Money"].ToString()); } model.AboutBonus = row["AboutBonus"].ToString(); model.BonusPlan = row["BonusPlan"].ToString(); model.GiftList = DAL.BonusGift.GetList("BonusPlan='" + model.BonusPlan + "'"); if (row["TicketState"].ToString() != "") { model.TicketState = bool.Parse(row["TicketState"].ToString()); } return(model); } else { return(null); } }
public static bool Update(Model.TicketBonus model) { DAL.TicketBonus.Model = null; return(DAL.CommonBase.RunHashtable(Update(model, new System.Collections.Hashtable()))); }
public static bool Update(Model.TicketBonus model) { return(DAL.TicketBonus.Update(model)); }