Exemplo n.º 1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dataBaseEngineType">数据库引擎类型</param>
 /// <param name="recordYear">统计年份</param>
 /// <param name="dbName">数据库名称</param>
 /// <param name="showLogo">是否显示区划树上图标</param>
 public RegionTreeControl(MSSQL.DataModel.DataBaseEngineType dataBaseEngineType, int recordYear, string dbName, bool showLogo =false)
 {
     InitializeComponent();
     _recordYear = recordYear;
     _showLogo = showLogo;
     MSSQL.Tools.DBName = dbName;
     MSSQL.Tools.DataBaseType = dataBaseEngineType;
     try
     {
         analysisTypeComboBox.ItemsSource = new List<string>
             {
                 "统计",
                 "采集",
                 "区划"
             };
         Load(1, false);
         analysisTypeComboBox.SelectedIndex = 0;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
Exemplo n.º 2
0
    public int InsertModel(long UserID, string PlayType, string Name, string Content, string Descption, string TypeName)
    {
        int Result = MSSQL.ExecuteNonQuery("insert into T_Model values (" + UserID + ", '" + Name + "', '" + PlayType + "', '" + Content + "', '" + Descption + "', '" + TypeName + "')");

        return(Result);
    }
    public string this[string Manner, string NotificationType]
    {
        get
        {
            if ((Site == null) || (Site.ID < 1))
            {
                throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量");
            }

            if ((Manner != "SMS") && (Manner != "Email") && (Manner != "StationSMS"))
            {
                throw new Exception("SiteNotificationTemplates 类的通知方式 Manner 变量的值超出的范围,它的范围是:1 (SMS)手机短信 2 Email 3 (StationSMS)站内信");
            }

            string    SystemPreFix  = "SiteOptions_";
            DataTable dt            = null;
            bool      InApplication = true;

            try
            {
                dt = (DataTable)System.Web.HttpContext.Current.Application[SystemPreFix + this.Site.ID.ToString()];
            }
            catch { }

            if ((dt == null) || (dt.Rows.Count < 1))
            {
                InApplication = false;

                dt = new DAL.Tables.T_Sites().Open("", "[ID] = " + Site.ID.ToString(), "");
            }

            if (dt == null)
            {
                throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置");
            }

            if (dt.Rows.Count < 1)
            {
                throw new Exception("SiteNotificationTemplates 类的 Site 变量值不在有效范围之内");
            }

            if (!InApplication)
            {
                try
                {
                    System.Web.HttpContext.Current.Application.Lock();
                    System.Web.HttpContext.Current.Application.Add(SystemPreFix + this.Site.ID.ToString(), dt);
                }
                catch { }
                finally
                {
                    try
                    {
                        System.Web.HttpContext.Current.Application.UnLock();
                    }
                    catch { }
                }
            }

            string Result = dt.Rows[0]["Template" + Manner + "_" + NotificationType].ToString().Replace("[SiteName]", Site.Name).Replace("[SiteUrl]", Site.Url);

            return(Result);
        }
        set
        {
            if ((Site == null) || (Site.ID < 1))
            {
                throw new Exception("没有初始化 SiteNotificationTemplates 类的 Site 变量");
            }

            string sql    = @"update T_Sites set [Template" + Manner + "_" + NotificationType + "] = @Value where [ID]=@ID";
            int    Result = MSSQL.ExecuteNonQuery(sql,
                                                  new MSSQL.Parameter("Value", SqlDbType.VarChar, 0, ParameterDirection.Input, value),
                                                  new MSSQL.Parameter("ID", SqlDbType.BigInt, 0, ParameterDirection.Input, Site.ID));
            if (Result < 0)
            {
                throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置。如果数据库连接设置没有问题,可能是 NotificationType 变量的值不在有效范围之内");
            }
            //if (DAL.Procedures.P_SetSiteNotificationTemplate(Site.ID, iManner, NotificationType, value) < 0)
            //{
            //    throw new Exception("SiteNotificationTemplates 类读取数据错误,请检查数据库连接设置。如果数据库连接设置没有问题,可能是 NotificationType 变量的值不在有效范围之内");
            //}

            string SystemPreFix = "SiteOptions_";

            try
            {
                System.Web.HttpContext.Current.Application.Lock();
                System.Web.HttpContext.Current.Application.Remove(SystemPreFix + this.Site.ID.ToString());
            }
            catch { }
            finally
            {
                try
                {
                    System.Web.HttpContext.Current.Application.UnLock();
                }
                catch { }
            }
        }
    }
Exemplo n.º 4
0
    private int P_Win(SqlConnection conn, ref DataSet ds, long IsuseID, string WinLotteryNumber, string OpenAffiche, long OpenOperatorID, bool isEndTheIsuse, ref int SchemeCount, ref int QuashCount, ref int WinCount, ref int WinNoBuyCount, ref bool isEndOpen, ref int ReturnValue, ref string ReturnDescription)
    {
        MSSQL.OutputParameter Outputs = new MSSQL.OutputParameter();

        int CallResult = MSSQL.ExecuteStoredProcedureWithQuery(conn, "P_Win", ref ds, ref Outputs,
                                                               new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, IsuseID),
                                                               new MSSQL.Parameter("WinLotteryNumber", SqlDbType.VarChar, 0, ParameterDirection.Input, WinLotteryNumber),
                                                               new MSSQL.Parameter("OpenAffiche", SqlDbType.VarChar, 0, ParameterDirection.Input, OpenAffiche),
                                                               new MSSQL.Parameter("OpenOperatorID", SqlDbType.BigInt, 0, ParameterDirection.Input, OpenOperatorID),
                                                               new MSSQL.Parameter("isEndTheIsuse", SqlDbType.Bit, 0, ParameterDirection.Input, isEndTheIsuse),
                                                               new MSSQL.Parameter("SchemeCount", SqlDbType.Int, 4, ParameterDirection.Output, SchemeCount),
                                                               new MSSQL.Parameter("QuashCount", SqlDbType.Int, 4, ParameterDirection.Output, QuashCount),
                                                               new MSSQL.Parameter("WinCount", SqlDbType.Int, 4, ParameterDirection.Output, WinCount),
                                                               new MSSQL.Parameter("WinNoBuyCount", SqlDbType.Int, 4, ParameterDirection.Output, WinNoBuyCount),
                                                               new MSSQL.Parameter("isEndOpen", SqlDbType.Bit, 0, ParameterDirection.Output, isEndOpen),
                                                               new MSSQL.Parameter("ReturnValue", SqlDbType.Int, 4, ParameterDirection.Output, ReturnValue),
                                                               new MSSQL.Parameter("ReturnDescription", SqlDbType.VarChar, 100, ParameterDirection.Output, ReturnDescription)
                                                               );

        try
        {
            SchemeCount = System.Convert.ToInt32(Outputs["SchemeCount"]);
        }
        catch { }

        try
        {
            QuashCount = System.Convert.ToInt32(Outputs["QuashCount"]);
        }
        catch { }

        try
        {
            WinCount = System.Convert.ToInt32(Outputs["WinCount"]);
        }
        catch { }

        try
        {
            WinNoBuyCount = System.Convert.ToInt32(Outputs["WinNoBuyCount"]);
        }
        catch { }

        try
        {
            isEndOpen = System.Convert.ToBoolean(Outputs["isEndOpen"]);
        }
        catch { }

        try
        {
            ReturnValue = System.Convert.ToInt32(Outputs["ReturnValue"]);
        }
        catch { }

        try
        {
            ReturnDescription = System.Convert.ToString(Outputs["ReturnDescription"]);
        }
        catch { }

        return(CallResult);
    }
Exemplo n.º 5
0
    private void BindData()
    {
        if (this.listIsuse.Items.Count >= 1)
        {
            int num = 1;
            try
            {
                num = int.Parse(this.ViewState["Admin_SchemeList_Type"].ToString());
            }
            catch
            {
                num = 1;
            }
            if ((num < 1) || (num > 7))
            {
                PF.GoError(1, "参数错误", "Admin_SchemeList");
            }
            else
            {
                DataTable dt  = null;
                string    str = " SiteID = " + base._Site.ID.ToString() + " and IsuseID = " + this.listIsuse.SelectedValue;
                if (this.ddlUser.Enabled && (int.Parse(this.ddlUser.SelectedValue) >= 0))
                {
                    str = str + " and BuyOperatorID = " + this.ddlUser.SelectedValue;
                }
                switch (num)
                {
                case 1:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " order by  [DateTime] desc", new MSSQL.Parameter[0]);
                    break;

                case 2:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and Buyed=1 order by [Money] desc", new MSSQL.Parameter[0]);
                    break;

                case 3:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and Buyed=0 order by [DateTime] desc", new MSSQL.Parameter[0]);
                    break;

                case 4:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and QuashStatus<>0 order by [DateTime] desc", new MSSQL.Parameter[0]);
                    break;

                case 5:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and QuashStatus = 2 order by [DateTime] desc", new MSSQL.Parameter[0]);
                    break;

                case 6:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and WinMoney > 0 and Buyed=1 order by [DateTime] desc", new MSSQL.Parameter[0]);
                    break;

                case 7:
                    dt = MSSQL.Select("select * from V_SchemeSchedulesWithQuashed with (nolock) where " + str + " and WinMoney > 0 and Buyed=0 order by [DateTime] desc", new MSSQL.Parameter[0]);
                    break;
                }
                if (dt == null)
                {
                    PF.GoError(4, "数据库繁忙,请重试", "Admin_SchemeList");
                }
                else
                {
                    PF.DataGridBindData(this.g, dt, this.gPager);
                }
            }
        }
    }
Exemplo n.º 6
0
    protected void btnGO_Click(object sender, EventArgs e)
    {
        string SchemeNumber = Shove._Web.Utility.FilteSqlInfusion(tbSchemeNumber.Text.Trim());

        if (SchemeNumber == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入方案号。");

            return;
        }

        DataTable dt = new DAL.Tables.T_Schemes().Open("", "SchemeNumber='" + SchemeNumber + "'", "");

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

            return;
        }

        if (dt.Rows.Count < 1)
        {
            Shove._Web.JavaScript.Alert(this.Page, "方案号不存在。");

            return;
        }

        DataRow dr = dt.Rows[0];

        if (!Shove._Convert.StrToBool(dr["Buyed"].ToString(), false))
        {
            Shove._Web.JavaScript.Alert(this.Page, "该方案号没有出票。");

            return;
        }

        if (Shove._IO.File.UploadFile(this.Page, fileImage, "../Temp/", "SchemeWinImage" + SchemeNumber + ".jpg", true, "image") < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "文件上传错误。");

            return;
        }

        string FileName = this.Server.MapPath("../Temp/SchemeWinImage" + SchemeNumber + ".jpg");

        byte[] Data = System.IO.File.ReadAllBytes(FileName);

        System.IO.File.Delete(FileName);

        if (Data == null)
        {
            Shove._Web.JavaScript.Alert(this.Page, "文件格式错误。");

            return;
        }

        MSSQL.ExecuteNonQuery("update T_Schemes set WinImage = @p1 where [SchemeNumber] = @p2",
                              new MSSQL.Parameter("p1", SqlDbType.VarChar, 0, ParameterDirection.Input, Data),
                              new MSSQL.Parameter("p2", SqlDbType.VarChar, 0, ParameterDirection.Input, SchemeNumber));

        Shove._Web.JavaScript.Alert(this.Page, "文件上传成功!");
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql = @"
SELECT [Amount]
      ,[Commision]
      ,[Code]
      ,[PaymentDate]
      ,[SenderID]
      ,[ReceiverID]
      ,[LocationID]
,TID
  FROM [tmp].[dbo].[KoromStar]
";

            DataSet ds   = MSSQL.SQLExec(sql);
            string  text = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                decimal amount = 0;
                decimal fee    = 0;
                try
                {
                    amount = decimal.Parse(dr["Amount"].ToString().Replace("$", "").Replace(",", "").Trim());
                }
                catch (Exception ex)
                {
                    amount = 0;
                }

                try
                {
                    fee = decimal.Parse(dr["Commision"].ToString().Replace("$", "").Replace(",", "").Trim());
                }
                catch (Exception ex)
                {
                    fee = 0;
                }

                text = @"
INSERT INTO [KoromstarDB].[dbo].[TRANS]
           ([CUSTID]
           ,[RECEIVERID]
           ,[LOCATIONID]
           ,[TRANSDT]
           ,[TRANSAMOUNT]
           ,[TRANSFEES]
           ,[TRANSOTHERFEES]
           ,[CAUSETRANSOTHERFEES]
           ,[TRANSPROMOCODE]
           ,[TRANSPROMO]
           ,[TRANSTOTALAMOUNT]
           ,[FLAG_SM_RECEIVER]
           ,[SM_RECEIVER]
           ,[FLAG_CALL_RECEIVER]
           ,[RECEIVERPHONENO]
           ,[FLAG_DD]
           ,[FLAG_TESTQUESTION]
           ,[TESTQUESTION]
           ,[TESTANSWER]
           ,[FLAG_CALLSENDER]
           ,[FLAG_SMSSENDER]
           ,[FLAG_EMAILSENDER]
           ,[SENDEREMAILADDRESS]
           ,[TRANSSTATUS]
           ,[TRANSRECEIVEDID]
           ,[TRANSRECEIVEDATE]
           ,[CREATEDBY]
           ,[CREATEDON]
           ,[UPDATEDBY]
           ,[UPDATEDON]
           ,[AGENTID]
           ,[REFCODE])
     VALUES
           (" + dr["SenderID"].ToString() + @"--<CUSTID, int,>
           ," + dr["ReceiverID"].ToString() + @"--<RECEIVERID, int,>
           ," + dr["LocationID"].ToString() + @"--<LOCATIONID, int,>
           ,'" + dr["PaymentDate"].ToString().Split('/')[2] + "-" + dr["PaymentDate"].ToString().Split('/')[0] + "-" + dr["PaymentDate"].ToString().Split('/')[1] + @"'--<TRANSDT, datetime,>
           ," + amount + @"--<TRANSAMOUNT, decimal(10,2),>
           ," + fee + @"--<TRANSFEES, decimal(10,2),>
           ,0
           ,''
           ,''--<TRANSPROMOCODE, varchar(20),>
           ,0--<TRANSPROMO, int,>
           ," + (amount + fee) + @"--<TRANSTOTALAMOUNT, decimal(10,2),>
           ,'N'--<FLAG_SM_RECEIVER, char(1),>
           ,''--<SM_RECEIVER, varchar(50),>
           ,'N'--<FLAG_CALL_RECEIVER, char(1),>
           ,''--<RECEIVERPHONENO, varchar(20),>
           ,'N'--<FLAG_DD, char(1),>
           ,'N'--<FLAG_TESTQUESTION, char(1),>
           ,''--<TESTQUESTION, varchar(100),>
           ,''--<TESTANSWER, varchar(100),>
           ,'N'--<FLAG_CALLSENDER, char(1),>
           ,'N'--<FLAG_SMSSENDER, char(1),>
           ,'N'--<FLAG_EMAILSENDER, char(1),>
           ,''--<SENDEREMAILADDRESS, varchar(50),>
           ,'PENDING'--<TRANSSTATUS, varchar(20),>
           ,''--<TRANSRECEIVEDID, varchar(20),>
           ,GETDATE()--<TRANSRECEIVEDATE, datetime,>
           ,1--<CREATEDBY, int,>
           ,GETDATE()--<CREATEDON, datetime,>
           ,1--<UPDATEDBY, int,>
           ,GETDATE()--<UPDATEDON, datetime,>
           ,4--<AGENTID, int,>
           ,'" + dr["Code"].ToString().Trim() + @"'--<REFCODE, varchar(10),>
           );

