protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.SuccessInfo successbll = new Maticsoft.BLL.SuccessInfo(); Maticsoft.Model.SuccessInfo successmodel = new Maticsoft.Model.SuccessInfo(); if (txtsuccesstitle.Text.Trim() == "") { lbltitle.Text = "请填写案例名称"; return; } successmodel.SuccessTitle = txtsuccesstitle.Text.Trim(); lbltitle.Text = ""; if (txtwrite.Text.Trim() == "") { lblwrite.Text = "请填写发布人"; return; } successmodel.Write = txtwrite.Text.Trim(); lblwrite.Text = ""; if (txtfatime.Text.Trim() == "") { lblfatime.Text = "请填写您的发布时间"; } successmodel.Fatime = Convert.ToDateTime(txtfatime.Text.Trim()); lblfatime.Text = ""; successmodel.ImageURL = Image1.ImageUrl; successmodel.SuccessContent = txtcontent.Text.Trim(); successbll.Add(successmodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); txtsuccesstitle.Text = string.Empty; txtwrite.Text = string.Empty; txtfatime.Text = string.Empty; txtcontent.Text = string.Empty; }
protected void datasuccess_DeleteCommand(object source, DataListCommandEventArgs e) { int index = int.Parse(datasuccess.DataKeys[e.Item.ItemIndex].ToString()); Maticsoft.BLL.SuccessInfo nichebll = new Maticsoft.BLL.SuccessInfo(); nichebll.Delete(index); lblpage.Text = ""; bind(); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtSuccessTitle.Text.Trim().Length == 0) { strErr += "SuccessTitle不能为空!\\n"; } if (!PageValidate.IsDateTime(txtFatime.Text)) { strErr += "Fatime格式错误!\\n"; } if (this.txtWrite.Text.Trim().Length == 0) { strErr += "Write不能为空!\\n"; } if (this.txtImageURL.Text.Trim().Length == 0) { strErr += "ImageURL不能为空!\\n"; } if (!PageValidate.IsNumber(txtHitNum.Text)) { strErr += "HitNum格式错误!\\n"; } if (this.txtSuccessContent.Text.Trim().Length == 0) { strErr += "SuccessContent不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int SuccessID = int.Parse(this.lblSuccessID.Text); string SuccessTitle = this.txtSuccessTitle.Text; DateTime Fatime = DateTime.Parse(this.txtFatime.Text); string Write = this.txtWrite.Text; string ImageURL = this.txtImageURL.Text; int HitNum = int.Parse(this.txtHitNum.Text); string SuccessContent = this.txtSuccessContent.Text; Maticsoft.Model.SuccessInfo model = new Maticsoft.Model.SuccessInfo(); model.SuccessID = SuccessID; model.SuccessTitle = SuccessTitle; model.Fatime = Fatime; model.Write = Write; model.ImageURL = ImageURL; model.HitNum = HitNum; model.SuccessContent = SuccessContent; Maticsoft.BLL.SuccessInfo bll = new Maticsoft.BLL.SuccessInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void ShowInfo(int SuccessID) { Maticsoft.BLL.SuccessInfo bll = new Maticsoft.BLL.SuccessInfo(); Maticsoft.Model.SuccessInfo model = bll.GetModel(SuccessID); this.lblSuccessID.Text = model.SuccessID.ToString(); this.txtSuccessTitle.Text = model.SuccessTitle; this.txtFatime.Text = model.Fatime.ToString(); this.txtWrite.Text = model.Write; this.txtImageURL.Text = model.ImageURL; this.txtHitNum.Text = model.HitNum.ToString(); this.txtSuccessContent.Text = model.SuccessContent; }
private void bind() { Maticsoft.BLL.SuccessInfo successbll = new Maticsoft.BLL.SuccessInfo(); int index = int.Parse(Request.QueryString["SuccessID"].ToString()); Maticsoft.Model.SuccessInfo successmodel = successbll.GetModel(index); lblfatime.Text = Convert.ToDateTime(successmodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lbltitle.Text = successmodel.SuccessTitle; lblwrite.Text = successmodel.Write; txtcontent.Text = successmodel.SuccessContent; Image1.ImageUrl = successmodel.ImageURL; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Maticsoft.BLL.SuccessInfo successbll = new Maticsoft.BLL.SuccessInfo(); 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 = successbll.getsuccessCount(""); int pageCont = recordCount / pageSize + 1; if (recordCount % pageSize == 0) { pageCont--; } DataSet ds = successbll.getsuccessList(pageSize * (page - 1), pageSize, ""); datasuccess.DataSource = ds; datasuccess.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='success.aspx?page=" + 1 + " & FenleiID=" + 3 + "" + " '>首页</a> "; this.lblpage.Text += "<a href='success.aspx?page=" + (page - 1).ToString() + " & FenleiID=" + 3 + "" + " '>上一页</a> "; } if (page == pageCont) { this.lblpage.Text += "下一页 "; this.lblpage.Text += "尾页 "; } else { this.lblpage.Text += "<a href='success.aspx?page=" + (page + 1).ToString() + " & FenleiID=" + 3 + "" + " '>下一页</a> "; this.lblpage.Text += "<a href='success.aspx?page=" + pageCont.ToString() + " & FenleiID=" + 3 + "" + " '>尾页</a> "; } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { lianxibind(); Maticsoft.BLL.SuccessInfo success = new Maticsoft.BLL.SuccessInfo(); DataSet successds = success.GetList(6, "", "Fatime desc "); datasuess.DataSource = successds; datasuess.DataBind(); Maticsoft.BLL.DingProduct dingbll = new Maticsoft.BLL.DingProduct(); DataSet dingds = dingbll.GetList(5, "", "Dingtime desc "); datading.DataSource = dingds; datading.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["SuccessID"] != null) { if (Request.QueryString["SuccessID"].ToString() != "") { int successid = int.Parse(Request.QueryString["SuccessID"].ToString()); Maticsoft.BLL.SuccessInfo success = new Maticsoft.BLL.SuccessInfo(); Maticsoft.Model.SuccessInfo successmodel = success.GetModel(successid); lblFatime.Text = Convert.ToDateTime(successmodel.Fatime.ToString()).ToString("yyyy-MM-dd"); int hitnum = 0; if (successmodel.HitNum != null) { successmodel.HitNum = successmodel.HitNum + 1; success.Update(successmodel); lblHitNum.Text = successmodel.HitNum.ToString(); } else { successmodel.HitNum = 1; success.Update(successmodel); lblHitNum.Text = successmodel.HitNum.ToString(); } lbllblSuccessTitle1.Text = successmodel.SuccessTitle; lblSuccessContent.Text = successmodel.SuccessContent; lblSuccessTitle.Text = successmodel.SuccessTitle; lblWrite.Text = successmodel.Write; ImgImageURL.ImageUrl = successmodel.ImageURL; } else { Response.Redirect("success.aspx"); } } else { Response.Redirect("success.aspx"); } } }