示例#1
0
    public DataSet GetNumberInformation(int AgentID, string TimeStamp, string Sign, string Number)
    {
        new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumberInformation\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}", new object[] { AgentID, TimeStamp, Sign, Number }));
        DataSet returnDS = new DataSet();
        short   state    = 0;

        if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { Number }) >= 0)
        {
            int  agentID = -1;
            long num3    = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref agentID);
            if ((num3 < 0L) || (agentID != AgentID))
            {
                this.BuildReturnDataSetForError(-5, "卡号不存在", ref returnDS);
                return(returnDS);
            }
            DataTable table = new Tables.T_CardPasswords().Open("[DateTime], [Money], Period, State", string.Concat(new object[] { "AgentID = ", AgentID, " and [ID] = ", num3.ToString() }), "");
            if (table == null)
            {
                this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
                return(returnDS);
            }
            this.BuildReturnDataSet(0L, ref returnDS);
            returnDS.Tables.Add(table);
        }
        return(returnDS);
    }
示例#2
0
    public DataSet GetNumbers(int AgentID, string TimeStamp, string Sign, string StartTime, string EndTime)
    {
        StartTime = Utility.FilteSqlInfusion(StartTime);
        EndTime   = Utility.FilteSqlInfusion(EndTime);
        new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumbers\tAgentID={0}\tTimeStamp={1}\tSign={2}\tStartTime={3}\tEndTime={4}", new object[] { AgentID, TimeStamp, Sign, StartTime, EndTime }));
        DataSet returnDS = new DataSet();
        short   state    = 0;

        if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { StartTime, EndTime }) >= 0)
        {
            DataTable table = new Tables.T_CardPasswords().Open("[ID], [DateTime], [Money], State, Period", "AgentID = " + AgentID.ToString() + " and (DateTime between '" + StartTime + "' and '" + EndTime + "' )", "[ID]");
            if (table == null)
            {
                this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
                return(returnDS);
            }
            table.Columns.Add("Number", typeof(string));
            CardPassword password = new CardPassword();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                table.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table.Rows[i]["ID"].ToString(), -1L));
                table.AcceptChanges();
            }
            table.Columns.Remove(table.Columns[0]);
            this.BuildReturnDataSet(0L, ref returnDS);
            returnDS.Tables.Add(table);
        }
        return(returnDS);
    }
示例#3
0
    public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml)
    {
        new Log(@"Agent\CardPassword").Write(string.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", new object[] { AgentID, TimeStamp, Sign, CardsXml }));
        DataSet   ds    = new DataSet();
        short     state = 0;
        DataTable table = _Convert.XMLToDataTable(CardsXml);

        if ((table == null) || (table.Rows.Count < 1))
        {
            this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);
            return(ds);
        }
        if (this.Valid(ref ds, ref state, AgentID, TimeStamp, Sign, new object[] { CardsXml }) >= 0)
        {
            Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            CardsXml = "<Cards>";
            CardPassword password = new CardPassword();
            int          agentID  = -1;
            foreach (DataRow row in table.Rows)
            {
                string input = row["Number"].ToString();
                if (!regex.IsMatch(input))
                {
                    this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);
                    return(ds);
                }
                long num3 = password.GetCardPasswordID(PF.GetCallCert(), input, ref agentID);
                if ((num3 < 0L) || (agentID != AgentID))
                {
                    this.BuildReturnDataSetForError(-5, "卡号不存在", ref ds);
                    return(ds);
                }
                CardsXml = CardsXml + "<Card ID=\"" + num3.ToString() + "\" />";
            }
            CardsXml = CardsXml + "</Cards>";
            int    returnValue       = -1;
            string returnDescription = "";
            this.BuildReturnDataSet(0L, ref ds);
            if (Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref returnValue, ref returnDescription) < 0)
            {
                this.BuildReturnDataSetForError(-9999, "未知错误", ref ds);
                return(ds);
            }
            if (returnValue < 0)
            {
                this.BuildReturnDataSetForError(returnValue, returnDescription, ref ds);
                return(ds);
            }
            DataTable table2 = ds.Tables[1];
            table2.Columns.Add("Number", typeof(string));
            for (int i = 0; i < table2.Rows.Count; i++)
            {
                table2.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table2.Rows[i]["ID"].ToString(), -1L));
                table2.AcceptChanges();
            }
            table2.Columns.Remove(table2.Columns[0]);
        }
        return(ds);
    }