Declare @ID int
set @ID=(Select SCOPE_IDENTITY());

update [tmp].[dbo].[KoromStar] set TRNID=@ID
where TID=" + dr["TID"].ToString() + @"
";

                MSSQL.SQLExec(text);
            }

            // TextBox1.Text = text;
        }
    }
Exemplo n.º 8
0
    private void BindFollowList()
    {
        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable("FollowList");

        if (dt == null)
        {
            string strCmd = "select top 10 t1.FollowUserID,t1.FollowCount,t2.Name,(select LotteryID from (select top 1 LotteryID,sum(DetailMoney) as DetailMoney from V_BuyDetails as s where s.UserID=t2.ID group by LotteryID order by DetailMoney desc) as W) as LotteryID from (select COUNT(FollowUserID) as FollowCount,FollowUserID from T_CustomFriendFollowSchemes group by FollowUserID) as t1 inner join T_Users as t2 on t1.FollowUserID=t2.ID order by  t1.FollowCount desc";
            dt = MSSQL.Select(strCmd);

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

                return;
            }

            if (dt.Rows.Count > 0)
            {
                Shove._Web.Cache.SetCache("FollowList", dt, 60);
            }
        }

        StringBuilder sb = new StringBuilder();

        if (dt.Rows.Count == 0)
        {
            sb.AppendLine("<tr>")
            .AppendLine("<td height=\"20\" colspan=\"3\" align=\"center\" class=\"blue12\">")
            .AppendLine("暂无数据")
            .AppendLine("</td>")
            .AppendLine("</tr>");
        }
        else
        {
            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                int lotteryid = 0;
                if (Shove._Convert.StrToInt(dr["LotteryID"] == null ? "" : dr["LotteryID"].ToString(), 0) == 0)
                {
                    lotteryid = 5;
                }
                else
                {
                    lotteryid = Shove._Convert.StrToInt(Shove._Web.Utility.FilteSqlInfusion(dr["LotteryID"].ToString()), 0);
                }
                string    UserName  = dr["Name"].ToString();
                string    url       = "";
                string    sql       = "SELECT TOP 1 ID FROM dbo.V_Schemes with (nolock) WHERE SiteID =@SiteID AND InitiateUserID = @InitiateUserID AND QuashStatus = 0 AND isOpened = 0 ORDER BY Money desc,Schedule desc,  CONVERT(Datetime,[Datetime]) desc ";
                DataTable dtSchemes = MSSQL.Select(sql,
                                                   new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID),
                                                   new MSSQL.Parameter("InitiateUserID", SqlDbType.Int, 0, ParameterDirection.Input, Shove._Web.Utility.FilteSqlInfusion(dr["FollowUserID"].ToString())));
                if (dtSchemes != null && dtSchemes.Rows.Count > 0)
                {
                    if (dtSchemes.Rows.Count == 1)
                    {
                        url = "<a href='" + Shove._Web.Utility.GetUrl() + "/Home/Room/Scheme.aspx?id=" + dtSchemes.Rows[0]["ID"].ToString() + "' target='_blank'>查看</a>";
                    }
                }
                i++;
                sb.AppendLine("<tr>")
                .Append("<td width=\"8%\" height=\"28\" align=\"center\" bgcolor=\"#FFFFFF\" class=\"blue12\">")
                .Append("<img src=\"images/num_" + i.ToString() + ".gif\" width=\"13\" height=\"13\" />")
                .AppendLine("</td>")
                .Append("<td width=\"30%\" height=\"28\" align=\"center\" bgcolor=\"#FFFFFF\" class=\"blue12\" title='" + UserName + "'>")
                .Append("<a href='..\\Web\\Score.aspx?id=")
                .Append(dr["FollowUserID"].ToString())
                .Append("&LotteryID=" + lotteryid.ToString() + "' target='_blank'>")
                //.Append(Shove._String.Cut(UserName, 4))
                .Append(UserName)
                .Append("</a>")
                .AppendLine("</td>")
                .Append("<td width=\"11%\"  bgcolor=\"#FFFFFF\" align=\"center\" class=\"blue12\">");
                sb.Append(dr["FollowCount"].ToString())
                .AppendLine("</td>")
                .Append("<td width=\"22%\"  bgcolor=\"#FFFFFF\" class=\"red12_2\" align='center'>");

                sql = "Select SUM(DetailMoney) AS DetailMoney From T_BuyDetails b " +
                      "Left Join T_CustomFriendFollowSchemes c on b.UserID = c.UserID " +
                      "Left Join T_Schemes s on b.SchemeID = s.ID " +
                      "where s.InitiateUserID = @UserID and c.FollowUserID = @UserID";
                DataTable dtTotalFollowMoney = MSSQL.Select(sql,
                                                            new MSSQL.Parameter("UserID", SqlDbType.BigInt, 0, ParameterDirection.Input, Shove._Web.Utility.FilteSqlInfusion(dr["FollowUserID"].ToString())));
                if (dtTotalFollowMoney != null && dtTotalFollowMoney.Rows.Count > 0)
                {
                    sb.Append(Shove._Convert.StrToDouble(dtTotalFollowMoney.Rows[0]["DetailMoney"].ToString(), 0).ToString("N0"));
                }
                sb.AppendLine("</td>")
                .Append("<td width=\"20%\" height=\"28\" align=\"center\" bgcolor=\"#FFFFFF\" class=\"blue12\">");
                if (url != "")
                {
                    sb.Append(url);
                }
                else
                {
                    sb.Append("无");
                }
                sb.Append("</td>")
                .Append("<td width=\"9%\"  bgcolor=\"#FFFFFF\" class=\"red12_2\" align='center'>");
                sb.Append("<a  href='FollowFriendSchemeAdd.aspx?Source=1&FollowUserID=" + dr["FollowUserID"].ToString() + "&FollowUserName="******"&LotteryID=-1'>定制</a>")
                .AppendLine("</td>")
                .AppendLine("</tr>");
            }
        }

        tbFollowList.InnerHtml += sb.ToString();
    }
