Пример #1
0
        /// <summary>
        /// 添加Player
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddPlayer(CrowdPlayerModel model)
        {
            const string sql = @"INSERT INTO activity_crow_player
                                (innerid, flagcode, gradeid, totalfee, openid, mobile, wechatnick, wechatheadportrait, orderno, ispay, isenabled, remark, createrid, createdtime)
                                VALUES
                                (@innerid, @flagcode, @gradeid, @totalfee, @openid, @mobile, @wechatnick, @wechatheadportrait, @orderno, @ispay, @isenabled, @remark, @createrid, @createdtime);";

            using (var conn = Helper.GetConnection())
            {
                int result;
                try
                {
                    result = conn.Execute(sql, model);
                }
                catch (Exception ex)
                {
                    LoggerFactories.CreateLogger().Write("AddPlayer异常:", TraceEventType.Error, ex);
                    result = 0;
                }

                return result;
            }
        }
Пример #2
0
 /// <summary>
 /// UpdatePlayer
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int UpdatePlayer(CrowdPlayerModel model)
 {
     var sql = new StringBuilder("update activity_crow_player set ");
     sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));
     sql.Append(" where orderno = @orderno");
     int result;
     try
     {
         result = Helper.Execute(sql.ToString(), model);
     }
     catch (Exception ex)
     {
         result = 0;
         LoggerFactories.CreateLogger().Write("UpdatePlayer:", TraceEventType.Error, ex);
     }
     return result;
 }