示例#4
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;
            }
        }
    }
示例#5
0
 public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml)
 {
     new Log(@"Agent\CardPassword").Write(string.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", new object[] { AgentID, TimeStamp, Sign, CardsXml }));
     DataSet ds = new DataSet();
     short state = 0;
     DataTable table = _Convert.XMLToDataTable(CardsXml);
     if ((table == null) || (table.Rows.Count < 1))
     {
         this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);
         return ds;
     }
     if (this.Valid(ref ds, ref state, AgentID, TimeStamp, Sign, new object[] { CardsXml }) >= 0)
     {
         Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
         CardsXml = "<Cards>";
         CardPassword password = new CardPassword();
         int agentID = -1;
         foreach (DataRow row in table.Rows)
         {
             string input = row["Number"].ToString();
             if (!regex.IsMatch(input))
             {
                 this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);
                 return ds;
             }
             long num3 = password.GetCardPasswordID(PF.GetCallCert(), input, ref agentID);
             if ((num3 < 0L) || (agentID != AgentID))
             {
                 this.BuildReturnDataSetForError(-5, "卡号不存在", ref ds);
                 return ds;
             }
             CardsXml = CardsXml + "<Card ID=\"" + num3.ToString() + "\" />";
         }
         CardsXml = CardsXml + "</Cards>";
         int returnValue = -1;
         string returnDescription = "";
         this.BuildReturnDataSet(0L, ref ds);
         if (Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref returnValue, ref returnDescription) < 0)
         {
             this.BuildReturnDataSetForError(-9999, "未知错误", ref ds);
             return ds;
         }
         if (returnValue < 0)
         {
             this.BuildReturnDataSetForError(returnValue, returnDescription, ref ds);
             return ds;
         }
         DataTable table2 = ds.Tables[1];
         table2.Columns.Add("Number", typeof(string));
         for (int i = 0; i < table2.Rows.Count; i++)
         {
             table2.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table2.Rows[i]["ID"].ToString(), -1L));
             table2.AcceptChanges();
         }
         table2.Columns.Remove(table2.Columns[0]);
     }
     return ds;
 }
示例#6
0
    public DataSet SetPeriod(int AgentID, string TimeStamp, string Sign, string Number, string Period)
    {
        new Log(@"Agent\CardPassword").Write(string.Format("Method=SetPeriod\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}\tPeriod={4}", new object[] { AgentID, TimeStamp, Sign, Number, Period }));
        DataSet returnDS = new DataSet();
        short   state    = 0;

        if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { Number, Period }) >= 0)
        {
            DateTime time;
            try
            {
                time = DateTime.Parse(Period);
            }
            catch
            {
                this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref returnDS);
                return(returnDS);
            }
            long cardPasswordID = 0L;
            int  agentID        = -1;
            cardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref agentID);
            if ((cardPasswordID < 0L) || (agentID != AgentID))
            {
                this.BuildReturnDataSetForError(-5, "卡号不存在", ref returnDS);
                return(returnDS);
            }
            int    returnValue       = -1;
            string returnDescription = "";
            if (Procedures.P_CardPasswordSetPeriod(AgentID, cardPasswordID, time, ref returnValue, ref returnDescription) < 0)
            {
                this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
                return(returnDS);
            }
            if (returnValue < 0)
            {
                this.BuildReturnDataSetForError(returnValue, returnDescription, ref returnDS);
                return(returnDS);
            }
            this.BuildReturnDataSet(0L, ref returnDS);
            returnDS.Tables.Add(new DataTable());
        }
        return(returnDS);
    }