Exemplo n.º 9
0
    private void BindData(string lot, string P2, string P3)
    {
        if (string.IsNullOrEmpty(P2))
        {
            P2 = "2";
        }

        if (string.IsNullOrEmpty(P3))
        {
            P3 = DateTime.Now.ToString();
        }

        DateTime SerachDatetime = Shove._Convert.StrToDateTime(P3, DateTime.Now.ToString());

        int Year  = SerachDatetime.Year;
        int Month = SerachDatetime.Month;

        int Week = (int)SerachDatetime.DayOfWeek;

        DateTime StartDateTime = SerachDatetime.AddDays(Week * -1);
        DateTime EndDateTime   = SerachDatetime.AddDays(7 - Week);

        StringBuilder strSQL = new StringBuilder();

        strSQL.Append("select top 20 ROW_NUMBER() OVER (order by SUM(WinMoney) desc) AS id, COUNT(SchemeID) as SchemeCount, Name, SUM(DetailMoney) as DetailMoney, InitiateUserID, SUM(WinMoney) as WinMoney from (");
        strSQL.Append(" select SchemeID, SUM(DetailMoney) as DetailMoney, InitiateUserID, WinMoney, Name  from (");
        strSQL.Append(" select T_BuyDetails.ID, T_BuyDetails.SchemeID, T_BuyDetails.DetailMoney, a.InitiateUserID, a.WinMoney, T_Users.Name from T_BuyDetails");
        strSQL.Append(" inner join(");
        strSQL.Append(" select InitiateUserID, id, WinMoney from T_Schemes where Buyed = 1 and Share > 1 and WinMoney > 0 and exists (");

        if (LotteryID != 72 && LotteryID != 73)
        {
            if (P2 == "1")
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + " and EndTime between '" + StartDateTime.ToString() + "' and '" + EndDateTime.ToString() + "' and T_Schemes.IsuseID = T_Isuses.ID))");
                lbtitle.Text = Year.ToString() + "年" + StartDateTime.ToShortDateString() + " ~ " + EndDateTime.ToShortDateString() + LotteryName + "-发起盈利排行榜";
            }
            else if (P2 == "2")
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + " and " + Year.ToString() + " * 100 + " + Month.ToString() + " = year(EndTime) * 100 + MONTH(EndTime) and T_Schemes.IsuseID = T_Isuses.ID))");
                lbtitle.Text = Year.ToString() + "年" + Month.ToString().PadLeft(2, '0') + "月" + LotteryName + "-发起盈利排行榜";
            }
            else
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + " and " + Year.ToString() + " = year(EndTime) and T_Schemes.IsuseID = T_Isuses.ID))");
                lbtitle.Text = Year.ToString() + "年" + LotteryName + "-发起盈利排行榜";
            }
        }
        else
        {
            if (P2 == "1")
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + " and T_Schemes.IsuseID = T_Isuses.ID) and [Datetime] between '" + StartDateTime.ToString() + "' and '" + EndDateTime.ToString() + "')");
                lbtitle.Text = Year.ToString() + "年" + StartDateTime.ToShortDateString() + " ~ " + EndDateTime.ToShortDateString() + LotteryName + "-发起盈利排行榜";
            }
            else if (P2 == "2")
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + "  and T_Schemes.IsuseID = T_Isuses.ID) and " + Year.ToString() + " * 100 + " + Month.ToString() + " = year([Datetime]) * 100 + MONTH([Datetime]))");
                lbtitle.Text = Year.ToString() + "年" + Month.ToString().PadLeft(2, '0') + "月" + LotteryName + "-发起盈利排行榜";
            }
            else
            {
                strSQL.Append(" select 1 from T_Isuses where LotteryID = " + LotteryID.ToString() + " and T_Schemes.IsuseID = T_Isuses.ID) and " + Year.ToString() + " = year([Datetime]) )");
                lbtitle.Text = Year.ToString() + "年" + LotteryName + "-发起盈利排行榜";
            }
        }

        strSQL.Append(" a on T_BuyDetails.SchemeID = a.ID");
        strSQL.Append(" inner join T_Users on a.InitiateUserID = T_Users.ID");
        strSQL.Append(" and T_BuyDetails.QuashStatus = 0) b group by b.schemeID, b.InitiateUserID, b.WinMoney, b.Name) c group by InitiateUserID, Name");

        DataTable dt = MSSQL.Select(strSQL.ToString());

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

            return;
        }

        StringBuilder sb = new StringBuilder();

        sb.Append("<tr>");
        sb.Append("<td class=\"td_t01\">排名</td>");
        sb.Append("<td class=\"td_t01\">发起人</td>");
        sb.Append("<td class=\"td_t01\">方案个数</td>");
        sb.Append("<td class=\"td_t01\">方案总金额</td>");
        sb.Append("<td class=\"td_t01\">中奖总金额</td>");
        sb.Append("<td class=\"td_t01\">方案盈利</td>");
        sb.Append("<td class=\"td_t01\">自动跟单</td>");
        sb.Append("</tr>");

        foreach (DataRow dr in dt.Rows)
        {
            sb.Append("<tr class=\"bg_01\" onmouseover='this.className=\"bg_03\";this.style.cursor=\"pointer\";' onmouseout='this.className=\"bg_01\";this.style.cursor=\"none\";'>");
            sb.Append("<td height=\"20\" class=\"bg_01\">").Append(dr["id"].ToString()).Append("</td>");
            sb.Append("<td class=\"bg_01\"><span style=\"text-decoration: underline; cursor: pointer\" onclick=\"ShowMedal('" + dr["InitiateUserID"].ToString() + "','" + LotteryID.ToString() + "','')\">" + dr["Name"].ToString() + "</span></td>");
            sb.Append("<td class=\"bg_01\">" + dr["SchemeCount"].ToString() + "</td>");
            sb.Append("<td>¥" + dr["DetailMoney"].ToString() + "</td>");
            sb.Append("<td>¥" + dr["WinMoney"].ToString() + "</td>");
            sb.Append("<td>¥" + (Shove._Convert.StrToFloat(dr["DetailMoney"].ToString(), 0) - Shove._Convert.StrToFloat(dr["WinMoney"].ToString(), 0)).ToString() + "</td>");

            string dinZhi = "<a href='/Home/Room/FollowFriendSchemeAdd_User.aspx?FollowUserID=" + dr["InitiateUserID"].ToString() + "&FollowUserName="******"Name"].ToString()) + "&LotteryID=" + LotteryID.ToString() + "' onclick=\"return parent.CreateLogin();\" target=\"_blank\" >";

            sb.Append("<td class=\"bg_01\">" + dinZhi + "定制</a></td>");
            sb.Append("</tr>");
        }

        lbMatch.Text = sb.ToString();
    }
        private void SetResult()
        {
            if (LB_Table.SelectedItem != null && CB_TYPE.SelectedItem != null)
            {
                string entityName = LB_Table.SelectedItem.ToString();
                string rtnType    = CB_TYPE.SelectedItem.ToString(); //Void,ReturnValue,List<T>
                string roleType   = CB_Role.SelectedItem.ToString(); //Select,Update,Insert,Delete,Save
                bool   IsTran     = IsTransaction.Checked;

                StringBuilder builder = new StringBuilder(200);

                if (!String.IsNullOrWhiteSpace(entityName))
                {
                    List <DbTableInfo> tableinfos = new List <DbTableInfo>();
                    IDbQuery           query      = new MSSQL();

                    using (var conn = new SqlConnection(this.ConnectionString))
                        using (var cmd = new SqlCommand(query.TableInfo(entityName), conn))
                        {
                            conn.Open();
                            using (var adp = new SqlDataAdapter(cmd))
                            {
                                DataTable dt = new DataTable();
                                adp.Fill(dt);
                                if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
                                {
                                    tableinfos = dt.DataToEntity <DbTableInfo>();
                                }
                            }
                            conn.Close();
                        }

                    if (tableinfos != null && tableinfos.Count > 0)
                    {
                        var identityColumn = tableinfos.Where(x => x.is_identity).FirstOrDefault();

                        if (identityColumn != null)
                        {
                            builder.AppendLine($"CREATE PROCEDURE [dbo].[ESP_{entityName}_{roleType}]");
                            builder.AppendLine("(");
                            int num = 0;
                            foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false).OrderBy(x => x.is_nullable))
                            {
                                switch (info.ColumnType.ToLower())
                                {
                                case "date":
                                case "datetime":
                                case "datetime2":
                                case "smalldatetime":
                                    break;

                                default:
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    builder.AppendLine($"	@{info.ColumnName}					{this.ColumnTypeString(info)}");
                                    num++;
                                    break;
                                }
                            }
                            if (tableinfos.Where(x => x.is_identity == false).Count() > 0)
                            {
                                builder.Append(",");
                            }
                            builder.AppendLine($"	@{identityColumn.ColumnName}					{identityColumn.ColumnType}     = -1");
                            if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                            {
                                builder.AppendLine(",	@Code					bigint				output");
                                builder.AppendLine(",	@Value					varchar(100)		output");
                                builder.AppendLine(",	@Msg					nvarchar(100)		output");
                            }
                            builder.AppendLine(")");
                            builder.AppendLine("AS");
                            builder.AppendLine("");
                            builder.AppendLine("SET NOCOUNT ON");
                            builder.AppendLine("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
                            builder.AppendLine("");
                            builder.AppendLine("Declare @Err int");
                            builder.AppendLine("SET @Err = 0");
                            builder.AppendLine("");
                            if (IsTran)
                            {
                                builder.AppendLine("BEGIN TRAN");
                            }
                            if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                            {
                                builder.AppendLine("SET @Code = 0");
                                builder.AppendLine("SET @Value = ''");
                                builder.AppendLine("SET @Msg = ''");
                                builder.AppendLine("");

                                builder.AppendLine("BEGIN TRY");
                            }
                            //BODY
                            switch (roleType.ToUpper())
                            {
                            case "SELECT":
                                builder.AppendLine($"select * from [{entityName}]");
                                break;

                            case "UPDATE":
                                builder.AppendLine($"update [{entityName}] set ");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    switch (info.ColumnType.ToLower())
                                    {
                                    case "date":
                                    case "datetime":
                                    case "datetime2":
                                    case "smalldatetime":
                                        builder.AppendLine($"[{info.ColumnName}] = getdate()");
                                        break;

                                    default:
                                        builder.AppendLine($"[{info.ColumnName}] = @{info.ColumnName}");
                                        break;
                                    }
                                    num++;
                                }
                                builder.AppendLine(" where ");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(" and ");
                                    }
                                    builder.AppendLine($"{info.ColumnName} = @{info.ColumnName}");
                                    num++;
                                }
                                builder.AppendLine("");
                                builder.AppendLine("SET @Err = @Err + @@Error");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("");
                                    builder.AppendLine("IF IsNull(@Err,0) = 0");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = @{identityColumn.ColumnName}");
                                    builder.AppendLine("    END");
                                    builder.AppendLine("ELSE");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = -1");
                                    builder.AppendLine($"        SET @Msg = '수정하지 못했습니다.'");
                                    builder.AppendLine("    END");
                                }
                                break;

                            case "INSERT":
                                builder.AppendLine($"insert into [{entityName}] (");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    builder.AppendLine($"[{info.ColumnName}]");
                                    num++;
                                }
                                builder.AppendLine(") values (");

                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    switch (info.ColumnType.ToLower())
                                    {
                                    case "date":
                                    case "datetime":
                                    case "datetime2":
                                    case "smalldatetime":
                                        builder.AppendLine("getdate()");
                                        break;

                                    default:
                                        builder.AppendLine($"@{info.ColumnName}");
                                        break;
                                    }
                                    num++;
                                }
                                builder.AppendLine(")");
                                builder.AppendLine("");
                                builder.AppendLine("SET @Err = @Err + @@Error");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("");
                                    builder.AppendLine("IF IsNull(@Err,0) = 0");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = @IDENTITY");
                                    builder.AppendLine("    END");
                                    builder.AppendLine("ELSE");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = -1");
                                    builder.AppendLine($"        SET @Msg = '저장하지 못했습니다.'");
                                    builder.AppendLine("    END");
                                }
                                break;

                            case "DELETE":
                                builder.AppendLine($"delete from [{entityName}]");
                                if (tableinfos.Where(x => x.is_identity).Count() > 0)
                                {
                                    builder.AppendLine(" where ");
                                    num = 0;
                                    foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity))
                                    {
                                        if (num > 0)
                                        {
                                            builder.Append(" and ");
                                        }
                                        builder.AppendLine($"[{info.ColumnName}] = @{info.ColumnName}");
                                        num++;
                                    }
                                }
                                builder.AppendLine("");
                                builder.AppendLine("SET @Err = @Err + @@Error");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("");
                                    builder.AppendLine("IF IsNull(@Err,0) = 0");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = @{identityColumn.ColumnName}");
                                    builder.AppendLine("    END");
                                    builder.AppendLine("ELSE");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = -1");
                                    builder.AppendLine($"        SET @Msg = '삭제하지 못했습니다.'");
                                    builder.AppendLine("    END");
                                }
                                break;

                            case "SAVE":
                                builder.AppendLine($"IF Exists(select [{identityColumn.ColumnName}] from [{entityName}] where [{identityColumn.ColumnName}] = @{identityColumn.ColumnName})");
                                builder.AppendLine("	BEGIN");
                                builder.AppendLine($"update [{entityName}] set ");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    switch (info.ColumnType.ToLower())
                                    {
                                    case "date":
                                    case "datetime":
                                    case "datetime2":
                                    case "smalldatetime":
                                        builder.AppendLine($"[{info.ColumnName}] = getdate()");
                                        break;

                                    default:
                                        builder.AppendLine($"[{info.ColumnName}] = @{info.ColumnName}");
                                        break;
                                    }
                                    num++;
                                }
                                builder.AppendLine(" where ");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(" and ");
                                    }
                                    builder.AppendLine($"[{info.ColumnName}] = @{info.ColumnName}");
                                    num++;
                                }
                                builder.AppendLine("");
                                builder.AppendLine("SET @Err = @Err + @@Error");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("");
                                    builder.AppendLine("IF IsNull(@Err,0) = 0");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = @{identityColumn.ColumnName}");
                                    builder.AppendLine("    END");
                                    builder.AppendLine("ELSE");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = -1");
                                    builder.AppendLine($"        SET @Msg = '수정하지 못했습니다.'");
                                    builder.AppendLine("    END");
                                }
                                builder.AppendLine("	END");
                                builder.AppendLine("ELSE");
                                builder.AppendLine("	BEGIN");
                                builder.AppendLine($"insert into [{entityName}] (");
                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    builder.AppendLine($"[{info.ColumnName}]");
                                    num++;
                                }
                                builder.AppendLine(") values (");

                                num = 0;
                                foreach (DbTableInfo info in tableinfos.Where(x => x.is_identity == false))
                                {
                                    if (num > 0)
                                    {
                                        builder.Append(",");
                                    }
                                    switch (info.ColumnType.ToLower())
                                    {
                                    case "date":
                                    case "datetime":
                                    case "datetime2":
                                    case "smalldatetime":
                                        builder.AppendLine("getdate()");
                                        break;

                                    default:
                                        builder.AppendLine($"@{info.ColumnName}");
                                        break;
                                    }
                                    num++;
                                }
                                builder.AppendLine(")");
                                builder.AppendLine("");
                                builder.AppendLine("SET @Err = @Err + @@Error");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("");
                                    builder.AppendLine("IF IsNull(@Err,0) = 0");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = @{identityColumn.ColumnName}");
                                    builder.AppendLine("    END");
                                    builder.AppendLine("ELSE");
                                    builder.AppendLine("    BEGIN");
                                    builder.AppendLine($"        SET @Code = -1");
                                    builder.AppendLine($"        SET @Msg = '삭제하지 못했습니다.'");
                                    builder.AppendLine("    END");
                                }
                                builder.AppendLine("	END");
                                builder.AppendLine("");
                                break;
                            }

                            //END BODY
                            if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                            {
                                builder.AppendLine("END TRY");
                                builder.AppendLine("BEGIN CATCH");
                                builder.AppendLine("    SET @Code = -1");
                                builder.AppendLine("    SET @Err = @Err + 1");
                                builder.AppendLine("    SET @Msg = ERROR_MESSAGE()");
                                builder.AppendLine("END CATCH");
                            }

                            if (IsTran)
                            {
                                builder.AppendLine("");
                                builder.AppendLine("IF IsNull(@Err,0) = 0");
                                builder.AppendLine("    BEGIN");
                                builder.AppendLine("        COMMIT TRAN");
                                builder.AppendLine("    END");
                                builder.AppendLine("ELSE");
                                builder.AppendLine("    BEGIN");
                                builder.AppendLine("        ROLLBACK TRAN");
                                if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                                {
                                    builder.AppendLine("        SET @Code = -1");
                                    builder.AppendLine("        SET @Msg = '처리하지 못했습니다.'");
                                }
                                builder.AppendLine("    END");
                            }
                        }
                        else
                        {
                            builder.AppendLine("<< Identity Column is not Found >>");
                        }
                    }

                    TB_Result.Text = builder.ToString();
                }
            }
        }
Exemplo n.º 11
0
 public static string F_GetBankTypeName(short BankTypeID)
 {
     return(Convert.ToString(MSSQL.ExecuteFunction("F_GetBankTypeName", new MSSQL.Parameter[] { new MSSQL.Parameter("BankTypeID", SqlDbType.SmallInt, 0, ParameterDirection.Input, BankTypeID) })));
 }
Exemplo n.º 12
0
 public static string F_DateTimeToYYMMDDHHMMSS(DateTime Dt)
 {
     return(Convert.ToString(MSSQL.ExecuteFunction("F_DateTimeToYYMMDDHHMMSS", new MSSQL.Parameter[] { new MSSQL.Parameter("Dt", SqlDbType.DateTime, 0, ParameterDirection.Input, Dt) })));
 }
Exemplo n.º 13
0
 public static double F_CurrentMonthMemberRecWebSitePayMoney(long SiteID, long UserID, DateTime CurrentDate, int type)
 {
     return(Convert.ToDouble(MSSQL.ExecuteFunction("F_CurrentMonthMemberRecWebSitePayMoney", new MSSQL.Parameter[] { new MSSQL.Parameter("SiteID", SqlDbType.BigInt, 0, ParameterDirection.Input, SiteID), new MSSQL.Parameter("UserID", SqlDbType.BigInt, 0, ParameterDirection.Input, UserID), new MSSQL.Parameter("CurrentDate", SqlDbType.DateTime, 0, ParameterDirection.Input, CurrentDate), new MSSQL.Parameter("type", SqlDbType.Int, 0, ParameterDirection.Input, type) })));
 }
Exemplo n.º 14
0
 public static int F_AccumulateMember(long SiteID, long UserID, DateTime StartTime, DateTime EndTime, int type)
 {
     return(Convert.ToInt32(MSSQL.ExecuteFunction("F_AccumulateMember", new MSSQL.Parameter[] { new MSSQL.Parameter("SiteID", SqlDbType.BigInt, 0, ParameterDirection.Input, SiteID), new MSSQL.Parameter("UserID", SqlDbType.BigInt, 0, ParameterDirection.Input, UserID), new MSSQL.Parameter("StartTime", SqlDbType.DateTime, 0, ParameterDirection.Input, StartTime), new MSSQL.Parameter("EndTime", SqlDbType.DateTime, 0, ParameterDirection.Input, EndTime), new MSSQL.Parameter("type", SqlDbType.Int, 0, ParameterDirection.Input, type) })));
 }
Exemplo n.º 15
0
 public static int F_CurrentDateRegPayMember(long SiteID, long UserID, DateTime CurrentDate, int type)
 {
     return(Convert.ToInt32(MSSQL.ExecuteFunction("F_CurrentDateRegPayMember", new MSSQL.Parameter[] { new MSSQL.Parameter("SiteID", SqlDbType.BigInt, 0, ParameterDirection.Input, SiteID), new MSSQL.Parameter("UserID", SqlDbType.BigInt, 0, ParameterDirection.Input, UserID), new MSSQL.Parameter("CurrentDate", SqlDbType.DateTime, 0, ParameterDirection.Input, CurrentDate), new MSSQL.Parameter("type", SqlDbType.Int, 0, ParameterDirection.Input, type) })));
 }
Exemplo n.º 16
0
        private static List <GUIDMACVersionIP> GetActiveHosts()
        {
            MSSQL                   ms    = new MSSQL();
            List <String>           ips   = ms.GetIPs();
            int                     max   = ips.Count;
            List <GUIDMACVersionIP> gmvis = new List <GUIDMACVersionIP>();

            IPPS = new List <IPPlusStatus>();

            List <Thread> threads = new List <Thread>();

            foreach (String ip in ips)
            {
                Thread th = new Thread(() => HostScan.run(ip, 25567));
                th.Start();
                threads.Add(th);
            }

            foreach (Thread th in threads)
            {
                th.Join();
            }

            //The response of every ping
            for (int i = 0; i <= count; i++)
            {
                try
                {
                    IPPlusStatus iss = IPPS[i];

                    if (iss.Status == KnownHost.STATE_ONLINE)
                    {
                        IMClient iMC = new IMClient();
                        iMC.setConnParams(iss.IP, 25567);

                        iMC.SetupConn();
                        string guid = iMC.RequestParam(IMClient.IM_GetIdentity);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string version = iMC.RequestParam(IMClient.IM_GetVersion);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string mac = iMC.RequestParam(IMClient.IM_GetMAC);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string hostname = iMC.RequestParam(IMClient.IM_GetHostname);

                        GUIDMACVersionIP gmvi = new GUIDMACVersionIP
                        {
                            GUID     = guid,
                            IP       = iss.IP,
                            MAC      = mac,
                            Version  = version,
                            Hostname = hostname
                        };
                        gmvis.Add(gmvi);
                    }
                }
                catch (Exception)
                {
                }
            }
            return(gmvis);
        }
