예제 #1
0
 public void Cancel(int LotteryId, string title, int state)
 {
     using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand();
         sqlCommand.Connection = sqlConnection;
         SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
         sqlDataAdapter.SelectCommand = sqlCommand;
         try
         {
             string str = LotteryUtils.LotteryTitle(LotteryId);
             if (state == 0)
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = "select * From N_UserBet with(nolock)  where state=0 and LotteryId='" + LotteryId.ToString() + "' and IssueNum='" + title + "' order by id asc";
             }
             else
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = "select * From N_UserBet with(nolock)  where (state<>0 and state<>1) and LotteryId='" + LotteryId.ToString() + "' and IssueNum='" + title + "' order by id asc";
             }
             DataTable dataTable = new DataTable();
             sqlDataAdapter.Fill(dataTable);
             foreach (DataRow row in (InternalDataCollectionBase)dataTable.Rows)
             {
                 int int32 = Convert.ToInt32(row["id"].ToString());
                 Convert.ToInt32(row["UserId"].ToString());
                 if (!CheckOperation.AdminCancel(int32, sqlCommand))
                 {
                     new LogExceptionDAL().Save("派奖异常", str + " 投注ID:" + (object)int32 + "撤单");
                 }
             }
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
예제 #2
0
 public void Cancel(int LotteryId, string title, int state)
 {
     using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
     {
         sqlConnection.Open();
         SqlCommand sqlCommand = new SqlCommand();
         sqlCommand.Connection = sqlConnection;
         SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
         sqlDataAdapter.SelectCommand = sqlCommand;
         try
         {
             string text = LotteryUtils.LotteryTitle(LotteryId);
             if (state == 0)
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = string.Concat(new string[]
                 {
                     "select * From N_UserBet with(nolock)  where state=0 and LotteryId='",
                     LotteryId.ToString(),
                     "' and IssueNum='",
                     title,
                     "' order by id asc"
                 });
             }
             else
             {
                 sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                 sqlDataAdapter.SelectCommand.CommandText = string.Concat(new string[]
                 {
                     "select * From N_UserBet with(nolock)  where (state<>0 and state<>1) and LotteryId='",
                     LotteryId.ToString(),
                     "' and IssueNum='",
                     title,
                     "' order by id asc"
                 });
             }
             DataTable dataTable = new DataTable();
             sqlDataAdapter.Fill(dataTable);
             foreach (DataRow dataRow in dataTable.Rows)
             {
                 int num = Convert.ToInt32(dataRow["id"].ToString());
                 Convert.ToInt32(dataRow["UserId"].ToString());
                 if (!CheckOperation.AdminCancel(num, sqlCommand))
                 {
                     new LogExceptionDAL().Save("派奖异常", string.Concat(new object[]
                     {
                         text,
                         " 投注ID:",
                         num,
                         "撤单"
                     }));
                 }
             }
         }
         catch (Exception ex)
         {
             new LogExceptionDAL().Save("程序异常", ex.Message);
         }
         finally
         {
             if (sqlConnection != null)
             {
                 sqlConnection.Close();
             }
         }
     }
 }