示例#7
0
    public DataSet GetNumbers(int AgentID, string TimeStamp, string Sign, string StartTime, string EndTime)
    {
        StartTime = Shove._Web.Utility.FilteSqlInfusion(StartTime);
        EndTime   = Shove._Web.Utility.FilteSqlInfusion(EndTime);

        new Log("Agent\\CardPassword").Write(String.Format("Method=GetNumbers\tAgentID={0}\tTimeStamp={1}\tSign={2}\tStartTime={3}\tEndTime={4}", AgentID, TimeStamp, Sign, StartTime, EndTime));

        DataSet ds    = new DataSet();
        short   State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, StartTime, EndTime) < 0)
        {
            return(ds);
        }

        DataTable dt = new DAL.Tables.T_CardPasswords().Open("[ID], [DateTime], [Money], State, Period", "AgentID = " + AgentID.ToString() + " and (DateTime between '" + StartTime + "' and '" + EndTime + "' )", "[ID]");

        if (dt == null)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return(ds);
        }

        dt.Columns.Add("Number", typeof(System.String));

        CardPassword cp = new CardPassword();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1));

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(dt);

        return(ds);
    }
示例#8
0
    public DataSet GetNumberInformation(int AgentID, string TimeStamp, string Sign, string Number)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=GetNumberInformation\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}", AgentID, TimeStamp, Sign, Number));

        DataSet ds    = new DataSet();
        short   State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, Number) < 0)
        {
            return(ds);
        }

        int  _AgentID       = -1;
        long CardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

        if ((CardPasswordID < 0) || (_AgentID != AgentID))
        {
            BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

            return(ds);
        }

        DataTable dt = new DAL.Tables.T_CardPasswords().Open("[DateTime], [Money], Period, State", "AgentID = " + AgentID + " and [ID] = " + CardPasswordID.ToString(), "");

        if (dt == null)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return(ds);
        }

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(dt);

        return(ds);
    }
示例#9
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)");
                        }
                    }
                }
            }
        }
    }
示例#10
0
 public DataSet SetPeriod(int AgentID, string TimeStamp, string Sign, string Number, string Period)
 {
     new Log(@"Agent\CardPassword").Write(string.Format("Method=SetPeriod\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}\tPeriod={4}", new object[] { AgentID, TimeStamp, Sign, Number, Period }));
     DataSet returnDS = new DataSet();
     short state = 0;
     if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { Number, Period }) >= 0)
     {
         DateTime time;
         try
         {
             time = DateTime.Parse(Period);
         }
         catch
         {
             this.BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref returnDS);
             return returnDS;
         }
         long cardPasswordID = 0L;
         int agentID = -1;
         cardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref agentID);
         if ((cardPasswordID < 0L) || (agentID != AgentID))
         {
             this.BuildReturnDataSetForError(-5, "卡号不存在", ref returnDS);
             return returnDS;
         }
         int returnValue = -1;
         string returnDescription = "";
         if (Procedures.P_CardPasswordSetPeriod(AgentID, cardPasswordID, time, ref returnValue, ref returnDescription) < 0)
         {
             this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
             return returnDS;
         }
         if (returnValue < 0)
         {
             this.BuildReturnDataSetForError(returnValue, returnDescription, ref returnDS);
             return returnDS;
         }
         this.BuildReturnDataSet(0L, ref returnDS);
         returnDS.Tables.Add(new DataTable());
     }
     return returnDS;
 }