Exemplo n.º 17
0
        private void SetResult()
        {
            if (LB_SP.SelectedItem != null && CB_TYPE.SelectedItem != null)
            {
                string        spName    = LB_SP.SelectedItem.ToString();
                string        rtnType   = CB_TYPE.SelectedItem.ToString(); //Void,ReturnValue,List<T>
                bool          IsConnect = IsConnection.Checked;
                StringBuilder builder   = new StringBuilder(200);

                if (!String.IsNullOrWhiteSpace(spName))
                {
                    List <SPInfo> spinfos = new List <SPInfo>();
                    IDbQuery      query   = new MSSQL();

                    using (var conn = new SqlConnection(this.ConnectionString))
                        using (var cmd = new SqlCommand(query.SPInfo(spName), conn))
                        {
                            conn.Open();
                            using (var adp = new SqlDataAdapter(cmd))
                            {
                                DataTable dt = new DataTable();
                                adp.Fill(dt);
                                if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
                                {
                                    spinfos = dt.DataToEntity <SPInfo>();
                                }
                            }
                            conn.Close();
                        }

                    if (IsConnect)
                    {
                        builder.AppendLine("using (var SqlConn = new SqlConnection(\"\"))");
                    }
                    builder.AppendLine($"using (var cmd = new SqlCommand(\"{spName}\", SqlConn))");
                    builder.AppendLine("{");
                    builder.AppendLine("cmd.CommandType = System.Data.CommandType.StoredProcedure;");
                    if (spinfos != null && spinfos.Count > 0)
                    {
                        foreach (SPInfo info in spinfos)
                        {
                            if (info.is_output)
                            {
                                if ((rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase) &&
                                     (info.parameterName.Equals("@Code", StringComparison.OrdinalIgnoreCase) ||
                                      info.parameterName.Equals("@Value", StringComparison.OrdinalIgnoreCase) ||
                                      info.parameterName.Equals("@Msg", StringComparison.OrdinalIgnoreCase))) == false)
                                {
                                    builder.AppendLine($"cmd.AddOutput(\"{info.parameterName}\", System.Data.SqlDbType.{info.DbType.ToString()}, {info.max_length});");
                                }
                            }
                            else
                            {
                                builder.AppendLine($"cmd.AddInput(\"{info.parameterName}\", System.Data.SqlDbType.{info.DbType.ToString()}, TargetModel.{info.parameterName.Replace("@", "")}, {info.max_length});");
                            }
                        }
                    }
                    if (rtnType.Equals("ReturnValue", StringComparison.OrdinalIgnoreCase))
                    {
                        builder.AppendLine("result = cmd.ExecuteReturnValue();");
                    }
                    else if (rtnType.Equals("List<T>", StringComparison.OrdinalIgnoreCase))
                    {
                        builder.AppendLine("result = cmd.ExecuteList<T>();");
                    }
                    else
                    {
                        builder.AppendLine("cmd.ExecuteNonQuery();");
                    }
                    builder.AppendLine("}");
                    TB_Result.Text = builder.ToString();
                }
            }
        }
Exemplo n.º 18
0
    protected void g_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
        {
            DataRowView drv = (DataRowView)e.Item.DataItem;
            DataRow     dr  = drv.Row;

            if (dr == null)
            {
                return;
            }

            //战绩
            TableCell Level = e.Item.Cells[1];

            Level.CssClass = "blue12";

            if (dr["Level"].ToString() == "0")
            {
                Level.Text = "<a href='../Web/Score.aspx?id=" + dr["ID"].ToString() + "&LotteryID=" + tbLotteryID.Value + "' title='点击查看' target='_blank'>-</a>";
            }
            else
            {
                int level = Shove._Convert.StrToInt(dr["Level"].ToString(), 0);

                string img = "";

                for (int i = 1; i <= level; i++)
                {
                    img += "<img src='Images/gold.gif'/>";
                }
                Level.Text = "<a href='../Web/Score.aspx?id=" + dr["ID"].ToString() + "&LotteryID=" + tbLotteryID.Value + "' title='点击查看' target='_blank'>" + img + "</a>";
            }
            //END

            //已定制/未定制
            TableCell Customization = e.Item.Cells[2];

            //好友定制跟单表缓存,★注意有用户定制跟单时需刷新缓存
            string    CacheKey = "T_CustomFriendFollowSchemes" + tbLotteryID.Value;
            DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

            if (dt == null)
            {
                dt = MSSQL.Select("select * from T_CustomFriendFollowSchemes where LotteryID in (-1," + tbLotteryID.Value + ")");

                if (dt != null && dt.Rows.Count > 0)
                {
                    Shove._Web.Cache.SetCache(CacheKey, dt, 6000);
                }
            }

            int FollowUserCount = 0;

            if (dt != null && dt.Rows.Count > 0)
            {
                FollowUserCount = dt.Select("FollowUserID = " + dr["ID"].ToString()).Length;
            }

            Customization.Text = FollowUserCount.ToString() + "/" + dr["MaxFollowNumber"].ToString();
            //END

            //所有跟单人
            TableCell ViewAllFollowUsers = e.Item.Cells[3];

            if (FollowUserCount > 0)
            {
                ViewAllFollowUsers.CssClass = "blue12";
                ViewAllFollowUsers.Text     = "<a href='javascript:;' onclick=\"showDialog('FollowFriendView.aspx?ID=" + dr["ID"].ToString() + "&FollowUserName="******"Name"].ToString()) + "');\">查看</a>";
            }
            else
            {
                ViewAllFollowUsers.Text = "-";
            }
            //END

            //定制状态
            TableCell Status = e.Item.Cells[4];

            int FollowStatus = -1;
            if (_User == null)
            {
                Status.Text = "未知";
            }
            else
            {
                if (dt.Select("UserID = " + _User.ID.ToString() + " and FollowUserID = " + dr["ID"].ToString()).Length > 0)
                {
                    Status.Text  = "已定制";
                    FollowStatus = 1;
                }
                else
                {
                    Status.Text  = "未定制";
                    FollowStatus = 0;
                }
            }
            //END

            //定制自动跟单
            TableCell Opt = e.Item.Cells[5];

            if (FollowStatus == -1)
            {
                Opt.Text = "-";

                return;
            }

            Label      lbEdit = (Label)Opt.FindControl("lbEdit");
            LinkButton Cancel = (LinkButton)Opt.FindControl("Cancel");
            Cancel.Visible = false;
            Opt.CssClass   = "blue12";

            if (FollowStatus == 0)
            {
                if (FollowUserCount >= Shove._Convert.StrToInt(dr["MaxFollowNumber"].ToString(), 200))
                {
                    Opt.Text = "已满额";
                }
                else
                {
                    Opt.Text = "<script>var e_script_" + dr["ID"].ToString() + "=\"parent.iframeFollowScheme.showDialog('FollowFriendSchemeAdd.aspx?FollowUserID=" + dr["ID"].ToString() + "&FollowUserName="******"Name"].ToString()) + "&LotteryID=" + tbLotteryID.Value + "&Number=" + tbNumber.Value + "')\";</script><a href='javascript:;' onclick=\"if(parent.CreateLogin(e_script_" + dr["ID"].ToString() + ")){showDialog('FollowFriendSchemeAdd.aspx?FollowUserID=" + dr["ID"].ToString() + "&FollowUserName="******"Name"].ToString()) + "&LotteryID=" + tbLotteryID.Value + "&Number=" + tbNumber.Value + "');}\">定制</a>";
                }

                Cancel.Visible = false;

                return;
            }

            if (FollowStatus == 1)
            {
                lbEdit.Text    = "<a href='javascript:;' onclick=\"showDialog('FollowFriendSchemeEdit.aspx?FollowUserID=" + dr["ID"].ToString() + "&FollowUserName="******"Name"].ToString()) + "&UserID=" + _User.ID.ToString() + "')\">修改</a>";
                Cancel.Visible = true;
                Cancel.Attributes.Add("onclick", "return isCancelFollowScheme()");

                return;
            }
            //END
        }
    }
Exemplo n.º 19
0
    private void BindDataForFriendFollowScheme()
    {
        long UserID = -1;

        if (_User != null)
        {
            UserID = _User.ID;
        }

        DataTable dt    = null;
        string    sName = Shove._Web.Utility.FilteSqlInfusion(TxtName.Text.Trim());

        if (sName != "")
        {
            string strCmd = "SELECT ID,[NAME],[Level],MaxFollowNumber FROM dbo.T_Users ";


            if (sName != "" && sName != "输入用户名")
            {
                strCmd += " WHERE [Name] LIKE '%" + sName + "%' and ID not in (select FollowUserID from T_CustomFriendFollowSchemes where UserID = " + UserID.ToString() + " and LotteryID in(-1," + ddlLotterySet.SelectedValue + "))";
            }
            else
            {
                strCmd += " WHERE 0=1";
            }

            if (UserID > 0)
            {
                strCmd += " and ID <> " + UserID.ToString();
            }

            dt = MSSQL.Select(strCmd);

            if (dt == null)
            {
                PF.GoError(ErrorNumber.Unknow, "数据库繁忙,请重试", this.GetType().BaseType.FullName);

                return;
            }
        }
        else
        {
            string strCmd = "select FollowUserID from T_CustomFriendFollowSchemes where UserID = " + _User.ID.ToString();

            if (ddlLotterySet.SelectedValue != "-1")
            {
                strCmd += " and LotteryID = " + ddlLotterySet.SelectedValue + "";
            }

            if (ddlPlayTypeSet.SelectedValue != "-1")
            {
                strCmd += " and PlayTypeID = " + ddlPlayTypeSet.SelectedValue + "";
            }

            dt = Shove.Database.MSSQL.Select("SELECT ID,[Name],[Level],MaxFollowNumber FROM dbo.T_Users WHERE ID in (" + strCmd + ")", new Shove.Database.MSSQL.Parameter[0]);

            if (dt == null)
            {
                PF.GoError(ErrorNumber.Unknow, "参数错误,系统异常。", this.GetType().FullName);
            }
        }
        gSetFollowScheme.DataSource = dt;
        gSetFollowScheme.DataBind();

        gPager.Visible = true;
    }
