private void BindddlIsuses(int IsuseId) { string key = "Home_Room_NewsPaper"; if (Shove._Web.Cache.GetCacheAsDataTable(key) == null) { DataTable dt = new Tables.T_NewsPaperIsuses().Open("", "", " ID desc"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试!", base.GetType().BaseType.FullName); } else { foreach (DataRow row in dt.Rows) { row["Name"] = row["Name"].ToString() + "期"; } ControlExt.FillDropDownList(this.ddlIsusesID, dt, "Name", "ID"); ListItem item = this.ddlIsusesID.Items.FindByValue(IsuseId.ToString()); if (item != null) { this.ddlIsusesID.SelectedIndex = -1; item.Selected = true; } } } }
private void BindNewsPaper() { if (this.ddlIsusesID.SelectedIndex != -1) { string key = "Home_Room_NewsPaper_BindNewsPaper_" + this.ddlIsusesID.SelectedValue; DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); cacheAsDataTable = null; if (cacheAsDataTable == null) { cacheAsDataTable = new Tables.T_NewsPaperIsuses().Open("", "ID = " + _Convert.StrToInt(this.ddlIsusesID.SelectedValue, 0).ToString(), "[ID]"); if (cacheAsDataTable == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); return; } if (cacheAsDataTable.Rows.Count > 0) { Shove._Web.Cache.SetCache(key, cacheAsDataTable, 0xe10); } } if (cacheAsDataTable.Rows.Count > 0) { this.LoadOpenDay(cacheAsDataTable.Rows[0]["Name"].ToString()); this.tdIsuseOpenInfo.InnerHtml = cacheAsDataTable.Rows[0]["NPMessage"].ToString().Replace("<$Content>", this.BindWinNumber(cacheAsDataTable.Rows[0]["Name"].ToString())); } string text = this.ddlIsusesID.SelectedItem.Text; this.lbTime.Text = "今天是:" + DateTime.Now.ToString("yyyy年MM月dd日") + "  彩友报<span class='red14_2'>" + text.Substring(0, text.Length - 1) + "</span>期"; this.Page.Title = "彩友报 " + text + " -" + base._Site.Name + "主办-手机买彩票,就上" + base._Site.Name; this.key.Content = "彩友报" + text; this.des.Content = "彩友报" + text + " 是" + base._Site.Name + "为广大彩民定期提供的一份彩票咨询电子期刊。"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HidID.Value = Shove._Web.Utility.GetRequest("ID"); if (!string.IsNullOrEmpty(HidID.Value)) { DataTable dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "ID=" + HidID.Value, ""); if (dt == null || dt.Rows.Count == 0) { PF.GoError(ErrorNumber.DataReadWrite, "期号不存在!", this.GetType().BaseType.FullName); return; } DataRow dr = dt.Rows[0]; tbStartTime.Text = dr["StartTime"].ToString(); tbEndTime.Text = dr["EndTime"].ToString(); tbIsuse.Text = dr["Name"].ToString(); tbContent.Value = dr["NPMessage"].ToString(); btnAdd.Text = "修改"; } } }
private void BindddlIsuses() { string Key = "NewsPapers_NewsPaperList"; DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key); if (dt == null) { dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "", " ID desc"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试!", this.GetType().BaseType.FullName); return; } foreach (DataRow dr in dt.Rows) { dr["Name"] = dr["Name"].ToString() + "期"; } Shove.ControlExt.FillDropDownList(ddlIsusesID, dt, "Name", "ID"); ddlIsusesID.Items.Insert(0,(new ListItem("--------", "0"))); ddlIsusesID.SelectedIndex = 0; } }
private void BindDataForNewsPaperTypes() { DataTable dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } Shove.ControlExt.FillDropDownList(ddlNewsTypes, dt, "Name", "ID"); }
private void BindDataForNewsPaperTypes() { DataTable dt = new Tables.T_NewsPaperIsuses().Open("", "", "[ID]"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName); } else { ControlExt.FillDropDownList(this.ddlNewsTypes, dt, "Name", "ID"); } }
private void BindddlIsuses() { string key = "Home_Room_NewsPaper"; if (Shove._Web.Cache.GetCacheAsDataTable(key) == null) { DataTable dt = new Tables.T_NewsPaperIsuses().Open("", "", " ID desc"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试!", base.GetType().BaseType.FullName); } else { foreach (DataRow row in dt.Rows) { row["Name"] = row["Name"].ToString() + "期"; } ControlExt.FillDropDownList(this.ddlIsusesID, dt, "Name", "ID"); } } }
private void BindddlIsuses() { string key = "NewsPapers_NewsPaperList"; if (Shove._Web.Cache.GetCacheAsDataTable(key) == null) { DataTable dt = new Tables.T_NewsPaperIsuses().Open("", "", " ID desc"); if (dt == null) { PF.GoError(4, "数据库繁忙,请重试!", base.GetType().BaseType.FullName); } else { foreach (DataRow row in dt.Rows) { row["Name"] = row["Name"].ToString() + "期"; } ControlExt.FillDropDownList(this.ddlIsusesID, dt, "Name", "ID"); this.ddlIsusesID.Items.Insert(0, new ListItem("--------", "0")); this.ddlIsusesID.SelectedIndex = 0; } } }
private void BindddlIsuses(int IsuseId) { string Key = "Home_Room_NewsPaper"; DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key); if (dt == null) { //dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "convert(datetime,StartTime) <= getdate()", " ID desc"); dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "", " ID desc"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试!", this.GetType().BaseType.FullName); return; } foreach (DataRow dr in dt.Rows) { dr["Name"] = dr["Name"].ToString() + "期"; } Shove.ControlExt.FillDropDownList(ddlIsusesID, dt, "Name", "ID"); ListItem item = ddlIsusesID.Items.FindByValue(IsuseId.ToString()); if (item != null) { ddlIsusesID.SelectedIndex = -1; item.Selected = true; } } }
private void BindNewsPaper() { if (ddlIsusesID.SelectedIndex != -1) { string Key = "Home_Room_NewsPaper_BindNewsPaper_" + ddlIsusesID.SelectedValue; DataTable dt = Shove._Web.Cache.GetCacheAsDataTable(Key); dt = null; if (dt == null) { dt = new DAL.Tables.T_NewsPaperIsuses().Open("", "ID = " + Shove._Convert.StrToInt(ddlIsusesID.SelectedValue, 0).ToString() + "", "[ID]"); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName); return; } if (dt.Rows.Count > 0) { Shove._Web.Cache.SetCache(Key, dt, 3600); } } if (dt.Rows.Count > 0) { LoadOpenDay(dt.Rows[0]["Name"].ToString()); tdIsuseOpenInfo.InnerHtml = dt.Rows[0]["NPMessage"].ToString().Replace("<$Content>", BindWinNumber(dt.Rows[0]["Name"].ToString())); } string isuseName = ddlIsusesID.SelectedItem.Text; lbTime.Text = "今天是:" + DateTime.Now.ToString("yyyy年MM月dd日") + "  " + "彩友报" + "<span class='red14_2'>" + isuseName.Substring(0, isuseName.Length - 1) + "</span>" + "期"; //标题和关键字 this.Page.Title = "彩友报 " + isuseName + " -" + _Site.Name + "主办-买彩票,就上" + _Site.Name ; this.key.Content = "彩友报" + isuseName; this.des.Content = "彩友报" + isuseName + " 是" + _Site.Name + "为广大彩民定期提供的一份彩票咨询电子期刊。"; } }
protected void btnAdd_Click(object sender, EventArgs e) { int num = 0; try { num = _Convert.StrToInt(this.tbIsuse.Text.Trim(), 0); } catch { } if (num == 0) { JavaScript.Alert(this.Page, "彩友报期号只能是整数!"); } else { DateTime time; DateTime time2; try { time = Convert.ToDateTime(this.tbStartTime.Text); } catch { JavaScript.Alert(this.Page, "开始时间格式输入错误!"); return; } try { time2 = Convert.ToDateTime(this.tbEndTime.Text); } catch { JavaScript.Alert(this.Page, "截止时间格式输入错误!"); return; } if (time2 >= time) { string str = _Convert.ToTextCode(this.tbContent.Value.Trim()); if (str == "") { JavaScript.Alert(this.Page, "请输入开奖信息!"); } else if (this.HidID.Value == "") { DataTable table = new Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') + "'", ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_Admin_NPIsusesAdd"); } else if (table.Rows.Count > 0) { JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); } else if (new Tables.T_NewsPaperIsuses { Name = { Value = num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') }, StartTime = { Value = time.ToString("yyyy-MM-dd") }, EndTime = { Value = time2.ToString("yyyy-MM-dd") }, NPMessage = { Value = str } }.Insert() < 0L) { JavaScript.Alert(this.Page, "添加彩友报期号失败!"); } else { Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value); JavaScript.Alert(this.Page, "添加期号成功!"); } } else { DataTable table2 = new Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') + "' and ID<>" + this.HidID.Value, ""); if (table2 == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_IsuseAdd"); } else if (table2.Rows.Count > 0) { JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); } else if (new Tables.T_NewsPaperIsuses { Name = { Value = num.ToString().PadLeft(this.tbIsuse.Text.Length, '0') }, StartTime = { Value = time }, EndTime = { Value = time2 }, NPMessage = { Value = str } }.Update("ID=" + this.HidID.Value) < 0L) { JavaScript.Alert(this.Page, "修改失败!"); } else { Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value); JavaScript.Alert(this.Page, "修改成功!"); } } } else { JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.HidID.Value = Utility.GetRequest("ID"); if (!string.IsNullOrEmpty(this.HidID.Value)) { DataTable table = new Tables.T_NewsPaperIsuses().Open("", "ID=" + this.HidID.Value, ""); if ((table == null) || (table.Rows.Count == 0)) { PF.GoError(4, "期号不存在!", base.GetType().BaseType.FullName); } else { DataRow row = table.Rows[0]; this.tbStartTime.Text = row["StartTime"].ToString(); this.tbEndTime.Text = row["EndTime"].ToString(); this.tbIsuse.Text = row["Name"].ToString(); this.tbContent.Value = row["NPMessage"].ToString(); this.btnAdd.Text = "修改"; } } } }
protected void btnAdd_Click(object sender, EventArgs e) { int Isuse = 0; try { Isuse = Shove._Convert.StrToInt(tbIsuse.Text.Trim(), 0); } catch { } if (Isuse == 0) { Shove._Web.JavaScript.Alert(this.Page, "彩友报期号只能是整数!"); return; } System.DateTime StartTime, EndTime; try { StartTime = Convert.ToDateTime(tbStartTime.Text); } catch { Shove._Web.JavaScript.Alert(this.Page, "开始时间格式输入错误!"); return; } try { EndTime = Convert.ToDateTime(tbEndTime.Text); } catch { Shove._Web.JavaScript.Alert(this.Page, "截止时间格式输入错误!"); return; } if (EndTime < StartTime) { Shove._Web.JavaScript.Alert(this.Page, "截止时间应该在开始时间之后!"); return; } string Message = Shove._Convert.ToTextCode(tbContent.Value.Trim()); if (Message == "") { Shove._Web.JavaScript.Alert(this.Page, "请输入开奖信息!"); return; } if (HidID.Value == "") { DataTable dt = new DAL.Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + Isuse.ToString().PadLeft(tbIsuse.Text.Length, '0') + "'", ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_Admin_NPIsusesAdd"); return; } if (dt.Rows.Count > 0) { Shove._Web.JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); return; } DAL.Tables.T_NewsPaperIsuses dt1 = new DAL.Tables.T_NewsPaperIsuses(); dt1.Name.Value = Isuse.ToString().PadLeft(tbIsuse.Text.Length, '0'); dt1.StartTime.Value = StartTime.ToString("yyyy-MM-dd"); dt1.EndTime.Value = EndTime.ToString("yyyy-MM-dd"); dt1.NPMessage.Value = Message; if (dt1.Insert() < 0) { Shove._Web.JavaScript.Alert(this.Page, "添加彩友报期号失败!"); return; } else { Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value); Shove._Web.JavaScript.Alert(this.Page, "添加期号成功!"); } } else { DataTable dt = new DAL.Tables.T_NewsPaperIsuses().Open("[ID]", "[Name] = '" + Isuse.ToString().PadLeft(tbIsuse.Text.Length, '0') + "' and ID<>" + HidID.Value + "", ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_IsuseAdd"); return; } if (dt.Rows.Count > 0) { Shove._Web.JavaScript.Alert(this.Page, "期号已经存在,请不要输入重名期号!"); return; } DAL.Tables.T_NewsPaperIsuses dt1 = new DAL.Tables.T_NewsPaperIsuses(); dt1.Name.Value = Isuse.ToString().PadLeft(tbIsuse.Text.Length, '0'); dt1.StartTime.Value = StartTime; dt1.EndTime.Value = EndTime; dt1.NPMessage.Value = Message; if (dt1.Update("ID=" + HidID.Value) < 0) { Shove._Web.JavaScript.Alert(this.Page, "修改失败!"); return; } Shove._Web.Cache.ClearCache("Home_Room_NewsPaper_BindNewsPaper_" + this.HidID.Value); Shove._Web.JavaScript.Alert(this.Page, "修改成功!"); } }