private void DeleteSource(string SId) { B_Author bauthor = new B_Author(); if (bauthor.DeleteByID(SId)) { HttpContext.Current.Response.Write("<script language=javascript> alert('删除成功!');window.document.location.href='AuthorManage.aspx';</script>"); } }
/// <summary> /// 作者绑定 /// </summary> /// <param name="flag"></param> public void InitPage(string flag) { if("author"==flag) { B_Author bauthor=new B_Author(); DataTable dt=bauthor.GetSourceAll();//GetSourceAll() RepFiles.DataSource = dt; RepFiles.DataBind(); } else if ("source" == flag) { MyBind(); } else { BindKeyword(); } }
protected void btndelete_Click(object sender, EventArgs e) { B_Author bauthor = new B_Author(); int i = 0, flag = 0; string sid = ""; for (i = 0; i < GridView1.Rows.Count; i++) { if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("SelectCheckBox")).Checked) { sid = GridView1.DataKeys[GridView1.Rows[i].RowIndex].Value.ToString(); if (bauthor.DeleteByID(sid)) flag++; } } // GridView1.DataKeys[GridView1.Rows[i].RowIndex]//而不是.DataItemIndex if (flag > 0) { Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='AuthorManage.aspx';</script>"); } }
protected void EBtnModify_Click(object sender, EventArgs e) { M_Author mauthor = new M_Author(); B_Author bauthor = new B_Author(); mauthor.ID= Convert.ToInt32(Request.QueryString["AUId"].Trim()); mauthor.AuthorID =0; mauthor.AuthorName = TxtName.Text.ToString(); mauthor.AuthorPhoto = showphoto.Src.ToString(); //mauthor. = TxtUserName.Text.ToString(); 会员名没存 mauthor.AuthorSex = Convert.ToInt32(RadlSex.SelectedValue); mauthor.AuthorLastUseTime = DateTime.Now; mauthor.AuthorAddress = TxtAddress.Text.ToString(); mauthor.AuthorTel = TxtTel.Text.ToString(); mauthor.AuthorFax = TxtFax.Text.ToString(); mauthor.AuthorCompany = TxtCompany.Text.ToString(); mauthor.AuthorDepartment = TxtDepartment.Text.ToString(); mauthor.AuthorHomePage = TxtHomePage.Text.ToString(); mauthor.AuthorZipCode = DataConverter.CLng(TxtZipCode.Text.ToString()); mauthor.AuthorEmail = TxtEmail.Text.ToString(); mauthor.AuthorMail = TxtMail.Text.ToString(); mauthor.AuthorIm = TxtIm.Text.ToString(); mauthor.AuthorType = GetAuthorType(RadlAuthorType.SelectedIndex); mauthor.AuthorBirthDay = DataConverter.CDate(tbUBday.Value); if (ChkElite.Checked) { mauthor.AuthorIsElite = true; } if (ChkOnTop.Checked) { mauthor.AuthoronTop = true; } mauthor.AuthorIntro = TxtIntro.Text.ToString(); if (ChkPass.Checked) { mauthor.AuthorPassed = true; } if (bauthor.Update_Author_ByID(mauthor)) Response.Write("<script language=javascript> alert('修改成功!');window.document.location.href='AuthorManage.aspx';</script>"); }
public void MyBind() { B_Author bauthor=new B_Author(); GridView1.DataSource = bauthor.GetSourceAll();// GetAuthorPage(0, 0, 10); GridView1.DataBind(); }
private void InItModify(int Auid) { B_Author bauthor = new B_Author(); M_Author mauthor = bauthor.GetAuthorByid(Auid); txtpic.Text=showphoto.Src = mauthor.AuthorPhoto; TxtName.Text = mauthor.AuthorName; RadlSex.SelectedValue = mauthor.AuthorSex.ToString(); TxtAddress.Text = mauthor.AuthorAddress; TxtTel.Text = mauthor.AuthorTel; TxtFax.Text = mauthor.AuthorFax; TxtCompany.Text = mauthor.AuthorCompany; TxtDepartment.Text = mauthor.AuthorDepartment; TxtHomePage.Text = mauthor.AuthorHomePage; TxtZipCode.Text = mauthor.AuthorZipCode.ToString(); TxtEmail.Text = mauthor.AuthorEmail; TxtIm.Text = mauthor.AuthorIm; SetAuthorType(mauthor.AuthorType);//设置作者类别 tbUBday.Value = mauthor.AuthorBirthDay.ToShortDateString(); if (mauthor.AuthorIsElite) ChkElite.Checked = true; else ChkElite.Checked = false; if (mauthor.AuthoronTop) ChkOnTop.Checked = true; else ChkOnTop.Checked = false; TxtIntro.Text = mauthor.AuthorIntro; if (mauthor.AuthorPassed) ChkPass.Checked = true; EBtnModify.Visible = true; EBtnSubmit.Visible = false; }