Exemplo n.º 20
0
    private void GetOpenMatch()
    {
        DateTime BeginTime = Shove._Convert.StrToDateTime(tbBeginTime.Text, DateTime.Now.AddDays(-3).ToString());
        DateTime EndTime   = Shove._Convert.StrToDateTime(tbEndTime.Text, DateTime.Now.ToString()).AddDays(1);

        string Key = "Open_index_GetOpenMatch" + BeginTime.ToString("yyyy-MM-dd") + EndTime.ToString("yyyy-MM-dd");

        DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key);

        if (dt == null)
        {
            string strCmd = @"select ROW_NUMBER() OVER (ORDER BY StopSellingTime desc, MatchNumber desc) AS id, MatchDate, MatchNumber, Game, GameColor,  MainTeam, GuestTeam, isnull(MainLoseBall, 0) as MainLoseBall, SPFResult, SPFBonus, BQCResult, BQCBonus, ZJQSResult, ZJQSBonus, ZQBFResult, ZQBFBonus, Result from T_Match
                              where StopSellingTime between '" + BeginTime.ToString("yyyy-MM-dd") + "' and '" + EndTime.ToString("yyyy-MM-dd") + "' and isnull(Result, '') <> ''order by  StopSellingTime desc";

            dt = MSSQL.Select(strCmd);

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

                return;
            }

            if (dt.Rows.Count > 0)
            {
                Shove._Web.Cache.SetCache(Key, dt, 600);
            }
        }

        DataTable dtGame = new DataTable();

        dtGame.Columns.Add("Game", typeof(System.String));
        DataRow drGame = dtGame.NewRow();

        drGame["Game"] = "全部联赛";

        dtGame.Rows.Add(drGame);
        dtGame.AcceptChanges();

        object LastValue = null;

        foreach (DataRow dr in dt.Select("", "Game"))
        {
            if (LastValue == null || !(ColumnEqual(LastValue, dr["Game"])))
            {
                LastValue = dr["Game"];

                DataRow drGame1 = dtGame.NewRow();
                drGame1["Game"] = dr["Game"].ToString();
                dtGame.Rows.Add(drGame1);
                dtGame.AcceptChanges();
            }
        }

        Shove.ControlExt.FillDropDownList(ddlleague, dtGame, "Game", "Game");

        int    SumPage = dt.Rows.Count;
        string league  = Shove._Web.Utility.GetRequest("league");

        if (league != "" && league != "全部联赛")
        {
            SumPage = dt.Select("Game='" + league + "'").Length;
        }

        int Count = Shove._Convert.StrToInt(Shove._Web.Utility.GetRequest("p"), 1);
        int Last  = SumPage % 20 == 0 ? SumPage / 20 : SumPage / 20 + 1;

        string URL = "?";

        if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("startdate")))
        {
            URL += "startdate=" + Shove._Web.Utility.GetRequest("startdate") + "&";
        }

        if (!string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("enddate")))
        {
            URL += "enddate=" + Shove._Web.Utility.GetRequest("enddate") + "&";
        }

        if (!string.IsNullOrEmpty(league))
        {
            URL += "league=" + league + "&";
        }

        lbNum.Text = SumPage.ToString();

        lbPage.Text  = "<li class=\"first\"><a href='" + URL + "p=1'>首页</a></li>";
        lbPage.Text += "<li class=\"previous\"><a href='" + URL + "p=" + (Count == 1 ? "1" : (Count - 1).ToString()) + "'>上一页</a></li>";

        for (int i = 1; i < Last + 1; i++)
        {
            lbPage.Text += (Count == i ? "<li class=\"slect_r\">" + i.ToString() + "</li>" : "<li><a href=\"" + URL + "p=" + i.ToString() + "\">" + i.ToString() + "</a></li>");
        }

        lbPage.Text += "<li class='next'><a href='" + URL + "p=" + (Count == Last ? Last.ToString() : (Count + 1).ToString()) + "'>下一页</a></li>";
        lbPage.Text += "<li class='last'><a href='" + URL + "p=" + Last.ToString() + "'>末页</a></li>";
        lbPage.Text += "<li class='totel'>共" + Last.ToString() + "页</li>";

        DataRow[] drs = dt.Select("1=1", "id desc");

        if (league != "" && league != "全部联赛")
        {
            drs = dt.Select("Game='" + league + "'");
        }

        string lineStyle = "";

        JczqMatch.Text  = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"data_tablebox\">";
        JczqMatch.Text += "<tr class=\"trt1\"><th rowspan=\"2\" width=\"70\">赛事日期</th>";
        JczqMatch.Text += "<th rowspan=\"2\" width=\"70\">赛事编号</th>";
        JczqMatch.Text += "<th rowspan=\"2\" width=\"70\">赛事类型</th>";
        JczqMatch.Text += "<th class=\"th_noline\" rowspan=\"2\"></th>";
        JczqMatch.Text += "<th class=\"th_noline\" rowspan=\"2\">对阵</th>";
        JczqMatch.Text += "<th class=\"\" rowspan=\"2\"></th>";
        JczqMatch.Text += "<th rowspan=\"2\">让球</th>";
        JczqMatch.Text += "<th height=\"24\" colspan=\"2\" class=\"tbottom\">让球胜平负</th>";
        JczqMatch.Text += "<th colspan=\"2\" class=\"tbottom\">总进球数</th>";
        JczqMatch.Text += "<th colspan=\"2\" class=\"tbottom\">比分</th>";
        JczqMatch.Text += "<th colspan=\"2\" class=\"tbottom\">半全场</th></tr>";
        JczqMatch.Text += "<tr class=\"trt2\"><th width=\"35\" height=\"24\">彩果</th>";
        JczqMatch.Text += "<th>奖金</th>";
        JczqMatch.Text += "<th>彩果</th>";
        JczqMatch.Text += "<th>奖金</th>";
        JczqMatch.Text += "<th>彩果</th>";
        JczqMatch.Text += "<th>奖金</th>";
        JczqMatch.Text += "<th>彩果</th>";
        JczqMatch.Text += "<th>奖金</th></tr>";

        for (int i = (Count - 1) * 20; i < (Count * 20 < drs.Length ? Count * 20 : drs.Length); i++)
        {
            DataRow dr = drs[i];

            lineStyle = Shove._Convert.StrToInt(dr["ID"].ToString(), 0) % 2 == 0 ? "tr1" : "tr2";

            JczqMatch.Text += "<tr class=\"" + lineStyle + "\"><td>" + Shove._Convert.StrToDateTime(dr["MatchDate"].ToString(), DateTime.Now.ToString()).ToString("yyyy-MM-dd") + "</td>";
            JczqMatch.Text += "<td>" + dr["MatchNumber"].ToString() + "</td>";
            JczqMatch.Text += "<td bgcolor=\"" + dr["GameColor"].ToString() + "\"><span class=\"white12\">" + dr["Game"].ToString() + "</span></td>";
            JczqMatch.Text += "<td class=\"ralign\">" + dr["MainTeam"].ToString() + "</td>";
            JczqMatch.Text += "<td><span class=\"red\">" + dr["Result"].ToString() + "</span></td>";
            JczqMatch.Text += "<td class=\"lalign\">" + dr["GuestTeam"].ToString() + "</td>";
            JczqMatch.Text += "<td><span class=\"bold\">" + dr["MainLoseBall"].ToString().Replace("无让球", "0") + "</span></td>";
            JczqMatch.Text += "<td>" + dr["SPFResult"].ToString() + "</td>";
            JczqMatch.Text += "<td class=\"ralign\"><span class=\"red\">" + dr["SPFBonus"].ToString() + "</span></td>";
            JczqMatch.Text += "<td>" + dr["ZJQSResult"].ToString() + "</td>";
            JczqMatch.Text += "<td class=\"ralign\"><span class=\"red\">" + dr["ZJQSBonus"].ToString() + "</span></td>";
            JczqMatch.Text += "<td>" + dr["ZQBFResult"].ToString() + "</td>";
            JczqMatch.Text += "<td class=\"ralign\"><span class=\"red\">" + dr["ZQBFBonus"].ToString() + "</span></td>";
            JczqMatch.Text += "<td>" + dr["BQCResult"].ToString() + "</td>";
            JczqMatch.Text += "<td class=\"ralign\"><span class=\"red\">" + dr["BQCBonus"].ToString() + "</span></td></tr>";
        }

        if (league != "" && league != "全部联赛")
        {
            ddlleague.SelectedValue = league;
        }

        JczqMatch.Text += "</table>";
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     AjaxPro.Utility.RegisterTypeForAjax(typeof(Home_Room_PromoteUserReg), this.Page);
     if (!base.IsPostBack)
     {
         bool flag = base._Site.SiteOptions["Opt_isUseCheckCode"].ToBoolean(true);
         this.CheckCode1.Visible = flag;
         this.CheckCode2.Visible = flag;
         new Login().SetCheckCode(base._Site, this.ShoveCheckCode1);
         new Login().SetCheckCode(base._Site, this.ShoveCheckCode2);
         if (base._User != null)
         {
             base.Response.Redirect("../../Default.aspx");
         }
         this.BindAffiches();
         this.pnlShowInfoWithHongbao.Visible    = false;
         this.pnlShowInfoWithoutHongbao.Visible = false;
         this.pnlShowInfoPromotion.Visible      = false;
         this.lblInputError.Visible             = false;
         this.lblInputError.Text = "";
         this.SetCommenderName("");
         this.SetCommenderGifMoney("0");
         long   num     = -1L;
         long   num2    = -1L;
         string request = Shove._Web.Utility.GetRequest("id");
         if (string.IsNullOrEmpty(Shove._Web.Utility.GetRequest("Sign")) && !string.IsNullOrEmpty(request))
         {
             if (request.Length != 11)
             {
                 this.pnlShowInfoPromotion.Visible = true;
                 this.lblShowInfoPromotion.Text    = "无效的推荐人ID.用户可以正常注册会员!";
             }
             else
             {
                 this.pnlShowInfoWithoutHongbao.Visible = true;
                 this.lblAgreeTip.Visible = false;
                 num = _Convert.StrToLong(request.Substring(0, 10), -1L);
                 object obj2 = MSSQL.ExecuteScalar("select name from T_Users where ID=" + num, new MSSQL.Parameter[0]);
                 if ((obj2 == null) || (obj2.ToString() == ""))
                 {
                     this.pnlShowInfoPromotion.Visible = true;
                     this.lblShowInfoPromotion.Text    = "不存在推荐人的ID.用户可以正常注册会员!";
                 }
                 else
                 {
                     this.SetCommenderName(obj2.ToString());
                 }
             }
         }
         else if (new SynchronizeSessionID(this).ValidSign(base.Request))
         {
             num  = _Convert.StrToLong(Shove._Web.Utility.GetRequest("UserID"), -1L);
             num2 = _Convert.StrToLong(Shove._Web.Utility.GetRequest("id"), -1L);
             DataTable table = MSSQL.Select(string.Concat(new object[] { "select * from T_UserHongbaoPromotion where ID=", num2, " and UserID=", num }), new MSSQL.Parameter[0]);
             if ((table != null) && (table.Rows.Count > 0))
             {
                 string str3 = "";
                 long   num3 = -1L;
                 double num4 = 0.0;
                 double num5 = 0.0;
                 str3 = MSSQL.ExecuteScalar("select name from T_Users where ID=" + num, new MSSQL.Parameter[0]).ToString();
                 num3 = _Convert.StrToLong(table.Rows[0]["AcceptUserID"].ToString(), -1L);
                 DateTime time = (table.Rows[0]["ExpiryDate"] == null) ? DateTime.MinValue : Convert.ToDateTime(table.Rows[0]["ExpiryDate"]);
                 num4 = _Convert.StrToDouble(table.Rows[0]["Money"].ToString(), 0.0);
                 num5 = _Convert.StrToDouble(MSSQL.ExecuteScalar("select Balance from T_Users where ID=" + num.ToString(), new MSSQL.Parameter[0]).ToString(), 0.0);
                 if (num3 > 0L)
                 {
                     this.pnlShowInfoPromotion.Visible = true;
                     this.lblShowInfoPromotion.Text    = "欢迎您通过你的好友 " + str3 + " 的推荐来到" + base._Site.Name + "上购彩中心,此推荐链接送出的红包已经被他人领取。您可以继续注册用户,但不会获得推荐人送出的彩票红包。但我们热情期待您加入,共同博击1000万的大奖!";
                     this.lblAgreeTip.Visible          = false;
                 }
                 else if (time < DateTime.Now)
                 {
                     this.pnlShowInfoPromotion.Visible = true;
                     this.lblShowInfoPromotion.Text    = "欢迎您通过你的好友 " + str3 + " 的推荐来到" + base._Site.Name + "上购彩中心,由于此推荐注册链接已经过期,继续注册不会获得推荐者送出的红包.但我们热情期待您加入,共同博击1000万的大奖!";
                     this.lblAgreeTip.Visible          = false;
                 }
                 else if (num5 < num4)
                 {
                     this.pnlShowInfoPromotion.Visible = true;
                     this.lblShowInfoPromotion.Text    = "欢迎您通过你的好友 " + str3 + " 的推荐来到" + base._Site.Name + "上购彩中心,由于推荐人余额不足,继续注册不会获得推荐者送出的红包.但我们热情期待您加入,共同博击1000万的大奖!";
                     this.lblAgreeTip.Visible          = false;
                 }
                 else
                 {
                     this.pnlShowInfoWithHongbao.Visible = true;
                     this.SetCommenderName(MSSQL.ExecuteScalar("select name from T_Users where ID=" + num, new MSSQL.Parameter[0]).ToString());
                     this.SetCommenderGifMoney(num4.ToString());
                 }
             }
             else
             {
                 this.pnlShowInfoPromotion.Visible = true;
                 this.lblShowInfoPromotion.Text    = "无效的推荐链接。我们热情期待您加入,共同博击1000万的大奖!";
             }
         }
         else
         {
             this.pnlShowInfoPromotion.Visible = true;
             this.lblShowInfoPromotion.Text    = "红包推广推荐链接已被他人修改过。我们热情期待您加入,共同博击1000万的大奖!";
         }
         if (num > 0L)
         {
             this.Session[this.KeyPromotionUserID] = num.ToString();
             if (num2 > 0L)
             {
                 this.Session[this.KeyHongbaoPromotionID] = num2.ToString();
             }
             else
             {
                 this.Session[this.KeyHongbaoPromotionID] = null;
             }
         }
         else
         {
             this.pnlShowInfoPromotion.Visible = true;
             this.lblShowInfoPromotion.Text    = "无效的推荐链接。继续注册,我们热情期待您加入,共同博击1000万的大奖!";
         }
     }
 }
Exemplo n.º 22
0
 public BranchesController()
 {
     sql = new MSSQL();
 }
    protected void btnReg_Click(object sender, EventArgs e)
    {
        this.lblInputError.Visible = false;
        this.lblInputError.Text    = "";
        string str = "";

        if (!PF.CheckUserName(this.tbUserName.Text))
        {
            str = str + "对不起用户名中含有禁止使用的字符\n";
        }
        if ((_String.GetLength(this.tbUserName.Text) < 5) || (_String.GetLength(this.tbUserName.Text) > 0x10))
        {
            str = str + "用户名长度在 5-16 个英文字符或数字、中文 3-8 之间。\n";
        }
        if ((this.tbPassword.Text.Length < 6) || (this.tbPassword.Text.Length > 0x10))
        {
            str = str + "密码长度必须在 6-16 位之间。\n";
        }
        if (string.IsNullOrEmpty(this.tbRealyName.Text))
        {
            str = str + "真实姓名不能为空。\n";
        }
        if (!_String.Valid.isEmail(this.tbEmail.Text))
        {
            str = str + "电子邮件地址格式不正确。\n";
        }
        if (!this.ckbAgree.Checked)
        {
            str = str + "必须同意本站会员注册协议才能注册会员。\n";
        }
        if (this.CheckCode2.Visible)
        {
            if (this.tbCheckCode.Text.Trim() == "")
            {
                str = str + "请输入验证码!\n";
            }
            else if (!this.ShoveCheckCode1.Valid(this.tbCheckCode.Text.Trim()))
            {
                str = str + "验证码输入有误!\n";
            }
        }
        if (str != "")
        {
            this.lblInputError.Visible = true;
            this.lblInputError.Text    = "输入资料错误:\r\n" + str;
        }
        else
        {
            long num                    = -1L;
            long fromUserID             = -1L;
            long userHongbaoPromotionID = -1L;
            if (this.Session[this.KeyPromotionUserID] != null)
            {
                fromUserID = _Convert.StrToLong(this.Session[this.KeyPromotionUserID].ToString(), -1L);
            }
            if (this.Session[this.KeyHongbaoPromotionID] != null)
            {
                userHongbaoPromotionID = _Convert.StrToLong(this.Session[this.KeyHongbaoPromotionID].ToString(), -1L);
            }
            object obj2 = MSSQL.ExecuteScalar("select ID from T_Cps where OwnerUserID=" + fromUserID, new MSSQL.Parameter[0]);
            if (obj2 != null)
            {
                num = _Convert.StrToLong(obj2.ToString(), -1L);
            }
            Thread.Sleep(500);
            string str2  = this.tbUserName.Text.Trim();
            string str3  = this.tbPassword.Text.Trim();
            string str4  = this.tbEmail.Text.Trim();
            string str5  = this.tbRealyName.Text.Trim();
            string str6  = this.tbQQ.Text.Trim();
            Users  users = new Users(base._Site.ID)
            {
                Name        = str2,
                Password    = str3,
                Email       = str4,
                RealityName = str5,
                QQ          = str6,
                UserType    = 2
            };
            if (num > 0L)
            {
                users.CommenderID = -1L;
                users.CpsID       = num;
            }
            else
            {
                users.CommenderID = fromUserID;
                users.CpsID       = -1L;
            }
            string returnDescription = "";
            if (users.Add(ref returnDescription) < 0)
            {
                JavaScript.Alert(this, returnDescription);
            }
            else
            {
                string str8 = "<span style='font-size: 14px; color: #CC3300; font-weight: bold;'>注册成功,恭喜您成为" + base._Site.Name + "的高级会员!让我们一起共同搏击1000万大奖!</span><br/>";
                if (userHongbaoPromotionID > 0L)
                {
                    DataTable table = MSSQL.Select(string.Concat(new object[] { "select * from T_UserHongbaoPromotion where ID=", userHongbaoPromotionID, " and UserID=", fromUserID }), new MSSQL.Parameter[0]);
                    if ((table != null) && (table.Rows.Count > 0))
                    {
                        double num5 = 0.0;
                        num5 = _Convert.StrToDouble(table.Rows[0]["Money"].ToString(), 0.0);
                        int returnValue = -1;
                        Procedures.P_AcceptUserHongbaoPromotion(fromUserID, users.ID, userHongbaoPromotionID, ref returnValue, ref returnDescription);
                        if (returnValue != 0)
                        {
                            str8 = "<span style='font-size: 14px; color: #CC3300; font-weight: bold;'>注册成功,恭喜您成为" + base._Site.Name + "的高级会员!</span><br/>由以下原因未能获得推荐者的彩票红包:" + returnDescription + "<br/>";
                        }
                        else
                        {
                            str8 = "<span style='font-size: 14px; color: #CC3300; font-weight: bold;'>注册成功,恭喜您成为" + base._Site.Name + "的高级会员,并获得" + num5.ToString() + "元彩票红包!" + num5.ToString() + "元已注入您的" + base._Site.Name + "现金帐户,您可以到我们的购彩页面购买彩票啦,祝君好运!</span><br/>";
                        }
                    }
                }
                if (users.Login(ref returnDescription) < 0)
                {
                    JavaScript.Alert(this, returnDescription);
                }
                else
                {
                    this.MultiView1.ActiveViewIndex = 1;
                    this.divRegResultInfo.InnerHtml = str8;
                }
            }
        }
    }
