/// <summary> /// 增加一条数据 /// </summary> public static Hashtable Insert(Model.BonusList model, Hashtable MyHs) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BonusList("); strSql.Append("BonusCode,MID,BonusDate,IsValid,GiftCode,ValidDate,BonusRemark"); strSql.Append(") values ("); strSql.Append("@BonusCode,@MID,@BonusDate,@IsValid,@GiftCode,@ValidDate,@BonusRemark"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@BonusCode", SqlDbType.VarChar, 32), new SqlParameter("@MID", SqlDbType.VarChar, 20), new SqlParameter("@BonusDate", SqlDbType.DateTime), new SqlParameter("@IsValid", SqlDbType.Bit, 1), new SqlParameter("@GiftCode", SqlDbType.VarChar, 32), new SqlParameter("@ValidDate", SqlDbType.DateTime), new SqlParameter("@BonusRemark", SqlDbType.VarChar, 100) }; parameters[0].Value = model.BonusCode; parameters[1].Value = model.MID; parameters[2].Value = model.BonusDate; parameters[3].Value = model.IsValid; parameters[4].Value = model.GiftCode; parameters[5].Value = model.ValidDate; parameters[6].Value = model.BonusRemark; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
private static Model.BonusList DataRowToModel(DataRow row) { if (row != null) { Model.BonusList model = new Model.BonusList(); model.BonusCode = row["BonusCode"].ToString(); model.MID = row["MID"].ToString(); if (row["BonusDate"].ToString() != "") { model.BonusDate = DateTime.Parse(row["BonusDate"].ToString()); } if (row["IsValid"].ToString() != "") { model.IsValid = bool.Parse(row["IsValid"].ToString()); } model.GiftCode = row["GiftCode"].ToString(); if (row["ValidDate"].ToString() != "") { model.ValidDate = DateTime.Parse(row["ValidDate"].ToString()); } model.BonusRemark = row["BonusRemark"].ToString(); return(model); } else { return(null); } }
public static System.Collections.Hashtable Insert(Model.BonusList model, System.Collections.Hashtable MyHs) { if (model.IsValid) { BLL.ChangeMoney.GetGiftMoneyChangeTran(model, MyHs); } BLL.MemberBonus.Update(model.MID, "Points", model.Points, MyHs); return(DAL.BonusList.Insert(model, MyHs)); }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(Model.BonusList model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update BonusList set "); strSql.Append(" BonusCode = @BonusCode , "); strSql.Append(" MID = @MID , "); strSql.Append(" BonusDate = @BonusDate , "); strSql.Append(" IsValid = @IsValid , "); strSql.Append(" GiftCode = @GiftCode , "); strSql.Append(" ValidDate = @ValidDate , "); strSql.Append(" BonusRemark = @BonusRemark "); strSql.Append(" where BonusCode=@BonusCode "); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@BonusCode", SqlDbType.VarChar, 32), new SqlParameter("@MID", SqlDbType.VarChar, 20), new SqlParameter("@BonusDate", SqlDbType.DateTime), new SqlParameter("@IsValid", SqlDbType.Bit, 1), new SqlParameter("@GiftCode", SqlDbType.VarChar, 32), new SqlParameter("@ValidDate", SqlDbType.DateTime), new SqlParameter("@BonusRemark", SqlDbType.VarChar, 100) }; parameters[0].Value = model.BonusCode; parameters[1].Value = model.MID; parameters[2].Value = model.BonusDate; parameters[3].Value = model.IsValid; parameters[4].Value = model.GiftCode; parameters[5].Value = model.ValidDate; parameters[6].Value = model.BonusRemark; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
public static bool Update(Model.BonusList model) { return(DAL.BonusList.Update(model)); }
public static System.Collections.Hashtable Update(Model.BonusList model, System.Collections.Hashtable MyHs) { return(DAL.BonusList.Update(model, MyHs)); }
public static bool Insert(Model.BonusList model) { return(DAL.BonusList.Insert(model)); }
public static bool Update(Model.BonusList model) { return(DAL.CommonBase.RunHashtable(Update(model, new System.Collections.Hashtable()))); }