예제 #3
0
        public static string RunOper(int Type, string Title)
        {
            string result = "";

            using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
                sqlDataAdapter.SelectCommand = sqlCommand;
                try
                {
                    sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                    sqlDataAdapter.SelectCommand.CommandText = string.Format("select top 1 Type,Title,Number from Sys_LotteryData where Type={0} and Title='{1}'", Type, Title);
                    DataTable dataTable = new DataTable();
                    sqlDataAdapter.Fill(dataTable);
                    if (dataTable.Rows.Count > 0)
                    {
                        string lotteryNumber = dataTable.Rows[0]["Number"].ToString();
                        sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                        sqlDataAdapter.SelectCommand.CommandText = string.Format("select b.username,b.point as uPoint,a.* \r\n                                                    From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id \r\n                                                    where a.State=0 and LotteryId={0} and IssueNum='{1}'", dataTable.Rows[0]["Type"].ToString(), dataTable.Rows[0]["Title"].ToString());
                        DataTable dataTable2 = new DataTable("N_UserBet");
                        sqlDataAdapter.Fill(dataTable2);
                        if (dataTable2.Rows.Count > 0)
                        {
                            foreach (DataRow dataRow in dataTable2.Rows)
                            {
                                if (Convert.ToInt32(dataRow["State"].ToString()) == 0)
                                {
                                    CheckOperation.Checking(dataRow, lotteryNumber, sqlCommand);
                                }
                            }
                            foreach (DataRow dataRow2 in dataTable2.Rows)
                            {
                                string  userName  = dataRow2["UserName"].ToString();
                                int     userPoint = Convert.ToInt32(dataRow2["uPoint"]);
                                int     betId     = Convert.ToInt32(dataRow2["Id"]);
                                string  ssId      = dataRow2["SsId"].ToString();
                                int     userId    = Convert.ToInt32(dataRow2["UserId"]);
                                int     lotteryId = Convert.ToInt32(dataRow2["LotteryId"]);
                                int     playId    = Convert.ToInt32(dataRow2["PlayId"]);
                                decimal d         = Convert.ToDecimal(dataRow2["Total"]);
                                decimal d2        = Convert.ToDecimal(dataRow2["Times"]);
                                CheckOperation.AgencyPoint(ssId, userId, userName, userPoint, lotteryId, playId, betId, Convert.ToDecimal(d * d2), sqlCommand);
                            }
                            sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                            sqlDataAdapter.SelectCommand.CommandText = string.Format("select UserId,sum(times*total) as bet,sum(WinBonus) as win,sum(RealGet) as RealGet  From N_UserBet with(nolock) \r\n                                                            where lotteryId={0} and IssueNum='{1}' group by UserId", Type, Title);
                            DataTable dataTable3 = new DataTable();
                            sqlDataAdapter.Fill(dataTable3);
                            foreach (DataRow dataRow3 in dataTable3.Rows)
                            {
                                string userId2 = dataRow3["UserId"].ToString();
                                string str     = LotteryUtils.LotteryTitle(Type);
                                string str2    = Convert.ToDecimal(dataRow3["bet"]).ToString("0.0000");
                                string str3    = Convert.ToDecimal(dataRow3["win"]).ToString("0.0000");
                                string str4    = Convert.ToDecimal(dataRow3["RealGet"]).ToString("0.0000");
                                string text    = "投注彩种 " + str + "<br/>";
                                text = text + "投注期号 " + Title + "<br/>";
                                text = text + "投注金额 " + str2 + "元<br/>";
                                text = text + "中奖金额 " + str3 + "元<br/>";
                                text = text + "本次盈亏 " + str4 + "元";
                                LotteryCheck.SetUserJson(userId2, Type + Title, text);
                            }
                            dataTable2.Dispose();
                            dataTable.Dispose();
                        }
                        else
                        {
                            result = "该期没有开奖号码,请手动添加!";
                        }
                    }
                    else
                    {
                        result = "该期没有开奖号码,请手动添加!";
                    }
                }
                catch (Exception ex)
                {
                    result = "派奖出现错误,请重试!";
                    new LogExceptionDAL().Save("派奖异常", ex.Message);
                }
                finally
                {
                    sqlConnection.Dispose();
                    sqlConnection.Close();
                }
            }
            return(result);
        }
