private void BindData() { if (this.ddlLottery.Items.Count >= 1) { string condition = "LotteryID = " + Utility.FilteSqlInfusion(this.ddlLottery.SelectedValue) + " and QuashStatus = 0 and Buyed = 0 and isOpened = 0"; if (this.tbQuash.Text.Trim() != "") { if (this.rb1.Checked) { condition = condition + " and SchemeNumber = '" + Utility.FilteSqlInfusion(this.tbQuash.Text.Trim()) + "'"; } else { condition = condition + " and InitiateName = '" + Utility.FilteSqlInfusion(this.tbQuash.Text.Trim()) + "'"; } } DataTable table = new Views.V_SchemeSchedules().Open("", condition, "[Money] desc"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_SchemeQuash"); } else { table.Columns.Add("LocateWaysAndMultiples", Type.GetType("System.String")); string buyContent = ""; string cnLocateWaysAndMultiples = ""; for (int i = 0; i < table.Rows.Count; i++) { table.Rows[i]["Money"] = double.Parse(table.Rows[i]["Money"].ToString()).ToString("N"); if (new Lottery()["45"].CheckPlayType(int.Parse(table.Rows[i]["PlayTypeID"].ToString()))) { table.Rows[i]["Multiple"] = 0; try { buyContent = ""; cnLocateWaysAndMultiples = ""; if (new Lottery()["45"].GetSchemeSplit(table.Rows[i]["LotteryNumber"].ToString(), ref buyContent, ref cnLocateWaysAndMultiples)) { table.Rows[i]["LocateWaysAndMultiples"] = cnLocateWaysAndMultiples; } else { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } catch { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } table.AcceptChanges(); } this.g.DataSource = table; this.g.DataBind(); } } }
private void BindData() { if (this.ddlLottery.Items.Count >= 1) { DataTable table = new Views.V_SchemeSchedules().Open("", "LotteryID = " + Utility.FilteSqlInfusion(this.ddlLottery.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0 and EndTime < GetDate() and not [ID] in (select SchemeID from T_SchemesSendToCenter where HandleResult <> 1)", "[Money] desc"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else { table.Columns.Add("LocateWaysAndMultiples", Type.GetType("System.String")); string buyContent = ""; string cnLocateWaysAndMultiples = ""; for (int i = 0; i < table.Rows.Count; i++) { table.Rows[i]["Money"] = double.Parse(table.Rows[i]["Money"].ToString()).ToString("N"); if (new Lottery()["45"].CheckPlayType(int.Parse(table.Rows[i]["PlayTypeID"].ToString()))) { table.Rows[i]["Multiple"] = 0; try { buyContent = ""; cnLocateWaysAndMultiples = ""; if (new Lottery()["45"].GetSchemeSplit(table.Rows[i]["LotteryNumber"].ToString(), ref buyContent, ref cnLocateWaysAndMultiples)) { table.Rows[i]["LocateWaysAndMultiples"] = cnLocateWaysAndMultiples; } else { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } catch { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } table.AcceptChanges(); } this.g.DataSource = table; this.g.DataBind(); } } }
protected void btnDownload_Click(object sender, EventArgs e) { DataTable table = new Views.V_Isuses().Open("", "[id] = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue), ""); if ((table == null) || (table.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else { string str = table.Rows[0]["Code"].ToString() + table.Rows[0]["Name"].ToString() + ".xls"; table = new Views.V_SchemeSchedules().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0", "[Money] desc"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else if (table.Rows.Count < 1) { JavaScript.Alert(this.Page, "没有数据。"); } else { HttpResponse response = this.Page.Response; response.AppendHeader("Content-Disposition", "attachment;filename=" + str); base.Response.ContentType = "application/ms-excel"; response.ContentEncoding = Encoding.GetEncoding("gb2312"); response.Write("站点编号\t内部编号\t方案编号\t类别\t购买内容\t倍数\t金额\t彩票标识号\n"); foreach (DataRow row in table.Rows) { string str2 = ""; try { str2 = "| " + row["LotteryNumber"].ToString().Replace("\r\n", " | ") + " |"; } catch { } response.Write(row["SiteID"].ToString() + "\t" + row["ID"].ToString() + "\t" + row["SchemeNumber"].ToString() + "\t" + row["PlayTypeName"].ToString() + "\t" + str2 + "\t" + row["Multiple"].ToString() + "\t" + row["Money"].ToString() + "\t<请输入标识号>\n"); } response.End(); } } }
protected void btnDownload_txt_Click(object sender, EventArgs e) { DataTable table = new Views.V_Isuses().Open("", "[ID] = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue), ""); if ((table == null) || (table.Rows.Count < 1)) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else { string str = table.Rows[0]["Code"].ToString() + table.Rows[0]["Name"].ToString() + ".txt"; table = new Views.V_SchemeSchedules().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0", "[Money] desc"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else if (table.Rows.Count < 1) { JavaScript.Alert(this.Page, "没有数据。"); } else { HttpResponse response = this.Page.Response; response.AppendHeader("Content-Disposition", "attachment;filename=" + str); base.Response.ContentType = "application/ms-txt"; response.ContentEncoding = Encoding.GetEncoding("utf-8"); foreach (DataRow row in table.Rows) { string s = row["LotteryNumber"].ToString(); response.Write("***********************************************\r\n"); response.Write("站点编号: " + row["SiteID"].ToString() + "\r\n"); response.Write("方案编号: " + row["SchemeNumber"].ToString() + "\t内部编号:" + row["ID"].ToString() + "\r\n"); response.Write("方案类别: " + row["PlayTypeName"].ToString() + "\r\n"); response.Write("方案倍数: " + row["Multiple"].ToString() + "\t方案金额:" + double.Parse(row["Money"].ToString()).ToString("N") + "\r\n"); response.Write("***********************************************\r\n"); response.Write(s); response.Write("\r\n\r\n\r\n"); } response.End(); } } }
private void BindData() { if (this.ddlIsuse.Items.Count >= 1) { DataTable table = new Views.V_SchemeSchedules().Open("", "IsuseID = " + Utility.FilteSqlInfusion(this.ddlIsuse.SelectedValue) + " and Schedule >= 100 and QuashStatus = 0 and Buyed = 0 and isOpened = 0", "[Money] desc"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_PrintOutput"); } else { table.Columns.Add("LocateWaysAndMultiples", Type.GetType("System.String")); string buyContent = ""; string cnLocateWaysAndMultiples = ""; for (int i = 0; i < table.Rows.Count; i++) { table.Rows[i]["Money"] = double.Parse(table.Rows[i]["Money"].ToString()).ToString("N"); if (new Lottery()["45"].CheckPlayType(int.Parse(table.Rows[i]["PlayTypeID"].ToString()))) { table.Rows[i]["Multiple"] = 0; try { buyContent = ""; cnLocateWaysAndMultiples = ""; string str3 = ""; string scheme = table.Rows[i]["LotteryNumber"].ToString(); if (new Lottery()["45"].GetSchemeSplit(scheme, ref buyContent, ref cnLocateWaysAndMultiples)) { string vote = ""; DataTable table2 = PF.GetZCDCBuyContent(scheme, _Convert.StrToLong(table.Rows[i]["ID"].ToString(), -1L), ref vote); if (table2 == null) { PF.GoError(4, "数据访问错误", base.GetType().BaseType.FullName); return; } foreach (DataRow row in table2.Rows) { if (str3 == "") { string str6 = str3; str3 = str6 + row["No"].ToString() + " " + row["LeagueTypeName"].ToString() + " " + row["HostTeam"].ToString() + " VS " + row["QuestTeam"].ToString() + " " + row["Content"].ToString() + " " + row["LotteryResult"].ToString(); } else { string str7 = str3; str3 = str7 + "<br />" + row["No"].ToString() + " " + row["LeagueTypeName"].ToString() + " " + row["HostTeam"].ToString() + " VS " + row["QuestTeam"].ToString() + " " + row["Content"].ToString() + " " + row["LotteryResult"].ToString(); } } table.Rows[i]["LocateWaysAndMultiples"] = cnLocateWaysAndMultiples; } else { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } catch { table.Rows[i]["LocateWaysAndMultiples"] = "<font color='red'>读取错误!</font>"; } } table.AcceptChanges(); } this.g.DataSource = table; this.g.DataBind(); this.btnDownload.Enabled = table.Rows.Count > 0; this.btnDownload_txt.Enabled = table.Rows.Count > 0; this.btnBuyAll.Visible = table.Rows.Count > 0; this.fileUp.Disabled = table.Rows.Count < 1; this.btnUpload.Enabled = table.Rows.Count > 0; } } }