protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["NicheID"] != null) { if (Request.QueryString["NicheID"].ToString() != "") { int nicheid = int.Parse(Request.QueryString["NicheID"].ToString()); Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(nicheid); Maticsoft.BLL.NicheTypeInfo typebll = new Maticsoft.BLL.NicheTypeInfo(); Maticsoft.Model.NicheTypeInfo typemodel = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString())); lblFatime.Text = Convert.ToDateTime(nichemodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lblNicheContent.Text = nichemodel.NicheContent; lblNicheTitle.Text = nichemodel.NicheTitle; lblNicheTypeTitle.Text = typemodel.NicheTypeTitle; lblWrite.Text = nichemodel.Write; } else { Response.Redirect("NicheList.aspx"); } } else { Response.Redirect("NicheList.aspx"); } } }
protected void datamess_ItemDataBound(object sender, DataListItemEventArgs e) { int index = int.Parse(datamess.DataKeys[e.Item.ItemIndex].ToString()); Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(index); Maticsoft.BLL.NicheTypeInfo typebll = new Maticsoft.BLL.NicheTypeInfo(); Maticsoft.Model.NicheTypeInfo typemodel = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString())); ((Label)e.Item.FindControl("lbltype")).Text = typemodel.NicheTypeTitle; }
private void bind() { Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); int index = int.Parse(Request.QueryString["NicheID"].ToString()); Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(index); txtfatime.Text = Convert.ToDateTime(nichemodel.Fatime.ToString()).ToString("yyyy-MM-dd"); Image1.ImageUrl = nichemodel.ImageURL; txtKeyword.Text = nichemodel.NicheKey; txtNichecontent.Text = nichemodel.NicheContent; txtNichetitle.Text = nichemodel.NicheTitle; txtwrote.Text = nichemodel.Write; drpNicheType.SelectedValue = nichemodel.NicheTypeID.ToString(); }
private void ShowInfo(int NicheID) { Maticsoft.BLL.NicheInfo bll = new Maticsoft.BLL.NicheInfo(); Maticsoft.Model.NicheInfo model = bll.GetModel(NicheID); this.lblNicheID.Text = model.NicheID.ToString(); this.lblNicheTitle.Text = model.NicheTitle; this.lblNicheKey.Text = model.NicheKey; this.lblFatime.Text = model.Fatime.ToString(); this.lblWrite.Text = model.Write; this.lblImageURL.Text = model.ImageURL; this.lblNicheTypeID.Text = model.NicheTypeID.ToString(); this.lblHitNum.Text = model.HitNum.ToString(); this.lblNicheContent.Text = model.NicheContent; }
private void bind() { Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); int index = int.Parse(Request.QueryString["NicheID"].ToString()); Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(index); Maticsoft.BLL.NicheTypeInfo typebll = new Maticsoft.BLL.NicheTypeInfo(); Maticsoft.Model.NicheTypeInfo typemodel = typebll.GetModel(int.Parse(nichemodel.NicheTypeID.ToString())); lbldatime.Text = Convert.ToDateTime(nichemodel.Fatime.ToString()).ToString("yyyy-MM-dd"); lblkey.Text = nichemodel.NicheKey; lblNichetitle.Text = nichemodel.NicheTitle; lbltype.Text = typemodel.NicheTypeTitle; lblwrite.Text = nichemodel.Write; Image1.ImageUrl = nichemodel.ImageURL; txtcontent.Text = nichemodel.NicheContent; }
protected void btnok_Click(object sender, EventArgs e) { Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo(); Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(1); if (txtNichetitle.Text.Trim() == "") { lblNicheTitle.Text = "请填写行业标题"; return; } nichemodel.NicheTitle = txtNichetitle.Text.Trim(); lblNicheTitle.Text = ""; if (txtKeyword.Text.Trim() == "") { lblKeyword.Text = "请填写关键词"; return; } nichemodel.NicheKey = txtKeyword.Text.Trim(); lblKeyword.Text = ""; try { nichemodel.NicheTypeID = int.Parse(drpNicheType.SelectedValue); } catch (Exception e1) { } if (txtwrote.Text.Trim() == "") { lblNichewrite.Text = "请填写发布人"; return; } nichemodel.Write = txtwrote.Text.Trim(); lblNichewrite.Text = ""; if (txtfatime.Text.Trim() == "") { lblfatime.Text = "请填写发布时间"; } nichemodel.Fatime = Convert.ToDateTime(txtfatime.Text.Trim()); lblfatime.Text = ""; nichemodel.ImageURL = Image1.ImageUrl; nichemodel.NicheContent = txtNichecontent.Text.Trim(); nichebll.Update(nichemodel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>"); bind(); }