示例#11
0
文件: Gateway.cs 项目: ichari/ichari
    public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", AgentID, TimeStamp, Sign, CardsXml));

        DataSet ds = new DataSet();
        short State = 0;

        DataTable dtCardsXml = Shove._Convert.XMLToDataTable(CardsXml);

        if ((dtCardsXml == null) || (dtCardsXml.Rows.Count < 1))
        {
            BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

            return ds;
        }

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, CardsXml) < 0)
        {
            return ds;
        }

        Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

        CardsXml = "<Cards>";

        CardPassword cp = new CardPassword();
        int _AgentID = -1;

        foreach (DataRow dr in dtCardsXml.Rows)
        {
            string Number = dr["Number"].ToString();

            if (!regex.IsMatch(Number))
            {
                BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

                return ds;
            }

            long CardPasswordID = cp.GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

            if ((CardPasswordID < 0) || (_AgentID != AgentID))
            {
                BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

                return ds;
            }

            CardsXml += "<Card ID=\"" + CardPasswordID.ToString() + "\" />";
        }

        CardsXml += "</Cards>";

        int ReturnValue = -1;
        string ReturnDescription = "";

        BuildReturnDataSet(0, ref ds);


        int Results = -1;
        Results = DAL.Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref ReturnValue, ref ReturnDescription);
        if (Results < 0)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return ds;
        }

        if (ReturnValue < 0)
        {
            BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds);

            return ds;
        }

        // 置换ID为卡号
        DataTable dt = ds.Tables[1];
        dt.Columns.Add("Number", typeof(string));

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1));

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        return ds;
    }
示例#12
0
 public DataSet GetNumbers(int AgentID, string TimeStamp, string Sign, string StartTime, string EndTime)
 {
     StartTime = Utility.FilteSqlInfusion(StartTime);
     EndTime = Utility.FilteSqlInfusion(EndTime);
     new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumbers\tAgentID={0}\tTimeStamp={1}\tSign={2}\tStartTime={3}\tEndTime={4}", new object[] { AgentID, TimeStamp, Sign, StartTime, EndTime }));
     DataSet returnDS = new DataSet();
     short state = 0;
     if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { StartTime, EndTime }) >= 0)
     {
         DataTable table = new Tables.T_CardPasswords().Open("[ID], [DateTime], [Money], State, Period", "AgentID = " + AgentID.ToString() + " and (DateTime between '" + StartTime + "' and '" + EndTime + "' )", "[ID]");
         if (table == null)
         {
             this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
             return returnDS;
         }
         table.Columns.Add("Number", typeof(string));
         CardPassword password = new CardPassword();
         for (int i = 0; i < table.Rows.Count; i++)
         {
             table.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table.Rows[i]["ID"].ToString(), -1L));
             table.AcceptChanges();
         }
         table.Columns.Remove(table.Columns[0]);
         this.BuildReturnDataSet(0L, ref returnDS);
         returnDS.Tables.Add(table);
     }
     return returnDS;
 }
示例#13
0
文件: Gateway.cs 项目: ichari/ichari
    public DataSet GetNumberInformation(int AgentID, string TimeStamp, string Sign, string Number)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=GetNumberInformation\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}", AgentID, TimeStamp, Sign, Number));

        DataSet ds = new DataSet();
        short State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, Number) < 0)
        {
            return ds;
        }

        int _AgentID = -1;
        long CardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

        if ((CardPasswordID < 0) || (_AgentID != AgentID))
        {
            BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

            return ds;
        }

        DataTable dt = new DAL.Tables.T_CardPasswords().Open("[DateTime], [Money], Period, State", "AgentID = " + AgentID + " and [ID] = " + CardPasswordID.ToString(), "");

        if (dt == null)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return ds;
        }

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(dt);

        return ds;
    }
示例#14
0
文件: Gateway.cs 项目: ichari/ichari
    public DataSet SetPeriod(int AgentID, string TimeStamp, string Sign, string Number, string Period)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=SetPeriod\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}\tPeriod={4}", AgentID, TimeStamp, Sign, Number, Period));

        DataSet ds = new DataSet();
        short State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, Number, Period) < 0)
        {
            return ds;
        }

        //if (Period < DateTime.Now)
        //{
        //    BuildReturnDataSetForError(-7, "失效时间不能小于当前时间", ref ds);

        //    return ds;
        //}

        DateTime t_Period;

        try
        {
            t_Period = DateTime.Parse(Period);
        }
        catch
        {
            BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

            return ds;
        }

        long CardPasswordID = 0;
        int _AgentID = -1;

        CardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

        if ((CardPasswordID < 0) || (_AgentID != AgentID))
        {
            BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

            return ds;
        }

        int ReturnValue = -1;
        string ReturnDescription = "";

        int Results = -1;
        Results = DAL.Procedures.P_CardPasswordSetPeriod(AgentID, CardPasswordID, t_Period, ref ReturnValue, ref ReturnDescription);

        if (Results < 0)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return ds;
        }

        if (ReturnValue < 0)
        {
            BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds);

            return ds;
        }

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(new DataTable());

        return ds;
    }
