public DataSet GetNumbers(int AgentID, string TimeStamp, string Sign, string StartTime, string EndTime) { StartTime = Utility.FilteSqlInfusion(StartTime); EndTime = Utility.FilteSqlInfusion(EndTime); new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumbers\tAgentID={0}\tTimeStamp={1}\tSign={2}\tStartTime={3}\tEndTime={4}", new object[] { AgentID, TimeStamp, Sign, StartTime, EndTime })); DataSet returnDS = new DataSet(); short state = 0; if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { StartTime, EndTime }) >= 0) { DataTable table = new Tables.T_CardPasswords().Open("[ID], [DateTime], [Money], State, Period", "AgentID = " + AgentID.ToString() + " and (DateTime between '" + StartTime + "' and '" + EndTime + "' )", "[ID]"); if (table == null) { this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS); return(returnDS); } table.Columns.Add("Number", typeof(string)); CardPassword password = new CardPassword(); for (int i = 0; i < table.Rows.Count; i++) { table.Rows[i]["Number"] = password.GenNumber(PF.GetCallCert(), AgentID, _Convert.StrToLong(table.Rows[i]["ID"].ToString(), -1L)); table.AcceptChanges(); } table.Columns.Remove(table.Columns[0]); this.BuildReturnDataSet(0L, ref returnDS); returnDS.Tables.Add(table); } return(returnDS); }
public DataSet GetNumberInformation(int AgentID, string TimeStamp, string Sign, string Number) { new Log(@"Agent\CardPassword").Write(string.Format("Method=GetNumberInformation\tAgentID={0}\tTimeStamp={1}\tSign={2}\tNumber={3}", new object[] { AgentID, TimeStamp, Sign, Number })); DataSet returnDS = new DataSet(); short state = 0; if (this.Valid(ref returnDS, ref state, AgentID, TimeStamp, Sign, new object[] { Number }) >= 0) { int agentID = -1; long num3 = new CardPassword().GetCardPasswordID(PF.GetCallCert(), Number, ref agentID); if ((num3 < 0L) || (agentID != AgentID)) { this.BuildReturnDataSetForError(-5, "卡号不存在", ref returnDS); return(returnDS); } DataTable table = new Tables.T_CardPasswords().Open("[DateTime], [Money], Period, State", string.Concat(new object[] { "AgentID = ", AgentID, " and [ID] = ", num3.ToString() }), ""); if (table == null) { this.BuildReturnDataSetForError(-9999, "未知错误", ref returnDS); return(returnDS); } this.BuildReturnDataSet(0L, ref returnDS); returnDS.Tables.Add(table); } return(returnDS); }
private void BindData() { DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString()); if (cacheAsDataTable == null) { string condition = "AgentID = " + base._CardPasswordAgentUser.ID.ToString(); if (this.tbCardPasswordID.Text.Trim() != "") { int agentID = -1; condition = condition + " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Utility.FilteSqlInfusion(this.tbCardPasswordID.Text.Trim()), ref agentID).ToString(); } if (this.tbDateTime.Text.Trim() != "") { DateTime time = DateTime.Parse("1981-01-01"); try { time = DateTime.Parse(this.tbDateTime.Text.Trim()); } catch { JavaScript.Alert(this.Page, "时间格式填写有错误!"); return; } condition = condition + " and DateTime > '" + time.ToString() + "'"; } cacheAsDataTable = new Tables.T_CardPasswords().Open("ID, Money, Period, State", condition, ""); if (cacheAsDataTable == null) { PF.GoError(4, "数据库繁忙,请重试", "CardPassword_QueryCardPassword"); return; } Shove._Web.Cache.SetCache("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString(), cacheAsDataTable); } PF.DataGridBindData(this.g, cacheAsDataTable, this.gPager); }
protected void btnExcel_Click(object sender, EventArgs e) { DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString()); if (cacheAsDataTable == null) { string condition = "AgentID = " + base._CardPasswordAgentUser.ID.ToString(); if (this.tbCardPasswordID.Text.Trim() != "") { int agentID = -1; condition = condition + " and ID = " + new CardPassword().GetCardPasswordID(PF.GetCallCert(), Utility.FilteSqlInfusion(this.tbCardPasswordID.Text.Trim()), ref agentID).ToString(); } if (this.tbDateTime.Text.Trim() != "") { DateTime time = DateTime.Parse("1981-01-01"); try { time = DateTime.Parse(this.tbDateTime.Text.Trim()); } catch { JavaScript.Alert(this.Page, "时间格式填写有错误!"); return; } condition = condition + " and DateTime > '" + time.ToString() + "'"; } cacheAsDataTable = new Tables.T_CardPasswords().Open("ID, Money, Period, State", condition, ""); if (cacheAsDataTable == null) { PF.GoError(4, "数据库繁忙,请重试", "CardPassword_QueryCardPassword"); return; } Shove._Web.Cache.SetCache("CardPassword_QueryCardPassword_" + base._CardPasswordAgentUser.ID.ToString(), cacheAsDataTable); } cacheAsDataTable.Columns.Add("Number", typeof(string)); CardPassword password = new CardPassword(); for (int i = 0; i < cacheAsDataTable.Rows.Count; i++) { cacheAsDataTable.Rows[i]["Number"] = "[" + password.GenNumber(PF.GetCallCert(), base._CardPasswordAgentUser.ID, _Convert.StrToLong(cacheAsDataTable.Rows[i]["ID"].ToString(), -1L)) + "]"; cacheAsDataTable.AcceptChanges(); } cacheAsDataTable.Columns.Remove(cacheAsDataTable.Columns[0]); string str2 = "T_CardPassword.xls"; HttpResponse response = this.Page.Response; response.AppendHeader("Content-Disposition", "attachment;filename=" + str2); base.Response.ContentType = "application/ms-excel"; response.ContentEncoding = Encoding.GetEncoding("gb2312"); foreach (DataColumn column in cacheAsDataTable.Columns) { response.Write(column.ColumnName + "\t"); } response.Write("\n"); foreach (DataRow row in cacheAsDataTable.Rows) { for (int j = 0; j < cacheAsDataTable.Columns.Count; j++) { response.Write(row[j].ToString() + "\t"); } response.Write("\n"); } response.End(); }