public void InsertUserCommission(UserCommission userComms)
 {
     string sql = string.Format(@"INSERT INTO {0} ({1},{2}) VALUES (@{1},@{2})  SELECT SCOPE_IDENTITY()",
         UserCommission.TABLENAME, UserCommission.USERID, UserCommission.SPECIEID);
     object id = base.ExecuteScalar(sql, new SqlParameter(UserCommission.USERID, userComms.UserId),
         new SqlParameter(UserCommission.SPECIEID, userComms.SpecieId));
     userComms.CommissionId = Convert.ToInt32(id);
 }
예제 #2
0
 /// <summary>
 /// 根据用户佣金创建佣金差集合
 /// </summary>
 /// <param name="userComm">The user comm.</param>
 /// <returns></returns>
 private IEnumerable<CommissionValue> BuildDefaultCommValueList(UserCommission userComm)
 {
     foreach (var companyType in CompanyTypeList)
         foreach (var gameType in GameTypeList)
             yield return new CommissionValue
             {
                 CommissionId = userComm.CommissionId,
                 CompanyType = companyType,
                 GameType = gameType
             };
 }
예제 #3
0
 /// <summary>
 /// 为用户添加默认的佣金差
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="species">The species.</param>
 public void AddDefaultUserCommission(User user, IEnumerable<LotterySpecies> species)
 {
     List<CommissionValue> commValueList = new List<CommissionValue>();
     foreach (var specie in species)
     {
         UserCommission userComm = new UserCommission
         {
             Specie = specie,
             UserId = user.UserId
         };
         DaUserComm.InsertUserCommission(userComm);
         commValueList.AddRange(BuildDefaultCommValueList(userComm));
     }
     //批量插入佣金差
     DaCommValue.InsertCommValues(commValueList);
 }