protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["usename"] != null) { if (Session["usename"].ToString() != "") { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); if (combll.Exists(2) == true) { bind(); } else { btnok.Visible = true; btnupdael.Visible = false; } } else { Response.Redirect("login.aspx"); Response.End(); } } else { Response.Redirect("login.aspx"); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["usename"] != null) { if (Session["usename"].ToString() != "") { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(1); if (combll.getfenleiExists(1) == true) { btnok.Visible = false; btntian.Visible = true; bind(); } else if (combll.getfenleiExists(1) == false) { btnok.Visible = true; btntian.Visible = false; } } else { Response.Redirect("login.aspx"); Response.End(); } } else { Response.Redirect("login.aspx"); Response.End(); } } }
private void bind() { btnupdael.Visible = true; btnok.Visible = false; Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(2); txtwenhua.Text = commodel.Gonggao; }
protected void btnupdael_Click(object sender, EventArgs e) { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(2); commodel.Gonggao = txtwenhua.Text.Trim(); combll.Update(commodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息提交成功')</script>"); bind(); }
private void ShowInfo(int XianshiID) { Maticsoft.BLL.ComPanyInfo bll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo model = bll.GetModel(XianshiID); this.lblXianshiID.Text = model.XianshiID.ToString(); this.lblGonggao.Text = model.Gonggao; this.lblGongTime.Text = model.GongTime.ToString(); this.lblImageURL.Text = model.ImageURL; this.lblFenleiID.Text = model.FenleiID.ToString(); }
protected void btntian_Click(object sender, EventArgs e) { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(1); commodel.Gonggao = txtgong.Text.Trim(); commodel.GongTime = Convert.ToDateTime(DateTime.Now.ToString()); combll.getupdate(commodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息提交成功!')</script>"); bind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); //int maxid = combll.GetgonggaoMaxID(2) - 1; Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(2); lblGonggao.Text = commodel.Gonggao; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel = combll.GetgonggaoModel(1); lblgonggao.Text = commodel.Gonggao; } }
private void bind() { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); int recordCount = 0; //总共有多少条数据 int pageSize = 9; //每页大小 int page = 1; //当前第几页 int pagecount; if (Request.QueryString["page"] != null) { if (Request.QueryString["page"].ToString() != "") { page = int.Parse(Request.QueryString["page"].ToString()); } } recordCount = combll.gethuanjingCount(3); int pageCont = recordCount / pageSize + 1; if (recordCount % pageSize == 0) { pageCont--; } DataSet ds = combll.gethuanjingList(pageSize * (page - 1), pageSize, 3); datahuan.DataSource = ds; datahuan.DataBind(); if (ds.Tables[0].Rows.Count > 0) { this.lblpage.Text += "共有<b>" + recordCount + "</b>条记录 "; this.lblpage.Text += "当前第<b>" + page + "</b>页 "; if (page == 1) { this.lblpage.Text += "首页 "; this.lblpage.Text += "上一页 "; } else { this.lblpage.Text += "<a href='huanjing.aspx?page=" + 1 + " & FenleiID=" + 3 + "" + " '>首页</a> "; this.lblpage.Text += "<a href='huanjing.aspx?page=" + (page - 1).ToString() + " & FenleiID=" + 3 + "" + " '>上一页</a> "; } if (page == pageCont) { this.lblpage.Text += "下一页 "; this.lblpage.Text += "尾页 "; } else { this.lblpage.Text += "<a href='huanjing.aspx?page=" + (page + 1).ToString() + " & FenleiID=" + 3 + "" + " '>下一页</a> "; this.lblpage.Text += "<a href='huanjing.aspx?page=" + pageCont.ToString() + " & FenleiID=" + 3 + "" + " '>尾页</a> "; } } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtGonggao.Text.Trim().Length == 0) { strErr += "Gonggao不能为空!\\n"; } if (!PageValidate.IsDateTime(txtGongTime.Text)) { strErr += "GongTime格式错误!\\n"; } if (this.txtImageURL.Text.Trim().Length == 0) { strErr += "ImageURL不能为空!\\n"; } if (!PageValidate.IsNumber(txtFenleiID.Text)) { strErr += "FenleiID格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int XianshiID = int.Parse(this.lblXianshiID.Text); string Gonggao = this.txtGonggao.Text; DateTime GongTime = DateTime.Parse(this.txtGongTime.Text); string ImageURL = this.txtImageURL.Text; int FenleiID = int.Parse(this.txtFenleiID.Text); Maticsoft.Model.ComPanyInfo model = new Maticsoft.Model.ComPanyInfo(); model.XianshiID = XianshiID; model.Gonggao = Gonggao; model.GongTime = GongTime; model.ImageURL = ImageURL; model.FenleiID = FenleiID; Maticsoft.BLL.ComPanyInfo bll = new Maticsoft.BLL.ComPanyInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void bind() { Maticsoft.BLL.ComPanyInfo combll = new Maticsoft.BLL.ComPanyInfo(); Maticsoft.Model.ComPanyInfo commodel1 = combll.GetgonggaoModel(1); txtgong.Text = commodel1.Gonggao; }