Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
 public static bool Update(Model.BonusList model)
 {
     return(DAL.BonusList.Update(model));
 }
Esempio n. 6
0
 public static System.Collections.Hashtable Update(Model.BonusList model, System.Collections.Hashtable MyHs)
 {
     return(DAL.BonusList.Update(model, MyHs));
 }
Esempio n. 7
0
 public static bool Insert(Model.BonusList model)
 {
     return(DAL.BonusList.Insert(model));
 }
Esempio n. 8
0
 public static bool Update(Model.BonusList model)
 {
     return(DAL.CommonBase.RunHashtable(Update(model, new System.Collections.Hashtable())));
 }