예제 #4
0
 public void GetLotteryTime(string Lid, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         string   str1      = "[{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}]".Replace("名称", LotteryUtils.LotteryTitle(int.Parse(Lid))).Replace("彩种类别", Lid);
         DateTime dateTime1 = DateTime.Now;
         DateTime now       = DateTime.Now;
         string   str2      = now.ToString("yyyyMMdd");
         string   str3      = now.ToString("HH:mm:ss");
         now.ToString("yyyy-MM-dd");
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = "select dbo.f_GetCloseTime(" + Lid + ") as closetime";
         DataTable dataTable1 = dbOperHandler.GetDataTable();
         string    str4       = str1.Replace("封单时间", dataTable1.Rows[0]["closetime"].ToString());
         string    newValue1;
         string    newValue2;
         TimeSpan  timeSpan;
         if (Lid == "3002" || Lid == "3003")
         {
             DateTime dateTime2 = Convert.ToDateTime(now.Year.ToString() + "-01-01 20:30:00");
             dbOperHandler.Reset();
             dbOperHandler.SqlCmd = "select datediff(d,'" + dateTime2.ToString("yyyy-MM-dd HH:mm:ss") + "','" + now.ToString("yyyy-MM-dd HH:mm:ss") + "') as d";
             int    Num  = Convert.ToInt32(dbOperHandler.GetDataTable().Rows[0]["d"]) - 7 + 1;
             string str5 = now.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00";
             string str6 = now.ToString("yyyy-MM-dd") + " 20:30:00";
             if (now > Convert.ToDateTime(now.ToString(" 20:30:00")))
             {
                 str6 = now.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00";
             }
             else
             {
                 --Num;
             }
             newValue1 = now.Year.ToString() + Func.AddZero(Num, 3);
             newValue2 = now.Year.ToString() + Func.AddZero(Num + 1, 3);
             timeSpan  = Convert.ToDateTime(str6) - Convert.ToDateTime(str3);
         }
         else
         {
             if (ComData.LotteryTime == null)
             {
                 ComData.LotteryTime = new LotteryTimeDAL().GetTable();
             }
             DataRow[] dataRowArray1 = ComData.LotteryTime.Select("Time >'" + str3 + "' and LotteryId=" + Lid, "Time asc");
             if (dataRowArray1.Length == 0)
             {
                 dataRowArray1 = ComData.LotteryTime.Select("Time <='" + str3 + "' and LotteryId=" + Lid, "Time asc");
                 newValue2     = now.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString();
             }
             else
             {
                 newValue2 = str2 + "-" + dataRowArray1[0]["Sn"].ToString();
                 dateTime1 = Convert.ToDateTime(dataRowArray1[0]["Time"].ToString());
                 if (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 10:00:01") && Lid == "1003")
                 {
                     newValue2 = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString();
                 }
             }
             if (Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()) < Convert.ToDateTime(str3))
             {
                 dateTime1 = Convert.ToDateTime(now.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataRowArray1[0]["Time"].ToString());
             }
             timeSpan = dateTime1 - Convert.ToDateTime(str3);
             DataRow[] dataRowArray2 = ComData.LotteryTime.Select("Time <'" + str3 + "' and LotteryId=" + Lid, "Time desc");
             if (dataRowArray2.Length == 0)
             {
                 dataRowArray2 = ComData.LotteryTime.Select("LotteryId=" + Lid, "Time desc");
                 newValue1     = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString();
             }
             else
             {
                 newValue1 = str2 + "-" + dataRowArray2[0]["Sn"].ToString();
                 if (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 10:00:01") && Lid == "1003")
                 {
                     newValue1 = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString();
                 }
             }
             if (Lid == "4001")
             {
                 DateTime dateTime2 = Convert.ToDateTime("2016-01-01 00:00:00");
                 dbOperHandler.Reset();
                 dbOperHandler.SqlCmd = "select datediff(d,'" + dateTime2.ToString("yyyy-MM-dd HH:mm:ss") + "','" + now.ToString("yyyy-MM-dd HH:mm:ss") + "') as d";
                 DataTable dataTable2 = dbOperHandler.GetDataTable();
                 if (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 09:07:01") || now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 23:57:01") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 23:59:59"))
                 {
                     newValue1 = string.Concat((object)(530900 + (Convert.ToInt32(dataTable2.Rows[0]["d"]) - 8) * 179 + Convert.ToInt32(dataRowArray2[0]["Sn"])));
                     newValue2 = string.Concat((object)(530900 + (Convert.ToInt32(dataTable2.Rows[0]["d"]) - 8) * 179 + Convert.ToInt32(dataRowArray2[0]["Sn"]) + 1));
                 }
                 else
                 {
                     newValue1 = string.Concat((object)(530900 + (Convert.ToInt32(dataTable2.Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(dataRowArray2[0]["Sn"])));
                     newValue2 = string.Concat((object)(530900 + (Convert.ToInt32(dataTable2.Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(dataRowArray2[0]["Sn"]) + 1));
                 }
             }
             if (Lid == "1010" || Lid == "1017" || Lid == "3004")
             {
                 newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1010") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                 newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
             }
             if (Lid == "1012")
             {
                 newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                 newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
             }
             if (Lid == "1013")
             {
                 newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())));
                 newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1));
             }
         }
         string newValue3 = string.Concat((object)(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds));
         string str7      = str4.Replace("下期期号", newValue2).Replace("当前期号", newValue1).Replace("倒计时", newValue3);
         _jsonstr = str7;
     }
 }