示例#15
0
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryExpiredCardPassword_" + _CardPasswordAgentUser.ID.ToString());

        if (dt == null)
        {
            string Condition = "AgentID = " + _CardPasswordAgentUser.ID.ToString() + "  and State = -1 ";

            if (tbCardPasswordID.Text.Trim() != "")
            {
                int _AgentID = -1;
                Condition += " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Shove._Web.Utility.FilteSqlInfusion(tbCardPasswordID.Text.Trim()), ref _AgentID).ToString();
            }

            if (tbDateTime.Text.Trim() != "")
            {
                DateTime dtFrom = DateTime.Parse("1981-01-01");

                try
                {
                    dtFrom = DateTime.Parse(tbDateTime.Text.Trim());
                }
                catch
                {
                    Shove._Web.JavaScript.Alert(this.Page, "时间格式填写有错误!");

                    return;
                }

                Condition += " and DateTime > '" + dtFrom.ToString() + "'";
            }

            dt = new DAL.Tables.T_CardPasswords().Open("ID, DateTime, Money, Period, State", Condition, "");

            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "CardPassword_QueryExpiredCardPassword");

                return;
            }

            Shove._Web.Cache.SetCache("CardPassword_QueryExpiredCardPassword_" + _CardPasswordAgentUser.ID.ToString(), dt);
        }

        dt.Columns.Add("Number", typeof(System.String));

        CardPassword cp = new CardPassword();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = "[" + cp.GenNumber(PF.GetCallCert(), _CardPasswordAgentUser.ID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1)) + "]";

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        string FileName = "T_CardPassword.xls";

        HttpResponse response = Page.Response;

        response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
        Response.ContentType     = "application/ms-excel";
        response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");

        foreach (DataColumn dc in dt.Columns)
        {
            response.Write(dc.ColumnName + "\t");
        }

        response.Write("\n");

        foreach (DataRow dr in dt.Rows)
        {
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                response.Write(dr[i].ToString() + "\t");
            }

            response.Write("\n");
        }

        response.End();
    }
示例#16
0
文件: Gateway.cs 项目: ichari/ichari
    public DataSet GetNumbers(int AgentID, string TimeStamp, string Sign, string StartTime, string EndTime)
    {
        StartTime = Shove._Web.Utility.FilteSqlInfusion(StartTime);
        EndTime = Shove._Web.Utility.FilteSqlInfusion(EndTime);

        new Log("Agent\\CardPassword").Write(String.Format("Method=GetNumbers\tAgentID={0}\tTimeStamp={1}\tSign={2}\tStartTime={3}\tEndTime={4}", AgentID, TimeStamp, Sign, StartTime, EndTime));

        DataSet ds = new DataSet();
        short State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, StartTime, EndTime) < 0)
        {
            return ds;
        }

        DataTable dt = new DAL.Tables.T_CardPasswords().Open("[ID], [DateTime], [Money], State, Period", "AgentID = " + AgentID.ToString() + " and (DateTime between '" + StartTime + "' and '" + EndTime + "' )", "[ID]");

        if (dt == null)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return ds;
        }

        dt.Columns.Add("Number", typeof(System.String));

        CardPassword cp = new CardPassword();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1));

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(dt);

        return ds;
    }
