Пример #1
0
    /// <summary>
    ///当天注册会员前12名,免费送2元彩金,同一个支付宝账号只能领取一次。
    /// </summary>
    /// <param name="UserID"></param>
    private void Reward(long UserID, string AlipayName)
    {
        int AgentID = 1016;

        if (UserID < 1 || AlipayName == "")
        {
            return;
        }

        DataTable dt = Shove.Database.MSSQL.Select("select * from T_ActivitiesMytv365 where Convert(varchar(10), DateTime, 120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'", new Shove.Database.MSSQL.Parameter[0]);//new DAL.Tables.T_TomActivities().Open("", Condition, "");

        if (dt == null)
        {
            return;
        }

        DataRow[] dr = dt.Select("AlipayName = '" + AlipayName + "'");

        int a = 0;

        //无重复的,并且在前12
        if (dr.Length == 0 && dt.Rows.Count < 12)
        {
            string ReturnDescription = "";

            CardPassword cp = new CardPassword();

            long CardPasswordID = (long)cp.Add(AgentID, 1, 2, 1, ref ReturnDescription);

            if (CardPasswordID < 0)
            {
                new Log("System").Write("添加卡密失败。" + ReturnDescription + this.GetType().FullName + "(150)");

                return;
            }

            int i = cp.Use(cp.GenNumber(PF.GetCallCert(), AgentID, CardPasswordID), 1, UserID, ref ReturnDescription);

            if (i < 0)
            {
                new Log("System").Write("卡密使用失败。" + ReturnDescription + this.GetType().FullName + "(159)");

                return;
            }

            a = 1;

            string sql = "insert into T_ActivitiesMytv365 (IsReward1,UserID,AlipayName)values(" + a.ToString() + "," + UserID.ToString() + ",'" + AlipayName + "')";

            int result = Shove.Database.MSSQL.ExecuteNonQuery(sql, new Shove.Database.MSSQL.Parameter[0]);

            if (result < 0)
            {
                new Log("System").Write("写入 T_ActivitiesMytv365 失败。" + this.GetType().FullName + "(178)");

                return;
            }
        }
    }
Пример #2
0
    private void Reward(long UserID, string AlipayName)
    {
        int agentID = 0x3f8;

        if ((UserID >= 1L) && (AlipayName != ""))
        {
            DataTable table = MSSQL.Select("select * from T_ActivitiesMytv365 where Convert(varchar(10), DateTime, 120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'", new MSSQL.Parameter[0]);
            if (table != null)
            {
                DataRow[] rowArray = table.Select("AlipayName = '" + AlipayName + "'");
                int       num2     = 0;
                if ((rowArray.Length == 0) && (table.Rows.Count < 12))
                {
                    string       returnDescription = "";
                    CardPassword password          = new CardPassword();
                    long         cardPasswordID    = password.Add(agentID, 1, 2.0, 1, ref returnDescription);
                    if (cardPasswordID < 0L)
                    {
                        new Log("System").Write("添加卡密失败。" + returnDescription + base.GetType().FullName + "(150)");
                    }
                    else if (password.Use(password.GenNumber(PF.GetCallCert(), agentID, cardPasswordID), 1L, UserID, ref returnDescription) < 0)
                    {
                        new Log("System").Write("卡密使用失败。" + returnDescription + base.GetType().FullName + "(159)");
                    }
                    else
                    {
                        num2 = 1;
                        if (MSSQL.ExecuteNonQuery("insert into T_ActivitiesMytv365 (IsReward1,UserID,AlipayName)values(" + num2.ToString() + "," + UserID.ToString() + ",'" + AlipayName + "')", new MSSQL.Parameter[0]) < 0)
                        {
                            new Log("System").Write("写入 T_ActivitiesMytv365 失败。" + base.GetType().FullName + "(178)");
                        }
                    }
                }
            }
        }
    }
 private void Reward(long UserID, string AlipayName)
 {
     int agentID = 0x3f8;
     if ((UserID >= 1L) && (AlipayName != ""))
     {
         DataTable table = MSSQL.Select("select * from T_ActivitiesMytv365 where Convert(varchar(10), DateTime, 120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'", new MSSQL.Parameter[0]);
         if (table != null)
         {
             DataRow[] rowArray = table.Select("AlipayName = '" + AlipayName + "'");
             int num2 = 0;
             if ((rowArray.Length == 0) && (table.Rows.Count < 12))
             {
                 string returnDescription = "";
                 CardPassword password = new CardPassword();
                 long cardPasswordID = password.Add(agentID, 1, 2.0, 1, ref returnDescription);
                 if (cardPasswordID < 0L)
                 {
                     new Log("System").Write("添加卡密失败。" + returnDescription + base.GetType().FullName + "(150)");
                 }
                 else if (password.Use(password.GenNumber(PF.GetCallCert(), agentID, cardPasswordID), 1L, UserID, ref returnDescription) < 0)
                 {
                     new Log("System").Write("卡密使用失败。" + returnDescription + base.GetType().FullName + "(159)");
                 }
                 else
                 {
                     num2 = 1;
                     if (MSSQL.ExecuteNonQuery("insert into T_ActivitiesMytv365 (IsReward1,UserID,AlipayName)values(" + num2.ToString() + "," + UserID.ToString() + ",'" + AlipayName + "')", new MSSQL.Parameter[0]) < 0)
                     {
                         new Log("System").Write("写入 T_ActivitiesMytv365 失败。" + base.GetType().FullName + "(178)");
                     }
                 }
             }
         }
     }
 }