示例#1
0
 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));
 }
示例#2
0
        /// <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);
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public static bool Update(Model.TicketBonus model)
 {
     DAL.TicketBonus.Model = null;
     return(DAL.CommonBase.RunHashtable(Update(model, new System.Collections.Hashtable())));
 }
示例#5
0
 public static bool Update(Model.TicketBonus model)
 {
     return(DAL.TicketBonus.Update(model));
 }