예제 #5
0
        public static string RunOper(int Type, string Title)
        {
            string str1 = "";

            using (SqlConnection sqlConnection = new SqlConnection(ComData.connectionString))
            {
                sqlConnection.Open();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
                sqlDataAdapter.SelectCommand = sqlCommand;
                try
                {
                    sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                    sqlDataAdapter.SelectCommand.CommandText = string.Format("select top 1 Type,Title,Number from Sys_LotteryData where Type={0} and Title='{1}'", (object)Type, (object)Title);
                    DataTable dataTable1 = new DataTable();
                    sqlDataAdapter.Fill(dataTable1);
                    if (dataTable1.Rows.Count > 0)
                    {
                        string LotteryNumber = dataTable1.Rows[0]["Number"].ToString();
                        sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                        sqlDataAdapter.SelectCommand.CommandText = string.Format("select b.username,b.point as uPoint,a.* \r\n                                                    From N_UserBet a with(nolock) left join N_User b on a.UserId=b.Id \r\n                                                    where a.State=0 and LotteryId={0} and IssueNum='{1}'", (object)dataTable1.Rows[0][nameof(Type)].ToString(), (object)dataTable1.Rows[0][nameof(Title)].ToString());
                        DataTable dataTable2 = new DataTable("N_UserBet");
                        sqlDataAdapter.Fill(dataTable2);
                        if (dataTable2.Rows.Count > 0)
                        {
                            foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
                            {
                                if (Convert.ToInt32(row["State"].ToString()) == 0)
                                {
                                    CheckOperation.Checking(row, LotteryNumber, sqlCommand);
                                }
                            }
                            foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
                            {
                                string  UserName = row["UserName"].ToString();
                                int     int32_1  = Convert.ToInt32(row["uPoint"]);
                                int     int32_2  = Convert.ToInt32(row["Id"]);
                                string  ssId     = row["SsId"].ToString();
                                int     int32_3  = Convert.ToInt32(row["UserId"]);
                                int     int32_4  = Convert.ToInt32(row["LotteryId"]);
                                int     int32_5  = Convert.ToInt32(row["PlayId"]);
                                Decimal num1     = Convert.ToDecimal(row["Total"]);
                                Decimal num2     = Convert.ToDecimal(row["Times"]);
                                CheckOperation.AgencyPoint(ssId, int32_3, UserName, int32_1, int32_4, int32_5, int32_2, Convert.ToDecimal(num1 * num2), sqlCommand);
                            }
                            sqlDataAdapter.SelectCommand.CommandType = CommandType.Text;
                            sqlDataAdapter.SelectCommand.CommandText = string.Format("select UserId,sum(times*total) as bet,sum(WinBonus) as win,sum(RealGet) as RealGet  From N_UserBet with(nolock) \r\n                                                            where lotteryId={0} and IssueNum='{1}' group by UserId", (object)Type, (object)Title);
                            DataTable dataTable3 = new DataTable();
                            sqlDataAdapter.Fill(dataTable3);
                            foreach (DataRow row in (InternalDataCollectionBase)dataTable3.Rows)
                            {
                                string UserId  = row["UserId"].ToString();
                                string str2    = LotteryUtils.LotteryTitle(Type);
                                string str3    = Title;
                                string str4    = Convert.ToDecimal(row["bet"]).ToString("0.0000");
                                string str5    = Convert.ToDecimal(row["win"]).ToString("0.0000");
                                string str6    = Convert.ToDecimal(row["RealGet"]).ToString("0.0000");
                                string content = "投注彩种 " + str2 + "<br/>" + "投注期号 " + str3 + "<br/>" + "投注金额 " + str4 + "元<br/>" + "中奖金额 " + str5 + "元<br/>" + "本次盈亏 " + str6 + "元";
                                LotteryCheck.SetUserJson(UserId, Type.ToString() + str3, content);
                            }
                            dataTable2.Dispose();
                            dataTable1.Dispose();
                        }
                        else
                        {
                            str1 = "该期没有开奖号码,请手动添加!";
                        }
                    }
                    else
                    {
                        str1 = "该期没有开奖号码,请手动添加!";
                    }
                }
                catch (Exception ex)
                {
                    str1 = "派奖出现错误,请重试!";
                    new LogExceptionDAL().Save("派奖异常", ex.Message);
                }
                finally
                {
                    sqlConnection.Dispose();
                    sqlConnection.Close();
                }
            }
            return(str1);
        }