Exemplo n.º 24
0
 public string F_GetUsedLotteryList(long SiteID)
 {
     return(Convert.ToString(MSSQL.ExecuteFunction("F_GetUsedLotteryList", new MSSQL.Parameter[] { new MSSQL.Parameter("SiteID", SqlDbType.BigInt, 0, ParameterDirection.Input, SiteID) })));
 }
Exemplo n.º 25
0
    private void BindData()
    {
        DataTable dt  = null;
        string    sql = "";

        if (Shove._Web.Cache.GetCache("FirstQuery_" + _User.ID) != null)
        {
            if (Shove._Web.Cache.GetCache("FirstQuery_" + _User.ID).ToString() == "1")    //默认情况, 显示单月注册的会员
            {
                sql = "select * from V_Users where (CONVERT(datetime,RegisterTime) between DATEADD(DD,-(DatePart(D,GETDATE())),GETDATE()) and GETDATE()) AND SiteID = @SiteID order by RegisterTime desc";
                dt  = MSSQL.Select(sql, new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
            }
            else if (Shove._Web.Cache.GetCache("FirstQuery_" + _User.ID).ToString() == "2") //根据注册时间搜索
            {
                if (tbBeginTime.Text.Trim() == "" && tbEndTime.Text.Trim() == "")
                {
                    sql = "select * from V_Users where SiteID = @SiteID order by RegisterTime desc";
                    dt  = MSSQL.Select(sql, new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
                }
                else
                {
                    sql = "select * from V_Users where (CONVERT(datetime,RegisterTime) between @StartDate and @EndDate or CONVERT(datetime,RegisterTime) = @EndDate) and SiteID = @SiteID order by RegisterTime desc";
                    DateTime dtBegin = Shove._Convert.StrToDateTime(Shove._Web.Utility.FilteSqlInfusion(tbBeginTime.Text), DateTime.Now.ToString("yyyy-MM-dd"));
                    DateTime dtEnd   = Shove._Convert.StrToDateTime(Shove._Web.Utility.FilteSqlInfusion(tbEndTime.Text), DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1);
                    dt = MSSQL.Select(sql,
                                      new MSSQL.Parameter("StartDate", SqlDbType.DateTime, 0, ParameterDirection.Input, dtBegin),
                                      new MSSQL.Parameter("EndDate", SqlDbType.DateTime, 0, ParameterDirection.Input, dtEnd),
                                      new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
                }
            }
            else if (Shove._Web.Cache.GetCache("FirstQuery_" + _User.ID).ToString() == "3") //注册未充值会员
            {
                if (this.tbBeginTime.Text.Trim() == "" || this.tbEndTime.Text.Trim() == "")
                {
                    sql = "select * from V_Users Users where not exists ( select UserID from T_UserPayDetails PayDetails where Users.ID=PayDetails.UserID and Result = 1 ) and SiteID = @SiteID order by RegisterTime desc";
                    dt  = MSSQL.Select(sql,
                                       new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
                }
                else
                {
                    sql = "select * from V_Users Users where not exists ( select UserID from T_UserPayDetails PayDetails where Users.ID=PayDetails.UserID and Result = 1 ) and SiteID = @SiteID and (CONVERT(datetime,RegisterTime) between @StartDate and @EndDate) order by RegisterTime desc";
                    DateTime dtBegin = Shove._Convert.StrToDateTime(Shove._Web.Utility.FilteSqlInfusion(tbBeginTime.Text), DateTime.Now.ToString("yyyy-MM-dd"));
                    DateTime dtEnd   = Shove._Convert.StrToDateTime(Shove._Web.Utility.FilteSqlInfusion(tbEndTime.Text), DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1);
                    dt = MSSQL.Select(sql,
                                      new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID),
                                      new MSSQL.Parameter("StartDate", SqlDbType.DateTime, 0, ParameterDirection.Input, dtBegin),
                                      new MSSQL.Parameter("EndDate", SqlDbType.DateTime, 0, ParameterDirection.Input, dtEnd));
                }
            }
            else   //所有会员
            {
                sql = "select * from V_Users where SiteID = @SiteID order by RegisterTime desc";
                dt  = MSSQL.Select(sql, new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
            }
        }
        else  //所有会员
        {
            sql = "select * from V_Users where SiteID = @SiteID order by RegisterTime desc";
            dt  = MSSQL.Select(sql, new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
        }

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

            return;
        }

        PF.DataGridBindData(g, dt, gPager);

        btnSearch.Enabled = (dt.Rows.Count > 0);
    }
Exemplo n.º 26
0
    // 接收开奖通知
    private void IsuseOpenNotice(string Transmessage)
    {
        System.Xml.XmlDocument XmlDoc         = new XmlDocument();
        System.Xml.XmlNodeList nodes          = null;
        System.Xml.XmlNodeList nodesBonusItem = null;
        System.Xml.XmlNodeList nodesIssue     = null;

        try
        {
            XmlDoc.Load(new StringReader(Transmessage));

            nodes          = XmlDoc.GetElementsByTagName("*");
            nodesBonusItem = XmlDoc.GetElementsByTagName("bonusItem");
            nodesIssue     = XmlDoc.GetElementsByTagName("issue");
        }
        catch { }

        if (nodes == null)
        {
            return;
        }

        string BonusNumber = "";

        for (int j = 0; j < nodes.Count; j++)
        {
            if (!(nodes[j].Name.ToUpper() == "BODY" && nodes[j].FirstChild.Name.ToUpper() == "BONUSNOTIFY"))
            {
                continue;
            }

            BonusNumber = nodes[j].FirstChild.Attributes["bonusNumber"].InnerText;
        }

        if (nodesIssue == null)
        {
            this.Response.End();

            return;
        }

        string MessageID   = nodes[0].Attributes["id"].Value;
        string number      = nodesIssue[0].Attributes["number"].Value;
        string LotteryName = nodesIssue[0].Attributes["gameName"].Value;

        int LotteryID = GetLotteryID(LotteryName);

        string WinNumber = GetWinNumber(LotteryID, BonusNumber);

        DataTable dtIsuse = new DAL.Tables.T_Isuses().Open("", " [Name] = '" + Shove._Web.Utility.FilteSqlInfusion(number) + "' and LotteryID = " + LotteryID.ToString() + " and IsOpened = 0 and LotteryID  in (select id from T_Lotteries where PrintOutType = 104)", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        string IsuseID = dtIsuse.Rows[0]["ID"].ToString();

        DAL.Tables.T_Isuses T_Isuses = new DAL.Tables.T_Isuses();

        T_Isuses.WinLotteryNumber.Value = WinNumber;
        T_Isuses.OpenOperatorID.Value   = 1;
        T_Isuses.Update(" ID = " + IsuseID);

        int    ReturnValue       = 0;
        string ReturnDescription = "";

        DataTable dtWinTypesSSL = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypesSSL != null) && dtWinTypesSSL.Rows.Count > 0)
        {
            double[] WinMoneyList = new double[dtWinTypesSSL.Rows.Count * 2];

            double DefaultMoney          = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypesSSL.Rows.Count; i++)
            {
                DefaultMoney          = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypesSSL.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2]     = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Tables.T_Schemes().Open("", "IsuseID = " + IsuseID + " and WinMoney = 0  and Buyed = 1 and isnull(Identifiers, '') = ''", "");

            string LotteryNumber       = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description       = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber     = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description       = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    Shove.Database.MSSQL.ExecuteNonQuery("update T_Schemes set PreWinMoney = @p1, PreWinMoneyNoWithTax = @p2, WinMoney = @p3, WinMoneyNoWithTax = @p4, WinDescription = @p5 where [ID] = " + dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(),
                                                         new Shove.Database.MSSQL.Parameter("p1", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p2", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p3", SqlDbType.Money, 0, ParameterDirection.Input, WinMoney * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p4", SqlDbType.Money, 0, ParameterDirection.Input, WinMoneyNoWithTax * Shove._Convert.StrToInt(dtSchemesWithTaskDetails.Rows[i]["Multiple"].ToString(), 1)),
                                                         new Shove.Database.MSSQL.Parameter("p5", SqlDbType.VarChar, 0, ParameterDirection.Input, Description));

                    continue;
                }
            }
        }

        string BonusXML      = "<Schemes>";
        string AgentBonusXML = "<Schemes>";

        if ((nodesBonusItem != null) && (nodesBonusItem.Count > 0))
        {
            string  bonusItemXML = Transmessage.Substring(Transmessage.IndexOf("<bonusNotify"), Transmessage.LastIndexOf("</body>") - Transmessage.IndexOf("<bonusNotify"));
            DataSet dsXML        = new DataSet();

            try
            {
                dsXML.ReadXml(new StringReader(bonusItemXML));
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期解析开奖数据错误:" + e.Message);

                this.Response.End();

                return;
            }

            if ((dsXML == null) || (dsXML.Tables.Count < 3))
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期开奖数据格式不符合要求。");

                this.Response.End();

                return;
            }

            DataTable dtTickets = dsXML.Tables[2];
            DataTable dtSchemes = MSSQL.Select("SELECT SchemeID, 0 AS AgentID, SchemesMultiple as Multiple, Identifiers FROM V_SchemesSendToCenter WHERE (IsuseID = " + IsuseID + ")");

            if (dtSchemes == null)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期,读取本地方案错误。");

                this.Response.End();

                return;
            }

            try
            {
                var query1 = from NewDtTickets in dtTickets.AsEnumerable()
                             join NewdtScheme in dtSchemes.AsEnumerable()
                             on NewDtTickets.Field <string>("ticketID") equals NewdtScheme.Field <string>("Identifiers")
                             select new
                {
                    ID         = NewdtScheme.Field <long>("SchemeID"),
                    AgentID    = 0,          //NewdtScheme.Field<long>("AgentID"),
                    Multiple   = NewdtScheme.Field <int>("Multiple"),
                    Bonus      = Shove._Convert.StrToDouble(NewDtTickets.Field <string>("money"), 0),
                    BonusLevel = NewDtTickets.Field <string>("bonusLevel"),
                };

                var query2 = from NewDt in query1.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.BonusLevel, NewDt.AgentID, NewDt.Multiple } into gg
                    select new
                {
                    ID         = gg.Key.ID,
                    AgentID    = gg.Key.AgentID,
                    Multiple   = gg.Key.Multiple,
                    Bonus      = gg.Sum(NewDt => NewDt.Bonus),
                    BonusLevel = GetWinDescription(LotteryID, gg.Key.BonusLevel)
                };

                var query3 = from NewDt in query2.AsQueryable()
                             group NewDt by new { NewDt.ID, NewDt.Multiple, NewDt.AgentID } into t_dtSchemes
                    select new
                {
                    SchemeID   = t_dtSchemes.Key.ID,
                    AgentID    = t_dtSchemes.Key.AgentID,
                    Multiple   = t_dtSchemes.Key.Multiple,
                    Bonus      = t_dtSchemes.Sum(NewDt => NewDt.Bonus),
                    BonusLevel = "中奖金额:" + t_dtSchemes.Sum(NewDt => NewDt.Bonus).ToString() + ((t_dtSchemes.Key.Multiple != 1) ? "(" + t_dtSchemes.Key.Multiple.ToString() + "倍)" : "")
                };

                foreach (var Scheme in query3)
                {
                    if (Scheme.AgentID == 0)
                    {
                        BonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                    else
                    {
                        AgentBonusXML += "<Scheme SchemeID=\"" + Scheme.SchemeID.ToString() + "\" WinMoney=\"" + Scheme.Bonus.ToString() + "\" WinDescription=\"" + Scheme.BonusLevel + "\" />";
                    }
                }
            }
            catch (Exception e)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票开奖,第 " + number + " 期详细中奖数据解析错误:" + e.Message);

                this.Response.End();

                return;
            }
        }

        BonusXML      += "</Schemes>";
        AgentBonusXML += "</Schemes>";

        dtIsuse = new DAL.Tables.T_Isuses().Open("", "[ID] = " + IsuseID + " and IsOpened = 0", "");

        if ((dtIsuse == null) || (dtIsuse.Rows.Count < 1))
        {
            this.Response.End();

            return;
        }

        DataSet ds     = null;
        int     Times  = 0;
        int     Result = -1;

        while ((Result < 0) && (Times < 5))
        {
            ReturnValue       = 0;
            ReturnDescription = "";

            Result = DAL.Procedures.P_ElectronTicketWin(ref ds, Shove._Convert.StrToLong(IsuseID, 0), BonusXML, AgentBonusXML, ref ReturnValue, ref ReturnDescription);

            if (Result < 0)
            {
                new Log("ElectronTicket\\HPSD").Write("电子票第 " + (Times + 1).ToString() + " 次派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString());
                Times++;

                if (Times < 5)
                {
                    System.Threading.Thread.Sleep(10000);
                }

                continue;
            }
        }

        if (ReturnValue < 0)
        {
            new Log("ElectronTicket\\HPSD").Write("电子票派奖出现错误(IsuseOpenNotice) 期号为: " + number + ",彩种为: " + LotteryID.ToString() + ",错误:" + ReturnDescription);

            this.Response.End();

            return;
        }

        DataTable dtWinTypes = new DAL.Tables.T_WinTypes().Open("", " LotteryID =" + LotteryID.ToString(), "");

        if ((dtWinTypes != null) && dtWinTypes.Rows.Count > 0)
        {
            double[] WinMoneyList = new double[dtWinTypes.Rows.Count * 2];

            double DefaultMoney          = 0;
            double DefaultMoneyNoWithTax = 0;

            for (int i = 0; i < dtWinTypes.Rows.Count; i++)
            {
                DefaultMoney          = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoney"].ToString(), 0);
                DefaultMoneyNoWithTax = Shove._Convert.StrToDouble(dtWinTypes.Rows[i]["DefaultMoneyNoWithTax"].ToString(), 0);

                WinMoneyList[i * 2]     = DefaultMoney == 0 ? 1 : DefaultMoneyNoWithTax;
                WinMoneyList[i * 2 + 1] = DefaultMoneyNoWithTax == 0 ? 1 : DefaultMoneyNoWithTax;
            }

            DataTable dtSchemesWithTaskDetails = new DAL.Views.V_Schemes().Open("LotteryNumber, PlayTypeID, SiteID, ID, Multiple", " IsuseID = " + IsuseID + " and WinMoney = 0  and Buyed = 0", "");

            string LotteryNumber       = "";
            SLS.Lottery.LotteryBase lb = new SLS.Lottery()[LotteryID];

            string Description       = "";
            double WinMoneyNoWithTax = 0;

            for (int i = 0; i < dtSchemesWithTaskDetails.Rows.Count; i++)
            {
                LotteryNumber     = dtSchemesWithTaskDetails.Rows[i]["LotteryNumber"].ToString();
                Description       = "";
                WinMoneyNoWithTax = 0;

                double WinMoney = lb.ComputeWin(LotteryNumber, WinNumber.Trim(), ref Description, ref WinMoneyNoWithTax, int.Parse(dtSchemesWithTaskDetails.Rows[i]["PlayTypeID"].ToString()), WinMoneyList);

                if (WinMoney > 0)
                {
                    if (DAL.Procedures.P_ChaseTaskStopWhenWin(Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["SiteID"].ToString(), 0), Shove._Convert.StrToLong(dtSchemesWithTaskDetails.Rows[i]["ID"].ToString(), 0), WinMoney, ref ReturnValue, ref ReturnDescription) < 0)
                    {
                        new Log("ElectronTicket\\HPSD").Write("执行电子票--判断是否停止追号的时候出现错误");
                    }

                    continue;
                }
            }
        }

        PF.SendWinNotification(ds);

        MessageID = nodes[0].Attributes["id"].Value;
        ReNotice(MessageID, "508");
    }
