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 bool Update_Author_ByID(M_Author authorInfo) { return dal.Update(authorInfo); }
public bool Add(M_Author authorInfo) { return dal.Add(authorInfo); }
/// <returns></returns> public bool Add(M_Author Authorfo) { string strSql = "PR_Author_Add"; SqlParameter[] parameter = GetParameters(Authorfo); return SqlHelper.ExecuteProc(strSql, parameter); }
private SqlParameter[] GetParameters(M_Author authorInfo) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@UserId", SqlDbType.Int), //new SqlParameter("@ID", SqlDbType.Int), new SqlParameter("@Name", SqlDbType.VarChar,50), new SqlParameter("@Type", SqlDbType.VarChar,50), new SqlParameter("@Passed", SqlDbType.Bit), new SqlParameter("@onTop", SqlDbType.Bit), new SqlParameter("@IsElite", SqlDbType.Bit), new SqlParameter("@Hits", SqlDbType.Int,4), new SqlParameter("@LastUseTime", SqlDbType.DateTime,8), new SqlParameter("@TemplateID", SqlDbType.Int), new SqlParameter("@Photo", SqlDbType.VarChar,255), new SqlParameter("@Intro", SqlDbType.NVarChar,255), new SqlParameter("@Address", SqlDbType.VarChar,50), new SqlParameter("@Tel", SqlDbType.VarChar,50), new SqlParameter("@Fax", SqlDbType.VarChar,50), new SqlParameter("@Mail", SqlDbType.VarChar,50), new SqlParameter("@Email", SqlDbType.VarChar,50), new SqlParameter("@ZipCode", SqlDbType.Int), new SqlParameter("@HomePage", SqlDbType.VarChar,50), new SqlParameter("@Im", SqlDbType.VarChar,50), new SqlParameter("@Sex",SqlDbType.SmallInt), new SqlParameter("@BirthDay",SqlDbType.DateTime,8), new SqlParameter("@Company",SqlDbType.VarChar,50), new SqlParameter("@Department",SqlDbType.VarChar,50), new SqlParameter("@ID", SqlDbType.Int) }; parameter[0].Value = authorInfo.AuthorID;//? parameter[1].Value = authorInfo.AuthorName; parameter[2].Value = authorInfo.AuthorType; parameter[3].Value = authorInfo.AuthorPassed; parameter[4].Value = authorInfo.AuthoronTop; parameter[5].Value = authorInfo.AuthorIsElite; parameter[6].Value = authorInfo.AuthorHits; parameter[7].Value = authorInfo.AuthorLastUseTime;//? parameter[8].Value = authorInfo.AuthorTemplateID; parameter[9].Value = authorInfo.AuthorPhoto; parameter[10].Value = authorInfo.AuthorIntro; parameter[11].Value = authorInfo.AuthorAddress; parameter[12].Value = authorInfo.AuthorTel; parameter[13].Value = authorInfo.AuthorFax; parameter[14].Value = authorInfo.AuthorMail; parameter[15].Value = authorInfo.AuthorEmail; parameter[16].Value = authorInfo.AuthorZipCode; parameter[17].Value = authorInfo.AuthorHomePage; parameter[18].Value = authorInfo.AuthorIm; parameter[19].Value = authorInfo.AuthorSex; parameter[20].Value = authorInfo.AuthorBirthDay; parameter[21].Value = authorInfo.AuthorCompany; parameter[22].Value = authorInfo.AuthorDepartment; parameter[23].Value = authorInfo.ID;//? return parameter; }
/// <summary> /// 从Sqldatareader读取作者信息 /// </summary> /// <param name="reader"></param> /// <returns></returns> private M_Author GetAuthorInfoFromReader(SqlDataReader reader) { M_Author info = new M_Author(); info.AuthorID = DataConverter.CLng(reader["UserID"].ToString()); info.AuthorType = reader["Type"].ToString(); info.AuthorName = reader["Name"].ToString(); info.AuthorPassed = DataConverter.CBool(reader["Passed"].ToString()); info.AuthoronTop = DataConverter.CBool(reader["onTop"].ToString()); info.AuthorIsElite =DataConverter.CBool(reader["IsElite"].ToString()); info.AuthorHits = DataConverter.CLng(reader["Hits"].ToString()); info.AuthorLastUseTime = DataConverter.CDate(reader["LastUseTime"].ToString()); info.AuthorTemplateID = DataConverter.CLng(reader["TemplateID"].ToString()); info.AuthorPhoto = reader["Photo"].ToString(); info.AuthorIntro = reader["Intro"].ToString(); info.AuthorAddress =reader["Address"].ToString(); info.AuthorTel =reader["Tel"].ToString(); info.AuthorFax= reader["Fax"].ToString(); info.AuthorMail = reader["Mail"].ToString(); info.AuthorEmail= reader["Email"].ToString(); info.AuthorZipCode = DataConverter.CLng(reader["ZipCode"].ToString()); info.AuthorHomePage = reader["HomePage"].ToString(); info.AuthorIm= reader["Im"].ToString(); info.AuthorSex =Convert.ToInt16(reader["Sex"].ToString());//smaallint info.AuthorBirthDay = DataConverter.CDate(reader["BirthDay"].ToString()); info.AuthorCompany =reader["Company"].ToString(); info.AuthorDepartment =reader["Department"].ToString(); reader.Close(); return info; }
public bool Update(M_Author Authorfo) { SqlParameter[] cmdParams = GetParameters(Authorfo); ; return SqlHelper.ExecuteProc("PR_Author_Update", cmdParams); }