示例#17
0
    public DataSet SetPeriod(int AgentID, string TimeStamp, string Sign, string Number, string Period)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=SetPeriod\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}\tPeriod={4}", AgentID, TimeStamp, Sign, Number, Period));

        DataSet ds    = new DataSet();
        short   State = 0;

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, Number, Period) < 0)
        {
            return(ds);
        }

        //if (Period < DateTime.Now)
        //{
        //    BuildReturnDataSetForError(-7, "失效时间不能小于当前时间", ref ds);

        //    return ds;
        //}

        DateTime t_Period;

        try
        {
            t_Period = DateTime.Parse(Period);
        }
        catch
        {
            BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

            return(ds);
        }

        long CardPasswordID = 0;
        int  _AgentID       = -1;

        CardPasswordID = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

        if ((CardPasswordID < 0) || (_AgentID != AgentID))
        {
            BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

            return(ds);
        }

        int    ReturnValue       = -1;
        string ReturnDescription = "";

        int Results = -1;

        Results = DAL.Procedures.P_CardPasswordSetPeriod(AgentID, CardPasswordID, t_Period, ref ReturnValue, ref ReturnDescription);

        if (Results < 0)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return(ds);
        }

        if (ReturnValue < 0)
        {
            BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds);

            return(ds);
        }

        BuildReturnDataSet(0, ref ds);
        ds.Tables.Add(new DataTable());

        return(ds);
    }
示例#18
0
    public DataSet Exchange(int AgentID, string TimeStamp, string Sign, string CardsXml)
    {
        new Log("Agent\\CardPassword").Write(String.Format("Method=Exchange\tAgentID={0}\tTimeStamp={1}\tSign={2}\tCardsXml={3}", AgentID, TimeStamp, Sign, CardsXml));

        DataSet ds    = new DataSet();
        short   State = 0;

        DataTable dtCardsXml = Shove._Convert.XMLToDataTable(CardsXml);

        if ((dtCardsXml == null) || (dtCardsXml.Rows.Count < 1))
        {
            BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

            return(ds);
        }

        if (Valid(ref ds, ref State, AgentID, TimeStamp, Sign, CardsXml) < 0)
        {
            return(ds);
        }

        Regex regex = new Regex(@"^[\d]{20}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

        CardsXml = "<Cards>";

        CardPassword cp       = new CardPassword();
        int          _AgentID = -1;

        foreach (DataRow dr in dtCardsXml.Rows)
        {
            string Number = dr["Number"].ToString();

            if (!regex.IsMatch(Number))
            {
                BuildReturnDataSetForError(-8, "参数不符合规定或者未提供", ref ds);

                return(ds);
            }

            long CardPasswordID = cp.GetCardPasswordID(PF.GetCallCert(), Number, ref _AgentID);

            if ((CardPasswordID < 0) || (_AgentID != AgentID))
            {
                BuildReturnDataSetForError(-5, "卡号不存在", ref ds);

                return(ds);
            }

            CardsXml += "<Card ID=\"" + CardPasswordID.ToString() + "\" />";
        }

        CardsXml += "</Cards>";

        int    ReturnValue       = -1;
        string ReturnDescription = "";

        BuildReturnDataSet(0, ref ds);


        int Results = -1;

        Results = DAL.Procedures.P_CardPasswordExchange(ref ds, AgentID, CardsXml, ref ReturnValue, ref ReturnDescription);
        if (Results < 0)
        {
            BuildReturnDataSetForError(-9999, "未知错误", ref ds);

            return(ds);
        }

        if (ReturnValue < 0)
        {
            BuildReturnDataSetForError(ReturnValue, ReturnDescription, ref ds);

            return(ds);
        }

        // 置换ID为卡号
        DataTable dt = ds.Tables[1];

        dt.Columns.Add("Number", typeof(string));

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = cp.GenNumber(PF.GetCallCert(), AgentID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1));

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        return(ds);
    }
 protected void btnExcel_Click(object sender, EventArgs e)
 {
     DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString());
     if (cacheAsDataTable == null)
     {
         string condition = "AgentID = " + base._CardPasswordAgentUser.ID.ToString();
         if (this.tbCardPasswordID.Text.Trim() != "")
         {
             int agentID = -1;
             condition = condition + " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Utility.FilteSqlInfusion(this.tbCardPasswordID.Text.Trim()), ref agentID).ToString();
         }
         if (this.tbDateTime.Text.Trim() != "")
         {
             DateTime time = DateTime.Parse("1981-01-01");
             try
             {
                 time = DateTime.Parse(this.tbDateTime.Text.Trim());
             }
             catch
             {
                 JavaScript.Alert(this.Page, "时间格式填写有错误!");
                 return;
             }
             condition = condition + " and DateTime > '" + time.ToString() + "'";
         }
         cacheAsDataTable = new Tables.T_CardPasswords().Open("ID, Money, Period, State", condition, "");
         if (cacheAsDataTable == null)
         {
             PF.GoError(4, "数据库繁忙,请重试", "CardPassword_QueryCardPassword");
             return;
         }
         Shove._Web.Cache.SetCache("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString(), cacheAsDataTable);
     }
     cacheAsDataTable.Columns.Add("Number", typeof(string));
     CardPassword password = new CardPassword();
     for (int i = 0; i < cacheAsDataTable.Rows.Count; i++)
     {
         cacheAsDataTable.Rows[i]["Number"] = "[" + password.GenNumber(PF.GetCallCert(), base._CardPasswordAgentUser.ID, _Convert.StrToLong(cacheAsDataTable.Rows[i]["ID"].ToString(), -1L)) + "]";
         cacheAsDataTable.AcceptChanges();
     }
     cacheAsDataTable.Columns.Remove(cacheAsDataTable.Columns[0]);
     string str2 = "T_CardPassword.xls";
     HttpResponse response = this.Page.Response;
     response.AppendHeader("Content-Disposition", "attachment;filename=" + str2);
     base.Response.ContentType = "application/ms-excel";
     response.ContentEncoding = Encoding.GetEncoding("gb2312");
     foreach (DataColumn column in cacheAsDataTable.Columns)
     {
         response.Write(column.ColumnName + "\t");
     }
     response.Write("\n");
     foreach (DataRow row in cacheAsDataTable.Rows)
     {
         for (int j = 0; j < cacheAsDataTable.Columns.Count; j++)
         {
             response.Write(row[j].ToString() + "\t");
         }
         response.Write("\n");
     }
     response.End();
 }