Exemplo n.º 27
0
        private void getPricesAndPERatio()
        {
            try {
                string dStr = DateTime.Today.ToString("yyyyMMdd");
                string qStr = DateTime.Today.AddMonths(-3).ToString("yyyyMMdd");
                string yStr = DateTime.Today.AddYears(-1).ToString("yyyyMMdd");

                //昨天,三個月前,一年前的交易日
                //DataView dDv = DeriLib.Util.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + dStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);
                //DataView qDv = DeriLib.Util.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + qStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);
                //DataView yDv = DeriLib.Util.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + yStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);
                DataTable dDv = MSSQL.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + dStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);
                DataTable qDv = MSSQL.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + qStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);
                DataTable yDv = MSSQL.ExecSqlQry("SELECT TOP 1 TradeDate FROM [TradeDate] WHERE IsTrade='Y' AND CONVERT(VARCHAR,TradeDate,112)<'" + yStr + "' ORDER BY TradeDate desc", GlobalVar.loginSet.tsquoteSqlConnString);

                //實際前一交易日,前三個月的交易日,前一年的交易日
                DateTime dDT = Convert.ToDateTime(dDv.Rows[0]["TradeDate"]);
                DateTime qDT = Convert.ToDateTime(qDv.Rows[0]["TradeDate"]);
                DateTime yDT = Convert.ToDateTime(yDv.Rows[0]["TradeDate"]);

                string sql = "SELECT [日期], [股票代號], IsNull([收盤價],0) 收盤價, IsNull([本益比],0) 本益比 FROM [日收盤表排行] WHERE [日期] IN ('" + dDT.ToString("yyyyMMdd") + "','" + qDT.ToString("yyyyMMdd") + "','" + yDT.ToString("yyyyMMdd") + "') AND ";

                string cStr = "";
                foreach (string cID in data.Keys)
                {
                    cStr += "'" + cID + "',";
                }

                //把最後一個逗點刪掉
                if (cStr.Length > 0)
                {
                    cStr = cStr.Substring(0, cStr.Length - 1);
                }

                sql += "[股票代號] IN (" + cStr + ") ORDER BY [股票代號], [日期]";
                ADODB.Recordset rs = cn.CMExecute(ref arg, srvLocation, cnPort, sql);

                for (; !rs.EOF; rs.MoveNext())
                {
                    string stockID = rs.Fields["股票代號"].Value;
                    string date    = rs.Fields["日期"].Value;
                    double price   = Convert.ToDouble(rs.Fields["收盤價"].Value);
                    double pe      = Convert.ToDouble(rs.Fields["本益比"].Value);

                    CommodityData d = data[stockID];
                    if (date == dDT.ToString("yyyyMMdd"))
                    {
                        d.peRatio = pe;
                        d.price   = price;
                    }
                    else if (date == qDT.ToString("yyyyMMdd"))
                    {
                        d.priceQuarter = price;
                    }
                    else if (date == yDT.ToString("yyyyMMdd"))
                    {
                        d.priceYear = price;
                    }
                }

                foreach (CommodityData d in data.Values)
                {
                    if (d.priceQuarter == 0)
                    {
                        d.returnQuarter = 0;
                    }
                    else
                    {
                        d.returnQuarter = d.price / d.priceQuarter - 1.0;
                    }

                    if (d.priceYear == 0)
                    {
                        d.returnYear = 0;
                    }
                    else
                    {
                        d.returnYear = d.price / d.priceYear - 1.0;
                    }
                }
            } catch (Exception ex) {
                MessageBox.Show("getPriceAndPERatio" + ex.Message);
                //GlobalVar.errProcess.Add(1, "[CMoneyWork_getPricesAndPERatio][" + ex.Message + "][" + ex.StackTrace + "]");
            }
        }
Exemplo n.º 28
0
    private void BindDataForType()
    {
        // This item is obfuscated and can not be translated.
        long          num     = _Convert.StrToLong(Utility.FilteSqlInfusion(this.HidIsuseID.Value), 0L);
        StringBuilder builder = new StringBuilder();
        string        text1   = ((this.TxtName.Text.Trim() == "") || (this.TxtName.Text.Trim() == "输入用户名")) ? "" : (" and T_Users.Name like '%" + Utility.FilteSqlInfusion(this.TxtName.Text.Trim()) + "%' ");

        if (text1 != null && text1 != string.Empty)
        {
            builder.AppendLine("select SchemeNumber, InitiateName, Level, Money, d.Name as PlayTypeName, Share, Schedule, AssureMoney, a.ID, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, b.IsOpened, LotteryNumber,b.LotteryID ").AppendLine("from ").AppendLine("\t(").AppendLine("\t\tselect T_Schemes.ID,IsuseID,AtTopStatus,T_Users.Name as InitiateName, T_Users.Level, SchemeNumber,ReSchedule,Money,Share, Schedule, AssureMoney, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, LotteryNumber ").AppendLine("\t\tfrom T_Schemes  left join T_Users  on T_Schemes.InitiateUserID = T_Users.id").AppendLine("\t\twhere IsuseID = @IsuseID and QuashStatus = 0 and Share > BuyedShare ").AppendLine(text1).AppendLine("\t\t\tand T_Schemes.SiteID = @SiteID ").AppendLine("\t)as a").AppendLine("inner join T_Isuses b on a.IsuseID = b.ID").AppendLine("inner join T_PlayTypes d on d.ID = a.PlayTypeID").AppendLine("order by AtTopStatus desc, ReSchedule desc, [Money] desc");
            string    key = "Home_Room_CoBuy_BindDataForType" + this.HidIsuseID.Value;
            DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
            if (cacheAsDataTable == null)
            {
                cacheAsDataTable = MSSQL.Select(builder.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, num), new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, base._Site.ID) });
                if (cacheAsDataTable == null)
                {
                    PF.GoError(4, "数据库繁忙,请重试", base.GetType().FullName);
                    return;
                }
                if (cacheAsDataTable.Rows.Count > 0)
                {
                    Shove._Web.Cache.SetCache(key, cacheAsDataTable, ((this.HidLotteryID.Value == "29") || (this.HidLotteryID.Value == "62")) ? 60 : 600);
                }
            }
            if (this.HidLotteryID.Value == "1")
            {
                DataTable dt       = cacheAsDataTable.Clone();
                DataRow[] rowArray = null;
                if (this.HidNumber.Value == "9")
                {
                    rowArray = cacheAsDataTable.Select("PlayTypeID in (103,104)");
                }
                else
                {
                    rowArray = cacheAsDataTable.Select("PlayTypeID in (101,102)");
                }
                foreach (DataRow row in rowArray)
                {
                    dt.Rows.Add(row.ItemArray);
                }
                PF.DataGridBindData(this.g, dt, this.gPager);
            }
            else
            {
                PF.DataGridBindData(this.g, cacheAsDataTable, this.gPager);
            }

            if (this.g.Items.Count == 0)
            {
                string str2 = Utility.FilteSqlInfusion(this.TxtName.Text.Trim());
                if (((str2 != "") && (str2 != "输入用户名")) && this.Personages.InnerHtml.Contains(str2))
                {
                    builder.AppendLine("select SchemeNumber,InitiateName, Level, Money, d.Name as PlayTypeName, Share, Schedule, AssureMoney, a.ID, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, IsOpened, LotteryNumber,a.LotteryID").AppendLine("from ").AppendLine("(").AppendLine("\tselect top 5 SchemeNumber, Money, Share, Schedule, AssureMoney, s.ID,u.Name as InitiateName,Level, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, s.isOpened, LotteryNumber,LotteryID ").AppendLine("\tfrom T_Schemes  s left join T_Isuses t on s.IsuseID = t.ID ").AppendLine("\tleft join T_Users u on s.InitiateUserID = u.ID").AppendLine("\twhere InitiateUserID not in(132011,71432) and s.Share > 1 and t.LotteryID = @LotteryID ").AppendLine("\tand u.Name like @InitiateName and s.SiteID = @SiteID").AppendLine("   order by QuashStatus asc,[Datetime] desc,[Money] desc").AppendLine(") as a").AppendLine("inner join T_PlayTypes d on d.ID = a.PlayTypeID");
                    key = string.Concat(new object[] { str2, "CoBuySchemes_", this.HidLotteryID.Value, "_Top5", builder });
                    cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key);
                    if (cacheAsDataTable == null)
                    {
                        cacheAsDataTable = MSSQL.Select(builder.ToString(), new MSSQL.Parameter[] { new MSSQL.Parameter("LotteryID", SqlDbType.Int, 0, ParameterDirection.Input, _Convert.StrToLong(Utility.FilteSqlInfusion(this.HidLotteryID.Value), 0L)), new MSSQL.Parameter("InitiateName", SqlDbType.VarChar, 0, ParameterDirection.Input, "'%" + str2 + "%'"), new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, base._Site.ID) });
                        if (cacheAsDataTable == null)
                        {
                            PF.GoError(4, "数据库繁忙,请重试", base.GetType().FullName);
                            return;
                        }
                        if (cacheAsDataTable.Rows.Count > 0)
                        {
                            Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0xea60);
                        }
                    }
                    PF.DataGridBindData(this.g, cacheAsDataTable, this.gPager);
                }
            }
        }
        this.divData.Visible   = true;
        this.divLoding.Visible = false;
    }