예제 #6
0
        public void GetLotteryTime(string Lid, ref string _jsonstr)
        {
            string text = "[{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}]";

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                text = text.Replace("名称", LotteryUtils.LotteryTitle(int.Parse(Lid))).Replace("彩种类别", Lid);
                DateTime d     = DateTime.Now;
                DateTime now   = DateTime.Now;
                string   str   = now.ToString("yyyyMMdd");
                string   text2 = now.ToString("HH:mm:ss");
                now.ToString("yyyy-MM-dd");
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "select dbo.f_GetCloseTime(" + Lid + ") as closetime";
                DataTable dataTable = dbOperHandler.GetDataTable();
                text = text.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString());
                string   text3;
                string   newValue;
                TimeSpan timeSpan;
                if (Lid == "3002" || Lid == "3003")
                {
                    DateTime dateTime = Convert.ToDateTime(now.Year.ToString() + "-01-01 20:30:00");
                    dbOperHandler.Reset();
                    dbOperHandler.SqlCmd = string.Concat(new string[]
                    {
                        "select datediff(d,'",
                        dateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        "','",
                        now.ToString("yyyy-MM-dd HH:mm:ss"),
                        "') as d"
                    });
                    DataTable dataTable2 = dbOperHandler.GetDataTable();
                    int       num        = Convert.ToInt32(dataTable2.Rows[0]["d"]) - 7;
                    num++;
                    //now.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00";
                    string value = now.ToString("yyyy-MM-dd") + " 20:30:00";
                    if (now > Convert.ToDateTime(now.ToString(" 20:30:00")))
                    {
                        value = now.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00";
                    }
                    else
                    {
                        num--;
                    }
                    text3    = now.Year.ToString() + Func.AddZero(num, 3);
                    newValue = now.Year.ToString() + Func.AddZero(num + 1, 3);
                    timeSpan = Convert.ToDateTime(value) - Convert.ToDateTime(text2);
                }
                else
                {
                    if (ComData.LotteryTime == null)
                    {
                        ComData.LotteryTime = new LotteryTimeDAL().GetTable();
                    }
                    DataRow[] array = ComData.LotteryTime.Select(string.Concat(new object[]
                    {
                        "Time >'",
                        text2,
                        "' and LotteryId=",
                        Lid
                    }), "Time asc");
                    if (array.Length == 0)
                    {
                        array = ComData.LotteryTime.Select(string.Concat(new object[]
                        {
                            "Time <='",
                            text2,
                            "' and LotteryId=",
                            Lid
                        }), "Time asc");
                        newValue = now.AddDays(1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString();
                    }
                    else
                    {
                        newValue = str + "-" + array[0]["Sn"].ToString();
                        d        = Convert.ToDateTime(array[0]["Time"].ToString());
                        if (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 10:00:01") && Lid == "1003")
                        {
                            newValue = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString();
                        }
                    }
                    if (Convert.ToDateTime(array[0]["Time"].ToString()) < Convert.ToDateTime(text2))
                    {
                        d = Convert.ToDateTime(now.AddDays(1.0).ToString("yyyy-MM-dd") + " " + array[0]["Time"].ToString());
                    }
                    timeSpan = d - Convert.ToDateTime(text2);
                    DataRow[] array2 = ComData.LotteryTime.Select(string.Concat(new object[]
                    {
                        "Time <'",
                        text2,
                        "' and LotteryId=",
                        Lid
                    }), "Time desc");
                    if (array2.Length == 0)
                    {
                        array2 = ComData.LotteryTime.Select(string.Concat(new object[]
                        {
                            "LotteryId=",
                            Lid
                        }), "Time desc");
                        text3 = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString();
                    }
                    else
                    {
                        text3 = str + "-" + array2[0]["Sn"].ToString();
                        if (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 10:00:01") && Lid == "1003")
                        {
                            text3 = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString();
                        }
                    }
                    if (Lid == "4001")
                    {
                        DateTime dateTime2 = Convert.ToDateTime("2016-01-01 00:00:00");
                        dbOperHandler.Reset();
                        dbOperHandler.SqlCmd = string.Concat(new string[]
                        {
                            "select datediff(d,'",
                            dateTime2.ToString("yyyy-MM-dd HH:mm:ss"),
                            "','",
                            now.ToString("yyyy-MM-dd HH:mm:ss"),
                            "') as d"
                        });
                        DataTable dataTable3 = dbOperHandler.GetDataTable();
                        if ((now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 00:00:00") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 09:07:01")) || (now > Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 23:57:01") && now < Convert.ToDateTime(now.ToString("yyyy-MM-dd") + " 23:59:59")))
                        {
                            text3    = string.Concat(530900 + (Convert.ToInt32(dataTable3.Rows[0]["d"]) - 8) * 179 + Convert.ToInt32(array2[0]["Sn"]));
                            newValue = string.Concat(530900 + (Convert.ToInt32(dataTable3.Rows[0]["d"]) - 8) * 179 + Convert.ToInt32(array2[0]["Sn"]) + 1);
                        }
                        else
                        {
                            text3    = string.Concat(530900 + (Convert.ToInt32(dataTable3.Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(array2[0]["Sn"]));
                            newValue = string.Concat(530900 + (Convert.ToInt32(dataTable3.Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(array2[0]["Sn"]) + 1);
                        }
                    }
                    if (Lid == "1010" || Lid == "1017" || Lid == "3004")
                    {
                        text3    = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1010") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                        newValue = string.Concat(Convert.ToInt32(text3) + 1);
                    }
                    if (Lid == "1012")
                    {
                        text3    = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                        newValue = string.Concat(Convert.ToInt32(text3) + 1);
                    }
                    if (Lid == "1013")
                    {
                        text3    = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(array2[0]["Sn"].ToString()));
                        newValue = string.Concat(Convert.ToInt32(text3) + 1);
                    }
                }
                string newValue2 = string.Concat(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds);
                text     = text.Replace("下期期号", newValue).Replace("当前期号", text3).Replace("倒计时", newValue2);
                _jsonstr = text;
            }
        }