示例#20
0
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryUseCardPassword_" + _CardPasswordAgentUser.ID.ToString());

        if (dt == null)
        {
            string Condition = "AgentID = " + _CardPasswordAgentUser.ID.ToString() + " and State = 1";

            if (tbCardPasswordID.Text.Trim() != "")
            {
                int _AgentID = -1;
                Condition += " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Shove._Web.Utility.FilteSqlInfusion(tbCardPasswordID.Text.Trim()), ref _AgentID).ToString();
            }

            if (tbDateTime.Text.Trim() != "")
            {
                DateTime dtFrom = DateTime.Parse("1981-01-01");

                try
                {
                    dtFrom = DateTime.Parse(tbDateTime.Text.Trim());
                }
                catch
                {
                    Shove._Web.JavaScript.Alert(this.Page, "时间格式填写有错误!");

                    return;
                }

                Condition += " and UseDateTime > '" + dtFrom.ToString() + "'";
            }

            dt = new DAL.Views.V_CardPasswordDetails().Open("ID, Money, UseDateTime, RealityName", Condition, "");

            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "CardPassword_QueryUseCardPassword");

                return;
            }

            Shove._Web.Cache.SetCache("CardPassword_QueryUseCardPassword_" + _CardPasswordAgentUser.ID.ToString(), dt);
        }

        dt.Columns.Add("Number", typeof(System.String));

        CardPassword cp = new CardPassword();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Number"] = "[" + cp.GenNumber(PF.GetCallCert(), _CardPasswordAgentUser.ID, Shove._Convert.StrToLong(dt.Rows[i]["ID"].ToString(), -1)) + "]";

            dt.AcceptChanges();
        }

        dt.Columns.Remove(dt.Columns[0]);

        string FileName = "T_CardPassword.xls";

        HttpResponse response = Page.Response;

        response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);
        Response.ContentType = "application/ms-excel";
        response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");

        foreach (DataColumn dc in dt.Columns)
        {
            response.Write(dc.ColumnName + "\t");
        }

        response.Write("\n");

        foreach (DataRow dr in dt.Rows)
        {
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                response.Write(dr[i].ToString() + "\t");
            }

            response.Write("\n");
        }

        response.End();

    }
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString());

        if (cacheAsDataTable == null)
        {
            string condition = "AgentID = " + base._CardPasswordAgentUser.ID.ToString();
            if (this.tbCardPasswordID.Text.Trim() != "")
            {
                int agentID = -1;
                condition = condition + " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Utility.FilteSqlInfusion(this.tbCardPasswordID.Text.Trim()), ref agentID).ToString();
            }
            if (this.tbDateTime.Text.Trim() != "")
            {
                DateTime time = DateTime.Parse("1981-01-01");
                try
                {
                    time = DateTime.Parse(this.tbDateTime.Text.Trim());
                }
                catch
                {
                    JavaScript.Alert(this.Page, "时间格式填写有错误!");
                    return;
                }
                condition = condition + " and DateTime > '" + time.ToString() + "'";
            }
            cacheAsDataTable = new Tables.T_CardPasswords().Open("ID, Money, Period, State", condition, "");
            if (cacheAsDataTable == null)
            {
                PF.GoError(4, "数据库繁忙,请重试", "CardPassword_QueryCardPassword");
                return;
            }
            Shove._Web.Cache.SetCache("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString(), cacheAsDataTable);
        }
        cacheAsDataTable.Columns.Add("Number", typeof(string));
        CardPassword password = new CardPassword();

        for (int i = 0; i < cacheAsDataTable.Rows.Count; i++)
        {
            cacheAsDataTable.Rows[i]["Number"] = "[" + password.GenNumber(PF.GetCallCert(), base._CardPasswordAgentUser.ID, _Convert.StrToLong(cacheAsDataTable.Rows[i]["ID"].ToString(), -1L)) + "]";
            cacheAsDataTable.AcceptChanges();
        }
        cacheAsDataTable.Columns.Remove(cacheAsDataTable.Columns[0]);
        string       str2     = "T_CardPassword.xls";
        HttpResponse response = this.Page.Response;

        response.AppendHeader("Content-Disposition", "attachment;filename=" + str2);
        base.Response.ContentType = "application/ms-excel";
        response.ContentEncoding  = Encoding.GetEncoding("gb2312");
        foreach (DataColumn column in cacheAsDataTable.Columns)
        {
            response.Write(column.ColumnName + "\t");
        }
        response.Write("\n");
        foreach (DataRow row in cacheAsDataTable.Rows)
        {
            for (int j = 0; j < cacheAsDataTable.Columns.Count; j++)
            {
                response.Write(row[j].ToString() + "\t");
            }
            response.Write("\n");
        }
        response.End();
    }
示例#22
0
 public DataSet GetNumberInformation(int AgentID, string TimeStamp, string Sign, string Number)
 {
     new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumberInformation\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}", new object[] { AgentID, TimeStamp, Sign, Number }));
     DataSet returnDS = new DataSet();
     short state = 0;
     if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { Number }) >= 0)
     {
         int agentID = -1;
         long num3 = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref agentID);
         if ((num3 < 0L) || (agentID != AgentID))
         {
             this.BuildReturnDataSetForError(-5, "卡号不存在", ref returnDS);
             return returnDS;
         }
         DataTable table = new Tables.T_CardPasswords().Open("[DateTime], [Money], Period, State", string.Concat(new object[] { "AgentID = ", AgentID, " and [ID] = ", num3.ToString() }), "");
         if (table == null)
         {
             this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS);
             return returnDS;
         }
         this.BuildReturnDataSet(0L, ref returnDS);
         returnDS.Tables.Add(table);
     }
     return returnDS;
 }
 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)");
                     }
                 }
             }
         }
     }
 }