public string GetCurrentSn(int loid) { using (DbOperHandler dbOperHandler = new ComData().Doh()) { DateTime now = DateTime.Now; string str; if (loid == 3002 || loid == 3003) { DateTime dateTime = Convert.ToDateTime(now.Year.ToString() + "-01-01 20:30:00"); dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select datediff(d,'" + dateTime.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; str = now.Year.ToString() + Func.AddZero(Num, 3); } else { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top 1 Sn from Sys_LotteryTime where LotteryId=" + (object)loid + " and Time < '" + now.ToString("HH:mm:ss") + "' order by time desc"; DataTable dataTable = dbOperHandler.GetDataTable(); if (dataTable.Rows.Count < 1) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top 1 Sn from Sys_LotteryTime where LotteryId=" + (object)loid + " order by time desc"; dataTable = dbOperHandler.GetDataTable(); str = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataTable.Rows[0]["Sn"].ToString(); } else { str = now.ToString("yyyyMMdd") + "-" + dataTable.Rows[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") && loid == 1003) { str = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataTable.Rows[0]["Sn"].ToString(); } } if (loid == 4001) { DateTime dateTime = Convert.ToDateTime("2016-01-01 00:00:00"); dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select datediff(d,'" + dateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + now.ToString("yyyy-MM-dd HH:mm:ss") + "') as d"; str = string.Concat((object)(530900 + (Convert.ToInt32(dbOperHandler.GetDataTable().Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(dataTable.Rows[0]["Sn"].ToString()))); } dataTable.Clear(); dataTable.Dispose(); } return(str); } }
private void ajaxZHIssueNum() { string text = base.q("lid"); string text2 = base.q("flag"); DateTime dateTime = base.GetDateTime(); string str = dateTime.ToString("yyyyMMdd"); string text3 = dateTime.ToString("HH:mm:ss"); string text4 = dateTime.ToString("yyyy-MM-dd"); if (text == "3002" || text == "3003") { DateTime dateTime2 = Convert.ToDateTime(dateTime.Year.ToString() + "-01-01 20:30:00"); this.doh.Reset(); this.doh.SqlCmd = string.Concat(new string[] { "select datediff(d,'", dateTime2.ToString("yyyy-MM-dd HH:mm:ss"), "','", dateTime.ToString("yyyy-MM-dd HH:mm:ss"), "') as d" }); DataTable dataTable = this.doh.GetDataTable(); int num = Convert.ToInt32(dataTable.Rows[0]["d"]) - 6; num++; string text5 = dateTime.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; string text6 = dateTime.ToString("yyyy-MM-dd") + " 20:30:00"; if (dateTime > Convert.ToDateTime(dateTime.ToString(" 20:30:00"))) { text6 = dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { num--; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i <= 9; i++) { string text7 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; text7 = text7.Replace("编号", (i + 1).ToString()).Replace("期号", dateTime.Year.ToString() + Func.AddZero(num + i, 3)).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", dateTime.AddDays((double)i).ToString("yyyy-MM-dd") + " 20:30:00"); stringBuilder.Append(text7); } this._response = string.Concat(new string[] { "{\"result\" :\"1\",\"lotteryid\" :\"", text, "\",\"totalcount\" :\"10\",\"table\": [", stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1), "]}" }); } else { if (UserCenterSession.LotteryTime == null) { UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] array = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "Time >'", text3, "' and LotteryId=", text }), "Time asc"); if (array.Length == 0) { array = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "Time <='", text3, "' and LotteryId=", text }), "Time asc"); str = dateTime.AddDays(1.0).ToString("yyyyMMdd"); } if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime < Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 02:00:01")) { if (text == "1003") { str = dateTime.AddDays(-1.0).ToString("yyyyMMdd"); } } int num2 = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "LotteryId=", text }), "Time asc").Length; if (num2 > 120) { num2 = 120; } StringBuilder stringBuilder = new StringBuilder(); this.doh.Reset(); if (text2.Equals("0")) { this.doh.SqlCmd = string.Concat(new object[] { "select top ", num2, " * from Sys_LotteryTime where lotteryid=", text, " and sn>=", array[0]["Sn"].ToString(), "order by Convert(int,sn) asc" }); } if (text2.Equals("1")) { this.doh.SqlCmd = string.Concat(new object[] { "select top ", num2, " * from Sys_LotteryTime where lotteryid=", text, " and sn>", array[0]["Sn"].ToString(), "order by Convert(int,sn) asc" }); } DataTable dataTable2 = this.doh.GetDataTable(); for (int i = 0; i < dataTable2.Rows.Count; i++) { string text8 = str + "-" + dataTable2.Rows[i]["sn"].ToString(); if (text == "1010" || text == "1017" || text == "1011" || text == "1012" || text == "1013" || text == "3004" || text == "3005") { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + Convert.ToInt32(dataTable2.Rows[i]["sn"].ToString())); } if (text == "4001") { if ((DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00") && DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 09:07:01")) || (DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:57:01") && DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"))) { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + 179 + Convert.ToInt32(dataTable2.Rows[i]["sn"].ToString())); } else { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + Convert.ToInt32(dataTable2.Rows[i]["sn"].ToString())); } } if (text == "1014" || text == "1015" || text == "1016") { text8 = text8.Replace("-", ""); } string text9 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; text9 = text9.Replace("编号", (i + 1).ToString()).Replace("期号", text8).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", dateTime.ToString("yyyy-MM-dd") + " " + dataTable2.Rows[i]["time"]); stringBuilder.Append(text9); } this.doh.Reset(); this.doh.SqlCmd = string.Concat(new object[] { "select top ", num2 - dataTable2.Rows.Count, " * from Sys_LotteryTime where lotteryid=", text, " order by Convert(int,sn) asc" }); DataTable dataTable3 = this.doh.GetDataTable(); for (int i = 0; i < dataTable3.Rows.Count; i++) { string text8 = dateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataTable3.Rows[i]["sn"].ToString(); if (text == "1010" || text == "3004") { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + 880 + Convert.ToInt32(dataTable3.Rows[i]["sn"].ToString())); } if (text == "1012") { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + 660 + Convert.ToInt32(dataTable3.Rows[i]["sn"].ToString())); } if (text == "1013") { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + 203 + Convert.ToInt32(dataTable3.Rows[i]["sn"].ToString())); } if (text == "4001") { if ((DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00") && DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 09:07:01")) || (DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:57:01") && DateTime.Now < Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"))) { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + 179 + Convert.ToInt32(dataTable3.Rows[i]["sn"].ToString())); } else { text8 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + Convert.ToInt32(dataTable3.Rows[i]["sn"].ToString())); } } if (text == "1014" || text == "1015" || text == "1016") { text8 = text8.Replace("-", ""); } string text7 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; text7 = text7.Replace("编号", (i + 1 + dataTable2.Rows.Count).ToString()).Replace("期号", text8).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataTable3.Rows[i]["time"]); stringBuilder.Append(text7); } this._response = string.Concat(new object[] { "{\"result\" :\"1\",\"lotteryid\" :\"", text, "\",\"totalcount\" :\"", num2, "\",\"table\": [", stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1), "]}" }); } }
public void GetLotteryZhList(string Lid, ref string _jsonstr) { DateTime now = DateTime.Now; string str1 = now.ToString("yyyyMMdd"); string str2 = now.ToString("HH:mm:ss"); now.ToString("yyyy-MM-dd"); using (DbOperHandler dbOperHandler = new ComData().Doh()) { if (Lid == "3002" || Lid == "3003") { DateTime dateTime = Convert.ToDateTime(now.Year.ToString() + "-01-01 20:30:00"); dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select datediff(d,'" + dateTime.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 str3 = now.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; string str4 = now.ToString("yyyy-MM-dd") + " 20:30:00"; if (now > Convert.ToDateTime(now.ToString(" 20:30:00"))) { string str5 = now.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { --num; } StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index <= 9; ++index) { string str6 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},".Replace("编号", (index + 1).ToString()).Replace("期号", now.Year.ToString() + Func.AddZero(num + (index + 1), 3)).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.AddDays((double)index).ToString("yyyy-MM-dd") + " 20:30:00"); stringBuilder.Append(str6); } _jsonstr = "[" + stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1) + "]"; } else { if (ComData.LotteryTime == null) { ComData.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] dataRowArray = ComData.LotteryTime.Select("Time >'" + str2 + "' and LotteryId=" + Lid, "Time asc"); if (dataRowArray.Length == 0) { dataRowArray = ComData.LotteryTime.Select("Time <='" + str2 + "' and LotteryId=" + Lid, "Time asc"); str1 = now.AddDays(1.0).ToString("yyyyMMdd"); } int num = ComData.LotteryTime.Select("LotteryId=" + Lid, "Time asc").Length; if (num > 120) { num = 120; } StringBuilder stringBuilder = new StringBuilder(); dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top " + (object)num + " * from Sys_LotteryTime where lotteryid=" + Lid + " and sn>=" + dataRowArray[0]["Sn"].ToString() + "order by sn asc"; DataTable dataTable1 = dbOperHandler.GetDataTable(); for (int index = 0; index < dataTable1.Rows.Count; ++index) { string str3 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string newValue = str1 + "-" + dataTable1.Rows[index]["sn"].ToString(); if (Lid == "1010" || Lid == "1017" || (Lid == "3004" || Lid == "1012") || Lid == "1013") { newValue = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(Lid) + Convert.ToInt32(dataTable1.Rows[index]["sn"].ToString()))); } string str4 = str3.Replace("编号", (index + 1).ToString()).Replace("期号", newValue).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.ToString("yyyy-MM-dd") + " " + dataTable1.Rows[index]["time"]); stringBuilder.Append(str4); } dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top " + (object)(num - dataTable1.Rows.Count) + " * from Sys_LotteryTime where lotteryid=" + Lid + " order by sn asc"; DataTable dataTable2 = dbOperHandler.GetDataTable(); for (int index = 0; index < dataTable2.Rows.Count; ++index) { string str3 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string newValue = now.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataTable2.Rows[index]["sn"].ToString(); if (Lid == "1010" || Lid == "1017" || (Lid == "3004" || Lid == "1012") || Lid == "1013") { newValue = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(Lid) + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))); } string str4 = str3.Replace("编号", (index + 1 + dataTable1.Rows.Count).ToString()).Replace("期号", newValue).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataTable2.Rows[index]["time"]); stringBuilder.Append(str4); } _jsonstr = "[" + stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1) + "]"; } } }
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; } }
private void ajaxZHIssueNum() { string lotteryId = this.q("lid"); string str1 = this.q("flag"); DateTime dateTime1 = this.GetDateTime(); string str2 = dateTime1.ToString("yyyyMMdd"); string str3 = dateTime1.ToString("HH:mm:ss"); dateTime1.ToString("yyyy-MM-dd"); if (lotteryId == "3002" || lotteryId == "3003") { int num1 = dateTime1.Year; DateTime dateTime2 = Convert.ToDateTime(num1.ToString() + "-01-01 20:30:00"); this.doh.Reset(); this.doh.SqlCmd = "select datediff(d,'" + dateTime2.ToString("yyyy-MM-dd HH:mm:ss") + "','" + dateTime1.ToString("yyyy-MM-dd HH:mm:ss") + "') as d"; int num2 = Convert.ToInt32(this.doh.GetDataTable().Rows[0]["d"]) - 6 + 1; string str4 = dateTime1.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; string str5 = dateTime1.ToString("yyyy-MM-dd") + " 20:30:00"; if (dateTime1 > Convert.ToDateTime(dateTime1.ToString(" 20:30:00"))) { str5 = dateTime1.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { --num2; } StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index <= 9; ++index) { string str6 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string oldValue1 = "编号"; num1 = index + 1; string newValue1 = num1.ToString(); string str7 = str6.Replace(oldValue1, newValue1); string oldValue2 = "期号"; num1 = dateTime1.Year; string newValue2 = num1.ToString() + Func.AddZero(num2 + index, 3); string str8 = str7.Replace(oldValue2, newValue2).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", dateTime1.AddDays((double)index).ToString("yyyy-MM-dd") + " 20:30:00"); stringBuilder.Append(str8); } this._response = "{\"result\" :\"1\",\"lotteryid\" :\"" + lotteryId + "\",\"totalcount\" :\"10\",\"table\": [" + stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1) + "]}"; } else { if (UserCenterSession.LotteryTime == null) { UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] dataRowArray = UserCenterSession.LotteryTime.Select("Time >'" + str3 + "' and LotteryId=" + lotteryId, "Time asc"); DateTime dateTime2; if (dataRowArray.Length == 0) { dataRowArray = UserCenterSession.LotteryTime.Select("Time <='" + str3 + "' and LotteryId=" + lotteryId, "Time asc"); dateTime2 = dateTime1.AddDays(1.0); str2 = dateTime2.ToString("yyyyMMdd"); } if (dateTime1 > Convert.ToDateTime(dateTime1.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime1 < Convert.ToDateTime(dateTime1.ToString("yyyy-MM-dd") + " 02:00:01") && lotteryId == "1003") { dateTime2 = dateTime1.AddDays(-1.0); str2 = dateTime2.ToString("yyyyMMdd"); } int num1 = UserCenterSession.LotteryTime.Select("LotteryId=" + lotteryId, "Time asc").Length; if (num1 > 120) { num1 = 120; } StringBuilder stringBuilder = new StringBuilder(); this.doh.Reset(); if (str1.Equals("0")) { this.doh.SqlCmd = "select top " + (object)num1 + " * from Sys_LotteryTime where lotteryid=" + lotteryId + " and sn>=" + dataRowArray[0]["Sn"].ToString() + "order by Convert(int,sn) asc"; } if (str1.Equals("1")) { this.doh.SqlCmd = "select top " + (object)num1 + " * from Sys_LotteryTime where lotteryid=" + lotteryId + " and sn>" + dataRowArray[0]["Sn"].ToString() + "order by Convert(int,sn) asc"; } DataTable dataTable1 = this.doh.GetDataTable(); int num2; for (int index = 0; index < dataTable1.Rows.Count; ++index) { string newValue1 = str2 + "-" + dataTable1.Rows[index]["sn"].ToString(); if (lotteryId == "1010" || lotteryId == "1017" || (lotteryId == "1012" || lotteryId == "1013") || lotteryId == "3004") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + Convert.ToInt32(dataTable1.Rows[index]["sn"].ToString()))); } if (lotteryId == "4001") { DateTime now1 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime3 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00"); int num3; if (now1 > dateTime3) { DateTime now2 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime4 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 09:07:01"); if (now2 < dateTime4) { num3 = 0; goto label_30; } } DateTime now3 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime5 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 23:57:01"); if (now3 > dateTime5) { DateTime now2 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime4 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 23:59:59"); num3 = !(now2 < dateTime4) ? 1 : 0; } else { num3 = 1; } label_30: newValue1 = num3 != 0 ? string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + Convert.ToInt32(dataTable1.Rows[index]["sn"].ToString()))) : string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + 179 + Convert.ToInt32(dataTable1.Rows[index]["sn"].ToString()))); } if (lotteryId == "1014" || lotteryId == "1015" || lotteryId == "1016") { newValue1 = newValue1.Replace("-", ""); } string str4 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string oldValue = "编号"; num2 = index + 1; string newValue2 = num2.ToString(); string str5 = str4.Replace(oldValue, newValue2).Replace("期号", newValue1).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", dateTime1.ToString("yyyy-MM-dd") + " " + dataTable1.Rows[index]["time"]); stringBuilder.Append(str5); } this.doh.Reset(); this.doh.SqlCmd = "select top " + (object)(num1 - dataTable1.Rows.Count) + " * from Sys_LotteryTime where lotteryid=" + lotteryId + " order by Convert(int,sn) asc"; DataTable dataTable2 = this.doh.GetDataTable(); for (int index = 0; index < dataTable2.Rows.Count; ++index) { dateTime2 = dateTime1.AddDays(1.0); string newValue1 = dateTime2.ToString("yyyyMMdd") + "-" + dataTable2.Rows[index]["sn"].ToString(); if (lotteryId == "1010" || lotteryId == "1017" || lotteryId == "3004") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + 880 + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))); } if (lotteryId == "1012") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + 660 + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))); } if (lotteryId == "1013") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + 203 + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))); } if (lotteryId == "4001") { DateTime now1 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime3 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00"); int num3; if (now1 > dateTime3) { DateTime now2 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime4 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 09:07:01"); if (now2 < dateTime4) { num3 = 0; goto label_49; } } DateTime now3 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime5 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 23:57:01"); if (now3 > dateTime5) { DateTime now2 = DateTime.Now; dateTime2 = DateTime.Now; DateTime dateTime4 = Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 23:59:59"); num3 = !(now2 < dateTime4) ? 1 : 0; } else { num3 = 1; } label_49: newValue1 = num3 != 0 ? string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))) : string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(lotteryId) + 179 + Convert.ToInt32(dataTable2.Rows[index]["sn"].ToString()))); } if (lotteryId == "1014" || lotteryId == "1015" || lotteryId == "1016") { newValue1 = newValue1.Replace("-", ""); } string str4 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string oldValue1 = "编号"; num2 = index + 1 + dataTable1.Rows.Count; string newValue2 = num2.ToString(); string str5 = str4.Replace(oldValue1, newValue2).Replace("期号", newValue1).Replace("倍数", "0").Replace("金额", "0.00"); string oldValue2 = "时间"; dateTime2 = dateTime1.AddDays(1.0); string newValue3 = dateTime2.ToString("yyyy-MM-dd") + " " + dataTable2.Rows[index]["time"]; string str6 = str5.Replace(oldValue2, newValue3); stringBuilder.Append(str6); } this._response = "{\"result\" :\"1\",\"lotteryid\" :\"" + lotteryId + "\",\"totalcount\" :\"" + (object)num1 + "\",\"table\": [" + stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1) + "]}"; } }
private void ajaxLotteryTime() { string str1 = this.q("lid"); string str2 = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}".Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(str1))).Replace("彩种类别", str1); DateTime dateTime1 = DateTime.Now; DateTime dateTime2 = this.GetDateTime(); string str3 = dateTime2.ToString("yyyyMMdd"); string str4 = dateTime2.ToString("HH:mm:ss"); dateTime2.ToString("yyyy-MM-dd"); this.doh.Reset(); this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + str1 + ") as closetime"; DataTable dataTable = this.doh.GetDataTable(); string str5 = str2.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString()); string newValue1; string newValue2; TimeSpan timeSpan; if (str1 == "3002" || str1 == "3003") { int year = dateTime2.Year; DateTime dateTime3 = Convert.ToDateTime(year.ToString() + "-01-01 20:30:00"); this.doh.Reset(); this.doh.SqlCmd = "select datediff(d,'" + dateTime3.ToString("yyyy-MM-dd HH:mm:ss") + "','" + dateTime2.ToString("yyyy-MM-dd HH:mm:ss") + "') as d"; int Num = Convert.ToInt32(this.doh.GetDataTable().Rows[0]["d"]) - 7 + 1; DateTime dateTime4 = dateTime2.AddDays(-1.0); string str6 = dateTime4.ToString("yyyy-MM-dd") + " 20:30:00"; string str7 = dateTime2.ToString("yyyy-MM-dd") + " 20:30:00"; if (dateTime2 > Convert.ToDateTime(dateTime2.ToString(" 20:30:00"))) { dateTime4 = dateTime2.AddDays(1.0); str7 = dateTime4.ToString("yyyy-MM-dd") + " 20:30:00"; } else { --Num; } year = dateTime2.Year; newValue1 = year.ToString() + Func.AddZero(Num, 3); year = dateTime2.Year; newValue2 = year.ToString() + Func.AddZero(Num + 1, 3); timeSpan = Convert.ToDateTime(str7) - Convert.ToDateTime(str4); } else { if (UserCenterSession.LotteryTime == null) { UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] dataRowArray1 = UserCenterSession.LotteryTime.Select("Time >'" + str4 + "' and LotteryId=" + str1, "Time asc"); if (dataRowArray1.Length == 0) { dataRowArray1 = UserCenterSession.LotteryTime.Select("Time <='" + str4 + "' and LotteryId=" + str1, "Time asc"); newValue2 = dateTime2.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString(); } else { newValue2 = str3 + "-" + dataRowArray1[0]["Sn"].ToString(); dateTime1 = Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()); if (dateTime2 > Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime2 < Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 10:00:01") && str1 == "1003") { newValue2 = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString(); } } if (Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()) < Convert.ToDateTime(str4)) { dateTime1 = Convert.ToDateTime(dateTime2.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataRowArray1[0]["Time"].ToString()); } timeSpan = dateTime1 - Convert.ToDateTime(str4); DataRow[] dataRowArray2 = UserCenterSession.LotteryTime.Select("Time <'" + str4 + "' and LotteryId=" + str1, "Time desc"); if (dataRowArray2.Length == 0) { dataRowArray2 = UserCenterSession.LotteryTime.Select("LotteryId=" + str1, "Time desc"); newValue1 = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString(); } else { newValue1 = str3 + "-" + dataRowArray2[0]["Sn"].ToString(); if (dateTime2 > Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime2 < Convert.ToDateTime(dateTime2.ToString("yyyy-MM-dd") + " 10:00:01") && str1 == "1003") { newValue1 = dateTime2.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString(); } } if (str1 == "1010" || str1 == "1017" || str1 == "3004") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(str1) + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (str1 == "1012") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (str1 == "1013") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (str1 == "1014" || str1 == "1015" || str1 == "1016") { newValue1 = newValue1.Replace("-", ""); newValue2 = newValue2.Replace("-", ""); } if (str1 == "1011" || str1 == "3005") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1011") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (str1 == "4001") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("4001") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (str1 == "1005") { string str6 = string.Concat((object)(Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()) - 1)); if (str6.Length == 1) { str6 = "000" + str6; } if (str6.Length == 2) { str6 = "00" + str6; } if (str6.Length == 3) { str6 = "0" + str6; } string str7 = string.Concat((object)Convert.ToInt32(dataRowArray2[0]["Sn"].ToString())); if (str7.Length == 1) { str7 = "000" + str7; } if (str7.Length == 2) { str7 = "00" + str7; } if (str7.Length == 3) { str7 = "0" + str7; } newValue1 = dateTime2.ToString("yyyyMMdd") + "-" + str6; newValue2 = dateTime2.ToString("yyyyMMdd") + "-" + str7; } } string newValue3 = string.Concat((object)(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds)); this._response = str5.Replace("下期期号", newValue2).Replace("当前期号", newValue1).Replace("倒计时", newValue3); }
private void ajaxLotteryTime() { string text = base.q("lid"); string text2 = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"cursn\": \"当前期号\"}"; text2 = text2.Replace("名称", LotteryUtils.LotteryTitle(Convert.ToInt32(text))).Replace("彩种类别", text); DateTime d = DateTime.Now; DateTime dateTime = base.GetDateTime(); string str = dateTime.ToString("yyyyMMdd"); string text3 = dateTime.ToString("HH:mm:ss"); string text4 = dateTime.ToString("yyyy-MM-dd"); this.doh.Reset(); this.doh.SqlCmd = "select dbo.f_GetCloseTime(" + text + ") as closetime"; DataTable dataTable = this.doh.GetDataTable(); text2 = text2.Replace("封单时间", dataTable.Rows[0]["closetime"].ToString()); string text6; string text7; TimeSpan timeSpan; if (text == "3002" || text == "3003") { DateTime dateTime2 = Convert.ToDateTime(dateTime.Year.ToString() + "-01-01 20:30:00"); this.doh.Reset(); this.doh.SqlCmd = string.Concat(new string[] { "select datediff(d,'", dateTime2.ToString("yyyy-MM-dd HH:mm:ss"), "','", dateTime.ToString("yyyy-MM-dd HH:mm:ss"), "') as d" }); DataTable dataTable2 = this.doh.GetDataTable(); int num = Convert.ToInt32(dataTable2.Rows[0]["d"]) - 7; num++; string text5 = dateTime.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; string value = dateTime.ToString("yyyy-MM-dd") + " 20:30:00"; if (dateTime > Convert.ToDateTime(dateTime.ToString(" 20:30:00"))) { value = dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { num--; } text6 = dateTime.Year.ToString() + Func.AddZero(num, 3); text7 = dateTime.Year.ToString() + Func.AddZero(num + 1, 3); timeSpan = Convert.ToDateTime(value) - Convert.ToDateTime(text3); } else { if (UserCenterSession.LotteryTime == null) { UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] array = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "Time >'", text3, "' and LotteryId=", text }), "Time asc"); if (array.Length == 0) { array = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "Time <='", text3, "' and LotteryId=", text }), "Time asc"); text7 = dateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString(); } else { text7 = str + "-" + array[0]["Sn"].ToString(); d = Convert.ToDateTime(array[0]["Time"].ToString()); if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime < Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 10:00:01")) { if (text == "1003") { text7 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array[0]["Sn"].ToString(); } } } if (Convert.ToDateTime(array[0]["Time"].ToString()) < Convert.ToDateTime(text3)) { d = Convert.ToDateTime(dateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " " + array[0]["Time"].ToString()); } timeSpan = d - Convert.ToDateTime(text3); DataRow[] array2 = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "Time <'", text3, "' and LotteryId=", text }), "Time desc"); if (array2.Length == 0) { array2 = UserCenterSession.LotteryTime.Select(string.Concat(new object[] { "LotteryId=", text }), "Time desc"); text6 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString(); } else { text6 = str + "-" + array2[0]["Sn"].ToString(); if (dateTime > Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 00:00:00") && dateTime < Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd") + " 10:00:01")) { if (text == "1003") { text6 = dateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + array2[0]["Sn"].ToString(); } } } if (text == "1010" || text == "1017" || text == "3004") { text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(text) + Convert.ToInt32(array2[0]["Sn"].ToString())); text7 = string.Concat(Convert.ToInt32(text6) + 1); } if (text == "1012") { text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(array2[0]["Sn"].ToString())); text7 = string.Concat(Convert.ToInt32(text6) + 1); } if (text == "1013") { text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(array2[0]["Sn"].ToString())); text7 = string.Concat(Convert.ToInt32(text6) + 1); } if (text == "1014" || text == "1015" || text == "1016") { text6 = text6.Replace("-", ""); text7 = text7.Replace("-", ""); } if (text == "1011" || text == "3005") { text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("1011") + Convert.ToInt32(array2[0]["Sn"].ToString())); text7 = string.Concat(Convert.ToInt32(text6) + 1); } if (text == "4001") { text6 = string.Concat(new LotteryTimeDAL().GetTsIssueNum("4001") + Convert.ToInt32(array2[0]["Sn"].ToString())); text7 = string.Concat(Convert.ToInt32(text6) + 1); } if (text == "1005") { string text8 = string.Concat(Convert.ToInt32(array2[0]["Sn"].ToString()) - 1); if (text8.Length == 1) { text8 = "000" + text8; } if (text8.Length == 2) { text8 = "00" + text8; } if (text8.Length == 3) { text8 = "0" + text8; } string text9 = string.Concat(Convert.ToInt32(array2[0]["Sn"].ToString())); if (text9.Length == 1) { text9 = "000" + text9; } if (text9.Length == 2) { text9 = "00" + text9; } if (text9.Length == 3) { text9 = "0" + text9; } text6 = dateTime.ToString("yyyyMMdd") + "-" + text8; text7 = dateTime.ToString("yyyyMMdd") + "-" + text9; } } string newValue = string.Concat(timeSpan.Days * 24 * 60 * 60 + timeSpan.Hours * 60 * 60 + timeSpan.Minutes * 60 + timeSpan.Seconds); text2 = text2.Replace("下期期号", text7).Replace("当前期号", text6).Replace("倒计时", newValue); this._response = text2; }
public string GetCurrentSn(int loid) { string result; using (DbOperHandler dbOperHandler = new ComData().Doh()) { DateTime now = DateTime.Now; string text; if (loid == 3002 || loid == 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 dataTable = dbOperHandler.GetDataTable(); int num = Convert.ToInt32(dataTable.Rows[0]["d"]) - 7; text = now.Year.ToString() + Func.AddZero(num, 3); } else { dbOperHandler.Reset(); dbOperHandler.SqlCmd = string.Concat(new object[] { "select top 1 Sn from Sys_LotteryTime where LotteryId=", loid, " and Time < '", now.ToString("HH:mm:ss"), "' order by time desc" }); DataTable dataTable2 = dbOperHandler.GetDataTable(); if (dataTable2.Rows.Count < 1) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = "select top 1 Sn from Sys_LotteryTime where LotteryId=" + loid + " order by time desc"; dataTable2 = dbOperHandler.GetDataTable(); text = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataTable2.Rows[0]["Sn"].ToString(); } else { text = now.ToString("yyyyMMdd") + "-" + dataTable2.Rows[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") && loid == 1003) { text = now.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataTable2.Rows[0]["Sn"].ToString(); } } if (loid == 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(); text = string.Concat(530900 + (Convert.ToInt32(dataTable3.Rows[0]["d"]) - 7) * 179 + Convert.ToInt32(dataTable2.Rows[0]["Sn"].ToString())); } dataTable2.Clear(); dataTable2.Dispose(); } result = text; } return(result); }
public void GetLotteryZhList(string Lid, ref string _jsonstr) { DateTime now = DateTime.Now; string str = now.ToString("yyyyMMdd"); string text = now.ToString("HH:mm:ss"); now.ToString("yyyy-MM-dd"); using (DbOperHandler dbOperHandler = new ComData().Doh()) { 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 dataTable = dbOperHandler.GetDataTable(); int num = Convert.ToInt32(dataTable.Rows[0]["d"]) - 7; num++; //now.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; //now.ToString("yyyy-MM-dd") + " 20:30:00"; if (now > Convert.ToDateTime(now.ToString(" 20:30:00"))) { //now.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { num--; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i <= 9; i++) { string text2 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; text2 = text2.Replace("编号", (i + 1).ToString()).Replace("期号", now.Year.ToString() + Func.AddZero(num + (i + 1), 3)).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.AddDays((double)i).ToString("yyyy-MM-dd") + " 20:30:00"); stringBuilder.Append(text2); } _jsonstr = "[" + stringBuilder.ToString().Substring(0, stringBuilder.ToString().Length - 1) + "]"; } else { if (ComData.LotteryTime == null) { ComData.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] array = ComData.LotteryTime.Select(string.Concat(new object[] { "Time >'", text, "' and LotteryId=", Lid }), "Time asc"); if (array.Length == 0) { array = ComData.LotteryTime.Select(string.Concat(new object[] { "Time <='", text, "' and LotteryId=", Lid }), "Time asc"); str = now.AddDays(1.0).ToString("yyyyMMdd"); } int num2 = ComData.LotteryTime.Select(string.Concat(new object[] { "LotteryId=", Lid }), "Time asc").Length; if (num2 > 120) { num2 = 120; } StringBuilder stringBuilder2 = new StringBuilder(); dbOperHandler.Reset(); dbOperHandler.SqlCmd = string.Concat(new object[] { "select top ", num2, " * from Sys_LotteryTime where lotteryid=", Lid, " and sn>=", array[0]["Sn"].ToString(), "order by sn asc" }); DataTable dataTable2 = dbOperHandler.GetDataTable(); for (int j = 0; j < dataTable2.Rows.Count; j++) { string text3 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string newValue = str + "-" + dataTable2.Rows[j]["sn"].ToString(); if (Lid == "1010" || Lid == "1017" || Lid == "3004" || Lid == "1012" || Lid == "1013") { newValue = string.Concat(new LotteryTimeDAL().GetTsIssueNum(Lid) + Convert.ToInt32(dataTable2.Rows[j]["sn"].ToString())); } text3 = text3.Replace("编号", (j + 1).ToString()).Replace("期号", newValue).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.ToString("yyyy-MM-dd") + " " + dataTable2.Rows[j]["time"]); stringBuilder2.Append(text3); } dbOperHandler.Reset(); dbOperHandler.SqlCmd = string.Concat(new object[] { "select top ", num2 - dataTable2.Rows.Count, " * from Sys_LotteryTime where lotteryid=", Lid, " order by sn asc" }); DataTable dataTable3 = dbOperHandler.GetDataTable(); for (int k = 0; k < dataTable3.Rows.Count; k++) { string text4 = "{\"no\": \"编号\",\"sn\": \"期号\",\"count\": \"倍数\",\"price\": \"金额\",\"stime\": \"时间\"},"; string newValue2 = now.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataTable3.Rows[k]["sn"].ToString(); if (Lid == "1010" || Lid == "1017" || Lid == "3004" || Lid == "1012" || Lid == "1013") { newValue2 = string.Concat(new LotteryTimeDAL().GetTsIssueNum(Lid) + Convert.ToInt32(dataTable3.Rows[k]["sn"].ToString())); } text4 = text4.Replace("编号", (k + 1 + dataTable2.Rows.Count).ToString()).Replace("期号", newValue2).Replace("倍数", "0").Replace("金额", "0.00").Replace("时间", now.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataTable3.Rows[k]["time"]); stringBuilder2.Append(text4); } _jsonstr = "[" + stringBuilder2.ToString().Substring(0, stringBuilder2.ToString().Length - 1) + "]"; } } }
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; } }
private void ajaxLotteryTime() { LotteryDAL dal = new LotteryDAL(); string ltId = this.q("lid");//彩种Id int id; if (Int32.TryParse(ltId, out id) == false) { this._response = "{}"; return; } SysLotteryModel lottery = dal.GetSysLotteryById(id); if (lottery == null) { this._response = "{}"; return; } string str2 = "0"; //名称 //彩种类别 //倒计时 //封单时间 //下期期号 //已开期数 //当前期号 string ltInfo = "{\"name\": \"名称\",\"lotteryid\": \"彩种类别\",\"ordertime\": \"倒计时\",\"closetime\": \"封单时间\",\"nestsn\": \"下期期号\",\"opennum\": \"已开期数\",\"cursn\": \"当前期号\"}"; ltInfo = ltInfo.Replace("名称", lottery.Title); ltInfo = ltInfo.Replace("彩种类别", ltId); ltInfo = ltInfo.Replace("封单时间", lottery.CloseTime.ToString()); DateTime dateTime1 = DateTime.Now; //DateTime curDateTime = this.GetDateTime(); //当前日期时间 DateTime curDateTime = this.GetDateTime(); //当前日期时间 string curDate = curDateTime.ToString("yyyyMMdd"); //当前日期 string curTime = curDateTime.ToString("HH:mm:ss"); //当前时间 int num; string newValue1; string newValue2; TimeSpan timeSpan; if (ltId == "3002" || ltId == "3003") { num = curDateTime.Year; DateTime dateTime3 = Convert.ToDateTime(num.ToString() + "-01-01 20:30:00"); this.doh.Reset(); this.doh.SqlCmd = "select datediff(d,'" + dateTime3.ToString("yyyy-MM-dd HH:mm:ss") + "','" + curDateTime.ToString("yyyy-MM-dd HH:mm:ss") + "') as d"; int Num = Convert.ToInt32(this.doh.GetDataTable().Rows[0]["d"]) - 7 + 1; string str7 = curDateTime.AddDays(-1.0).ToString("yyyy-MM-dd") + " 20:30:00"; string str8 = curDateTime.ToString("yyyy-MM-dd") + " 20:30:00"; if (curDateTime > Convert.ToDateTime(curDateTime.ToString(" 20:30:00"))) { str8 = curDateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " 20:30:00"; } else { --Num; } num = curDateTime.Year; newValue1 = num.ToString() + Func.AddZero(Num, 3); num = curDateTime.Year; newValue2 = num.ToString() + Func.AddZero(Num + 1, 3); timeSpan = Convert.ToDateTime(str8) - Convert.ToDateTime(curTime); } else { if (UserCenterSession.LotteryTime == null) { UserCenterSession.LotteryTime = new LotteryTimeDAL().GetTable(); } DataRow[] dataRowArray1 = UserCenterSession.LotteryTime.Select("Time >'" + curTime + "' and LotteryId=" + ltId, "Time asc"); if (dataRowArray1.Length == 0) { dataRowArray1 = UserCenterSession.LotteryTime.Select("Time <='" + curTime + "' and LotteryId=" + ltId, "Time asc"); newValue2 = curDateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString(); } else { newValue2 = curDate + "-" + dataRowArray1[0]["Sn"].ToString(); dateTime1 = Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()); if (curDateTime > Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 00:00:00") && curDateTime < Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 10:00:01") && ltId == "1003") { newValue2 = curDateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString(); } if (curDateTime > Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 23:00:00") && curDateTime < Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 23:59:59") && (ltId == "1014" || ltId == "1016")) { newValue2 = curDateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray1[0]["Sn"].ToString(); } } if (Convert.ToDateTime(dataRowArray1[0]["Time"].ToString()) < Convert.ToDateTime(curTime)) { dateTime1 = Convert.ToDateTime(curDateTime.AddDays(1.0).ToString("yyyy-MM-dd") + " " + dataRowArray1[0]["Time"].ToString()); } timeSpan = dateTime1 - Convert.ToDateTime(curTime); DataRow[] dataRowArray2 = UserCenterSession.LotteryTime.Select("Time <'" + curTime + "' and LotteryId=" + ltId, "Time desc"); if (dataRowArray2.Length == 0) { dataRowArray2 = UserCenterSession.LotteryTime.Select("LotteryId=" + ltId, "Time desc"); newValue1 = curDateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString(); str2 = dataRowArray2[0]["Sn"].ToString(); } else { newValue1 = curDate + "-" + dataRowArray2[0]["Sn"].ToString(); str2 = dataRowArray2[0]["Sn"].ToString(); if (curDateTime > Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 00:00:00") && curDateTime < Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 10:00:01") && ltId == "1003") { newValue1 = curDateTime.AddDays(-1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString(); str2 = dataRowArray2[0]["Sn"].ToString(); } if (curDateTime > Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 23:00:00") && curDateTime < Convert.ToDateTime(curDateTime.ToString("yyyy-MM-dd") + " 23:59:59") && (ltId == "1014" || ltId == "1016")) { newValue1 = curDateTime.AddDays(1.0).ToString("yyyyMMdd") + "-" + dataRowArray2[0]["Sn"].ToString(); } } if (ltId == "1010" || ltId == "1017" || ltId == "3004") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum(ltId) + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); str2 = dataRowArray2[0]["Sn"].ToString(); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (ltId == "1012") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1012") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); str2 = dataRowArray2[0]["Sn"].ToString(); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (ltId == "1013") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("1013") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); str2 = dataRowArray2[0]["Sn"].ToString(); newValue2 = string.Concat((object)(Convert.ToInt32(newValue1) + 1)); } if (ltId == "1014" || ltId == "1015" || ltId == "1016") { newValue1 = newValue1.Replace("-", ""); newValue2 = newValue2.Replace("-", ""); } if (ltId == "4001") { newValue1 = string.Concat((object)(new LotteryTimeDAL().GetTsIssueNum("4001") + Convert.ToInt32(dataRowArray2[0]["Sn"].ToString()))); str2 = 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 str9 = ltInfo.Replace("下期期号", newValue2).Replace("当前期号", newValue1).Replace("倒计时", newValue3); string oldValue = "已开期数"; num = Convert.ToInt32(str2); string newValue4 = num.ToString(); this._response = str9.Replace(oldValue, newValue4); }