예제 #1
0
 /// <summary>
 /// 添加一天领卡记录
 /// </summary>
 /// <param name="cl">领卡记录</param>
 /// <returns>返回是否添加成功</returns>
 public Boolean AddCardLog(cardslog cl)
 {
     try
     {
         string         sql = "insert into cardslog(userid,cardid,cardsid)values (@UserId,@CardId,@CardsId)";
         SqlParameter[] sp  = new SqlParameter[]
         {
             new SqlParameter("@UserId", cl.userid),
             new SqlParameter("@CardId", cl.cardid),
             new SqlParameter("@CardsId", cl.cardsid)
         };
         return(db.ExecuteNonQuery(sql, sp));
     }
     catch (SqlException ex)
     {
         throw new Exception("数据库异常!原因:" + ex.Message);
     }
     catch (Exception ex)
     {
         throw new Exception("未知异常!原因:" + ex.Message);
     }
 }
예제 #2
0
        public string DoGetGift(int CardId, string CardNum)
        {
            cardsname cn = new cardsname();

            cn = cm.GetCard(CardId);
            g  = gm.GetGame(cn.gameid);
            if (cm.GetCardCount(CardId) < 1)
            {
                return("<span><b>温馨提示:</b><lable style=\"color:red\">该新手卡已经被抢空啦!</span>");
            }
            int UserId = BBRequest.GetUserId();

            if (UserId <= 0)
            {
                if (Utils.GetCookie("6qmgamesame") != "")
                {
                    string   value    = Utils.GetCookie("6qmgamesame");
                    string   UserName = DESEncrypt.DesDecrypt(value.Split('|')[0]);
                    string   PWD      = DESEncrypt.DesDecrypt(value.Split('|')[1]);
                    GameUser gu       = gum.GetGameUser(UserName, DESEncrypt.Md5(PWD, 32));
                    if (gu != null)
                    {
                        BBRequest.WriteUserId(gu.Id);
                        gum.UpdateLastLogin(gu.Id);
                        UserId = BBRequest.GetUserId();
                    }
                    else
                    {
                        return("<span><b>温馨提示:</b><lable style=\"color:red\">登录后才可领取!</lable></span>");
                    }
                }
                else
                {
                    return("<span><b>温馨提示:</b><lable style=\"color:red\">登录后才可领取!</lable></span>");
                }
            }
            if (CardNum == null)
            {
                if (cm.ExitCardLog(UserId, CardId))
                {
                    return("<span id=\"showno\" ><b>温馨提示:</b><lable style=\"color:red\">您已经领取过该新手卡啦!</span>");
                }
                else
                {
                    cards c = new cards();
                    c       = cm.GetCards(CardId);
                    CardNum = c.cardnum;
                    cardslog cl = new cardslog();
                    cl.userid  = UserId;
                    cl.cardid  = CardId;
                    cl.cardsid = c.id;
                    cm.AddCardLog(cl);
                    cm.UpdateCard(1, c.id);
                    sysmsg sysmsg1 = new sysmsg();
                    sysmsg1.msgid  = 0;
                    sysmsg1.title  = "新手卡信息:" + cn.cardname;
                    sysmsg1.type   = 2;
                    sysmsg1.userid = UserId;
                    sysmsg1.msg    = "领取新手卡成功!卡号:" + c.cardnum;
                    sysmsg1.fromid = 0;
                    new SysMsgManager().AddSysMsg(sysmsg1);
                    return("<span id=\"showno\" ><b>领取成功!激活码:</b> <label id=\"lblno\" style=\"color:red\"> " + CardNum + " </label></span>");
                }
            }
            else
            {
                return("<span id=\"showno\" ><b>领取成功!激活码:</b> <label id=\"lblno\" style=\"color:red\"> " + CardNum + " </label></span>");
            }
        }
예제 #3
0
 /// <summary>
 /// 添加一天领卡记录
 /// </summary>
 /// <param name="cl">领卡记录</param>
 /// <returns>返回是否添加成功</returns>
 public Boolean AddCardLog(cardslog cl)
 {
     return(cs.AddCardLog(cl));
 }