Beispiel #1
0
 /// <summary>
 /// 新增Card
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="cardName"></param>
 /// <param name="cardNum"></param>
 public void AddCard(int userID,string cardName, int cardNum)
 {
     UserXCard modelOld = Get(userID, cardName);
     bizCard bc = new bizCard();
     Card modelCard = bc.Get(cardName);
     if (modelOld == null)
     {
         UserXCard model = new UserXCard();
         model.UserID = userID;
         model.CardName = cardName;
         model.CardNum = cardNum;
         Add(model);
     }
     else
     {
         modelOld.Attach();
         modelOld.CardNum += cardNum;
         modelOld.Detach();
         Update(modelOld);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 新增Card
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="cardName"></param>
 /// <param name="cardNum"></param>
 public void AddCard(int userID,string userName,string adminName, string cardName, int cardNum)
 {
     UserXCard modelOld = Get(userID, cardName);
     bizCard bc=new bizCard();
     Card modelCard=bc.Get(cardName);
     if (modelOld == null)
     {
         UserXCard model = new UserXCard();
         model.UserID = userID;
         model.CardName = cardName;
         model.CardNum = cardNum;
         Add(model);
     }
     else
     {
         modelOld.Attach();
         modelOld.CardNum += cardNum;
         modelOld.Detach();
         Update(modelOld);
     }
     (new bizAdminLog()).Add("为" + userName + "加上道具" + modelCard.CardAlias + cardNum.ToString() + "张", userName, adminName);
     string msg = "管理员 [b]" + adminName + "[/b] 为您加上道具[color=red]" + modelCard.CardAlias + cardNum.ToString() + "张[/color],并祝您在论坛中玩得开心。";
     (new bizUserMsg()).AddSysMsg(userID, msg);
 }