protected void Page_Load(object sender, EventArgs e) { this.Title = "添加文献信息页面"; if (!IsPostBack) { DataSet typeds = typemanage.GetAllType("tb_type"); ddlType.DataSource = typeds; ddlType.DataTextField = "categoryName"; ddlType.DataBind(); if (Request["title"] == null) { btnAdd.Enabled = true; txtUploadtime.Text = DateTime.Now.ToShortDateString(); } else { btnSave.Enabled = true; //txtBCode.ReadOnly = txtBName.ReadOnly = true; txtTitle.Text = Request["title"].ToString(); documentatmanage.Title = txtTitle.Text; DataSet documentatds = documentatmanage.FindDocumentatByTitle(documentatmanage, "tb_documentat"); txtContent.Text = documentatds.Tables[0].Rows[0][2].ToString(); //ddlBType.SelectedValue = bookds.Tables[0].Rows[0][2].ToString(); txtKeyword.Text = documentatds.Tables[0].Rows[0][3].ToString(); txtAuthor.Text = documentatds.Tables[0].Rows[0][4].ToString(); txtTopic.Text = documentatds.Tables[0].Rows[0][5].ToString(); txtSummary.Text = documentatds.Tables[0].Rows[0][6].ToString(); txtReferences.Text = documentatds.Tables[0].Rows[0][7].ToString(); txtSource.Text = documentatds.Tables[0].Rows[0][8].ToString(); ddlType.SelectedValue = documentatds.Tables[0].Rows[0][9].ToString(); txtDownloads.Text = documentatds.Tables[0].Rows[0][10].ToString(); txtUpload.Text = documentatds.Tables[0].Rows[0][12].ToString(); //txtCheck.Text = documentatds.Tables[0].Rows[0][13].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { DocumentatManage documentatmanage = new DocumentatManage(); documentatmanage.Title = Request["title"]; DataSet documentatmanageds = documentatmanage.FindDocumentatByTitle(documentatmanage, "tb_documentat"); if (documentatmanageds.Tables[0].Rows.Count < 0) { Response.Redirect("~/404/404.html"); } string filepath = documentatmanageds.Tables[0].Rows[0][13].ToString(); int filedowns = Convert.ToInt32(documentatmanageds.Tables[0].Rows[0][9].ToString()); documentatmanage.Downloads = filedowns + 1; documentatmanage.UpdateDownloads(documentatmanage); Response.Redirect(filepath); }
protected void gvBind() { DataSet ds = null; int intCondition = ddlCondition.SelectedIndex; if (txtCondition.Text == "") { ds = documentatmanage.GetAllDocumentat("tb_documentat"); } else { switch (intCondition) { case 0: documentatmanage.KeyWord = txtCondition.Text; ds = documentatmanage.FindDocumentatByKeyWord(documentatmanage, "tb_documentat"); break; case 1: documentatmanage.Title = txtCondition.Text; ds = documentatmanage.FindDocumentatByTitle(documentatmanage, "tb_documentat"); break; case 2: documentatmanage.Type = txtCondition.Text; ds = documentatmanage.FindDocumentatByType(documentatmanage, "tb_documentat"); break; case 3: documentatmanage.Author = txtCondition.Text; ds = documentatmanage.FindDocumentatByAuthor(documentatmanage, "tb_documentat"); break; case 4: documentatmanage.Topic = txtCondition.Text; ds = documentatmanage.FindDocumentatByTopic(documentatmanage, "tb_documentat"); break; } } gvBookInfo.DataSource = ds; gvBookInfo.DataBind(); }