Exemplo n.º 29
0
    private void BindDataForType()
    {
        long IsuseID = Shove._Convert.StrToLong(Shove._Web.Utility.FilteSqlInfusion(HidIsuseID.Value), 0);

        //合买方案缓存 60 秒
        string    CacheKey = "Home_Room_CoBuy_BindDataForType" + HidIsuseID.Value;
        DataTable dt       = null;

        if (TxtName.Text.Trim() == "" || TxtName.Text.Trim() == "输入用户名")           //2010-7-9添加的判断
        {
            dt = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);
        }

        if (dt == null)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("select SchemeNumber, InitiateName, Level, Money, d.Name as PlayTypeName, Share, Schedule, AssureMoney, a.ID, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, b.IsOpened, LotteryNumber,b.LotteryID ")
            .AppendLine("from ")
            .AppendLine("	(")
            .AppendLine("		select T_Schemes.ID,IsuseID,AtTopStatus,T_Users.Name as InitiateName, T_Users.Level, SchemeNumber,ReSchedule,Money,Share, Schedule, AssureMoney, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, LotteryNumber ")
            .AppendLine("		from T_Schemes  left join T_Users  on T_Schemes.InitiateUserID = T_Users.id")
            .AppendLine("		where IsuseID = @IsuseID and QuashStatus = 0 and Share > BuyedShare ")
            .AppendLine("" + ((TxtName.Text.Trim() == "" || TxtName.Text.Trim() == "输入用户名") ? " and not exists (select 1 from T_SchemesTop where T_Schemes.ID = T_SchemesTop.SchemeID) " : (" and T_Users.Name like '%" + Shove._Web.Utility.FilteSqlInfusion(TxtName.Text.Trim()) + "%' ")))
            .AppendLine("			and T_Schemes.SiteID = @SiteID")
            .AppendLine("	)as a")
            .AppendLine("inner join T_Isuses b on a.IsuseID = b.ID")
            .AppendLine("inner join T_PlayTypes d on d.ID = a.PlayTypeID")
            .AppendLine("order by AtTopStatus desc, ReSchedule desc, [Money] desc");

            dt = MSSQL.Select(sb.ToString(),
                              new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, IsuseID),
                              new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));

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

                return;
            }
        }

        DataTable dtSchemesFormulae = new DAL.Tables.T_SchemesFormulae().Open("", "LotteryID=" + HidLotteryID.Value, "");

        if (dtSchemesFormulae == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName);

            return;
        }

        dt.Columns.Add("IsTop", typeof(System.Int32));

        if ((TxtName.Text.Trim() == "" || TxtName.Text.Trim() == "输入用户名") && dtSchemesFormulae.Rows.Count > 0)
        {
            BindSchemesFormulae();

            DataTable dtSchemesTop = new DAL.Tables.T_SchemesTop().Open("", "IsuseID=" + IsuseID.ToString(), "Sort");

            if (dtSchemesTop == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().FullName);

                return;
            }

            DataTable dtSchemes = null;

            if (dtSchemesTop.Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();

                sb.AppendLine("select SchemeNumber, InitiateName, Level, Money, d.Name as PlayTypeName, Share, Schedule, AssureMoney, a.ID, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, b.IsOpened, LotteryNumber,b.LotteryID, 1 as IsTop ")
                .AppendLine("from ")
                .AppendLine("	(")
                .AppendLine("		select T_Schemes.ID,IsuseID,AtTopStatus,T_Users.Name as InitiateName, T_Users.Level, SchemeNumber,ReSchedule,Money,Share, Schedule, AssureMoney, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, LotteryNumber ")
                .AppendLine("		from T_Schemes  left join T_Users  on T_Schemes.InitiateUserID = T_Users.id")
                .AppendLine("		where IsuseID = @IsuseID and QuashStatus = 0 and Share > BuyedShare ")
                .AppendLine("           and exists (select 1 from T_SchemesTop where T_Schemes.ID = T_SchemesTop.SchemeID) ")
                .AppendLine("			and T_Schemes.SiteID = @SiteID")
                .AppendLine("	)as a")
                .AppendLine("inner join T_Isuses b on a.IsuseID = b.ID")
                .AppendLine("inner join T_PlayTypes d on d.ID = a.PlayTypeID")
                .AppendLine("order by AtTopStatus desc, ReSchedule desc, [Money] desc");

                dtSchemes = MSSQL.Select(sb.ToString(),
                                         new MSSQL.Parameter("IsuseID", SqlDbType.BigInt, 0, ParameterDirection.Input, IsuseID),
                                         new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));
            }

            int TopCount = 10 - dtSchemesTop.Rows.Count;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (Shove._Convert.StrToDouble(dt.Rows[i]["Money"].ToString(), 0) > Shove._Convert.StrToDouble(dtSchemesFormulae.Rows[0]["Money"].ToString(), 0) &&
                    Shove._Convert.StrToFloat(dt.Rows[i]["Schedule"].ToString(), 0) > Shove._Convert.StrToFloat(dtSchemesFormulae.Rows[0]["MinMoney"].ToString(), 0) &&
                    ((Shove._Convert.StrToDouble(dt.Rows[i]["AssureMoney"].ToString(), 0) / Shove._Convert.StrToDouble(dt.Rows[i]["Money"].ToString(), 0)) * 100 + Shove._Convert.StrToDouble(dt.Rows[i]["Schedule"].ToString(), 0) > Shove._Convert.StrToDouble(dtSchemesFormulae.Rows[0]["MinMoney"].ToString(), 0)) &&
                    TopCount < 10)
                {
                    dt.Rows[i]["IsTop"] = 1;
                }
                else
                {
                    dt.Rows[i]["IsTop"] = 0;
                }

                dt.AcceptChanges();
            }

            DataRow dr        = null;
            DataRow drSchemes = null;

            if (dtSchemes != null && dtSchemes.Rows.Count > 0)
            {
                for (int i = 0; i < dtSchemesTop.Rows.Count; i++)
                {
                    dr = dt.NewRow();
                    try
                    {
                        drSchemes = dtSchemes.Select("ID=" + dtSchemesTop.Rows[i]["SchemeID"].ToString())[0];
                    }
                    catch
                    { }
                    dr["SchemeNumber"]   = drSchemes["SchemeNumber"];
                    dr["InitiateName"]   = drSchemes["InitiateName"];
                    dr["Level"]          = drSchemes["Level"];
                    dr["Money"]          = drSchemes["Money"];
                    dr["PlayTypeName"]   = drSchemes["PlayTypeName"];
                    dr["Share"]          = drSchemes["Share"];
                    dr["Schedule"]       = drSchemes["Schedule"];
                    dr["AssureMoney"]    = drSchemes["AssureMoney"];
                    dr["ID"]             = drSchemes["ID"];
                    dr["InitiateUserID"] = drSchemes["InitiateUserID"];
                    dr["QuashStatus"]    = drSchemes["QuashStatus"];
                    dr["PlayTypeID"]     = drSchemes["PlayTypeID"];
                    dr["Buyed"]          = drSchemes["Buyed"];
                    dr["SecrecyLevel"]   = drSchemes["SecrecyLevel"];
                    dr["EndTime"]        = drSchemes["EndTime"];
                    dr["IsOpened"]       = drSchemes["IsOpened"];
                    dr["LotteryNumber"]  = drSchemes["LotteryNumber"];
                    dr["LotteryID"]      = drSchemes["LotteryID"];
                    dr["IsTop"]          = drSchemes["IsTop"];

                    dt.Rows.InsertAt(dr, Shove._Convert.StrToInt(dtSchemesTop.Rows[i]["Sort"].ToString(), 0));
                    dt.AcceptChanges();
                }
            }
        }

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

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            double AssureMoney = Shove._Convert.StrToDouble(dt.Rows[i]["AssureMoney"].ToString(), 0);

            if (AssureMoney > 0)
            {
                dt.Rows[i]["Assure"] = "<Font color=\'red\'>" + dt.Rows[i]["Schedule"].ToString() + "%<br />+" + ((AssureMoney / Shove._Convert.StrToDouble(dt.Rows[i]["Money"].ToString(), 0)) * 100).ToString("N") + "%(保)</ Font>";
            }
            else
            {
                dt.Rows[i]["Assure"] = "<Font color=\'red\'>" + dt.Rows[i]["Schedule"].ToString() + "%</ Font><br />";
            }

            dt.AcceptChanges();
        }

        PF.DataGridBindData(g, dt, gPager);

        if (g.Items.Count == 0)
        {
            string userName = Shove._Web.Utility.FilteSqlInfusion(TxtName.Text.Trim());

            if (userName != "" && userName != "输入用户名" && Personages.InnerHtml.Contains(userName))
            {
                StringBuilder sb = new StringBuilder();

                sb.AppendLine("select SchemeNumber,InitiateName, Level, Money, d.Name as PlayTypeName, Share, Schedule, AssureMoney, a.ID, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, IsOpened, LotteryNumber,a.LotteryID")
                .AppendLine("from ")
                .AppendLine("(")
                .AppendLine("	select top 5 SchemeNumber, Money, Share, Schedule, AssureMoney, s.ID,u.Name as InitiateName,Level, InitiateUserID, QuashStatus, PlayTypeID, Buyed, SecrecyLevel, EndTime, s.isOpened, LotteryNumber,LotteryID ")
                .AppendLine("	from T_Schemes  s left join T_Isuses t on s.IsuseID = t.ID ")
                .AppendLine("	left join T_Users u on s.InitiateUserID = u.ID")
                .AppendLine("	where s.Share > 1 and t.LotteryID = @LotteryID ")
                .AppendLine("	and u.Name like @InitiateName and s.SiteID = @SiteID")
                .AppendLine("   order by QuashStatus asc,[Datetime] desc,[Money] desc")
                .AppendLine(") as a")
                .AppendLine("inner join T_PlayTypes d on d.ID = a.PlayTypeID");

                //合买方案缓存 60 秒
                CacheKey = userName + "CoBuySchemes_" + HidLotteryID.Value + "_Top5" + sb;
                dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

                if (dt == null)
                {
                    dt = MSSQL.Select(sb.ToString(),
                                      new MSSQL.Parameter("LotteryID", SqlDbType.Int, 0, ParameterDirection.Input, Shove._Convert.StrToLong(Shove._Web.Utility.FilteSqlInfusion(HidLotteryID.Value), 0)),
                                      new MSSQL.Parameter("InitiateName", SqlDbType.VarChar, 0, ParameterDirection.Input, "'%" + userName + "%'"),
                                      new MSSQL.Parameter("SiteID", SqlDbType.Int, 0, ParameterDirection.Input, _Site.ID));

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

                        return;
                    }

                    if (dt.Rows.Count > 0)
                    {
                        Shove._Web.Cache.SetCache(CacheKey, dt, 60);
                    }
                }

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

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    double AssureMoney = Shove._Convert.StrToDouble(dt.Rows[i]["AssureMoney"].ToString(), 0);

                    if (AssureMoney > 0)
                    {
                        dt.Rows[i]["Assure"] = "<Font color=\'red\'>" + dt.Rows[i]["Schedule"].ToString() + "%<br />+" + ((AssureMoney / Shove._Convert.StrToDouble(dt.Rows[i]["Money"].ToString(), 0)) * 100).ToString("N") + "%(保)</ Font>";
                    }
                    else
                    {
                        dt.Rows[i]["Assure"] = "<Font color=\'red\'>" + dt.Rows[i]["Schedule"].ToString() + "%</ Font><br />";
                    }

                    dt.AcceptChanges();
                }

                PF.DataGridBindData(g, dt, gPager);
            }
        }

        divData.Visible   = true;
        divLoding.Visible = false;
    }
Exemplo n.º 30
0
    protected void btnReg_Click(object sender, EventArgs e)
    {
        string str = "";

        if (!PF.CheckUserName(this.tbUserName.Text))
        {
            str = str + "对不起用户名中含有禁止使用的字符.\r\n";
        }
        if ((_String.GetLength(this.tbUserName.Text) < 5) || (_String.GetLength(this.tbUserName.Text) > 0x10))
        {
            str = str + "用户名长度在 5-16 个英文字符或数字、中文 3-8 之间.\r\n";
        }
        if ((this.tbPassword.Text.Length < 6) || (this.tbPassword.Text.Length > 0x10))
        {
            str = str + "密码长度必须在 6-16 位之间.\r\n";
        }
        if (this.tbSiteName.Text.Trim().Length == 0)
        {
            str = str + "网站名称不能为空.\r\n";
        }
        if (this.tbSiteURL.Text.Trim().Length == 0)
        {
            str = str + "网站地址不能为空.\r\n";
        }
        if (!_String.Valid.isEmail(this.tbEmail.Text))
        {
            str = str + "电子邮件地址格式不正确.\r\n";
        }
        if (!this.ckbAgree.Checked)
        {
            str = str + "必须同意本站会员注册协议才能注册会员。\r\n";
        }
        if (this.CheckCode2.Visible)
        {
            if (this.tbCheckCode.Text.Trim() == "")
            {
                str = str + "请输入验证码!\n";
            }
            else if (!this.ShoveCheckCode1.Valid(this.tbCheckCode.Text.Trim()))
            {
                str = str + "验证码输入有误!\n";
            }
        }
        if (str != "")
        {
            this.lblInputError.Visible = true;
            this.lblInputError.Text    = "输入资料错误:\r\n" + str;
        }
        else
        {
            long num  = -1L;
            long num2 = -1L;
            if (this.Session[this.KeyPromotionUserID] != null)
            {
                num2 = _Convert.StrToLong(this.Session[this.KeyPromotionUserID].ToString(), -1L);
            }
            object obj2 = MSSQL.ExecuteScalar("select ID from T_Cps where OwnerUserID=" + num2, new MSSQL.Parameter[0]);
            if (obj2 != null)
            {
                num = _Convert.StrToLong(obj2.ToString(), -1L);
            }
            Thread.Sleep(500);
            string str2  = this.tbUserName.Text.Trim();
            string str3  = this.tbPassword.Text.Trim();
            string str4  = this.tbEmail.Text.Trim();
            string str5  = this.tbTel.Text.Trim();
            string str6  = this.tbQQ.Text.Trim();
            Users  users = new Users(base._Site.ID)
            {
                Name     = str2,
                Password = str3,
                Email    = str4,
                Mobile   = str5,
                QQ       = str6,
                UserType = 2
            };
            if (num > 0L)
            {
                users.CommenderID = -1L;
                users.CpsID       = num;
            }
            else
            {
                users.CommenderID = num2;
                users.CpsID       = -1L;
            }
            string returnDescription = "";
            if (users.Add(ref returnDescription) < 0)
            {
                JavaScript.Alert(this, returnDescription);
            }
            else
            {
                double    num4  = 0.0;
                DataTable table = new Tables.T_Sites().Open("Opt_CpsBonusScale", "", "");
                if ((table != null) && (table.Rows.Count > 0))
                {
                    num4 = double.Parse(table.Rows[0]["Opt_CpsBonusScale"].ToString());
                }
                users.cps.SiteID     = 1L;
                users.cps.CommendID  = num2;
                users.cps.Name       = this.tbSiteName.Text;
                users.cps.Url        = this.tbSiteURL.Text;
                users.cps.BonusScale = num4;
                users.cps.ON         = true;
                users.cps.Telephone  = this.tbTel.Text.Trim();
                users.cps.Email      = str4;
                users.cps.QQ         = str6;
                users.cps.Type       = 2;
                users.cps.DomainName = users.GetPromotionURL(0);
                if (users.cps.Add(ref returnDescription) < 0)
                {
                    JavaScript.Alert(this, returnDescription);
                }
                else if (users.Login(ref returnDescription) < 0)
                {
                    JavaScript.Alert(this, returnDescription);
                }
                else
                {
                    base.Response.Redirect("../../Default.aspx");
                }
            }
        }
    }
Exemplo n.º 31
0
 public static double F_CurrentDateRegMemberPayMoneyBonusScaleSite_today(long SiteID, long UserID, DateTime CurrentDate)
 {
     return(Convert.ToDouble(MSSQL.ExecuteFunction("F_CurrentDateRegMemberPayMoneyBonusScaleSite_today", new MSSQL.Parameter[] { new MSSQL.Parameter("SiteID", SqlDbType.BigInt, 0, ParameterDirection.Input, SiteID), new MSSQL.Parameter("UserID", SqlDbType.BigInt, 0, ParameterDirection.Input, UserID), new MSSQL.Parameter("CurrentDate", SqlDbType.DateTime, 0, ParameterDirection.Input, CurrentDate) })));
 }