private static M_ExLecturer GetInfoFromReader(SqlDataReader rdr) { M_ExLecturer info = new M_ExLecturer(); info.ID = DataConverter.CLng(rdr["ID"].ToString()); info.TechName = rdr["TechName"].ToString(); info.TechType = rdr["TechType"].ToString(); info.TechSex = DataConverter.CLng(rdr["TechSex"].ToString()); info.TechTitle = rdr["TechTitle"].ToString(); info.TechPhone = rdr["TechPhone"].ToString(); info.CreateTime = DataConverter.CDate(rdr["CreateTime"].ToString()); info.TechSpecialty = rdr["TechSpecialty"].ToString(); info.TechHobby = rdr["TechHobby"].ToString(); info.TechIntrodu = rdr["TechIntrodu"].ToString(); info.TechLevel = rdr["TechLevel"].ToString(); info.TechDepart = DataConverter.CLng(rdr["TechDepart"].ToString()); info.TechClass = DataConverter.CLng(rdr["TechClass"].ToString()); info.TechRecom = DataConverter.CLng(rdr["TechRecom"].ToString()); info.Popularity = DataConverter.CLng(rdr["Popularity"].ToString()); info.Awardsinfo = rdr["Awardsinfo"].ToString(); info.FileUpload = rdr["FileUpload"].ToString(); info.AddUser = DataConverter.CLng(rdr["AddUser"].ToString()); info.Professional = DataConverter.CLng(rdr["Professional"].ToString()); rdr.Close(); rdr.Dispose(); return(info); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { int id = DataConverter.CLng(hftid.Value); M_ExLecturer exl = bel.GetSelect(id); exl.TechName = BaseClass.Htmlcode(txt_name.Text); exl.AddUser = badmin.GetAdminLogin().AdminId; exl.Awardsinfo = txt_Awardsinfo.InnerHtml; string fileul = getFilePath(); if (!string.IsNullOrEmpty(fileul)) { exl.FileUpload = fileul; } exl.Popularity = DataConverter.CLng(txt_Popularity.Text); exl.Professional = DataConverter.CLng(ddProfessional.SelectedValue); exl.TechDepart = DataConverter.CLng(hfid.Value); exl.TechHobby = BaseClass.Htmlcode(txt_TechHobby.InnerHtml); exl.TechIntrodu = BaseClass.Htmlcode(txt_TechIntrodu.InnerHtml); exl.TechLevel = ddLevel.SelectedValue; exl.TechPhone = BaseClass.Htmlcode(txt_Phone.Text); exl.TechRecom = DataConverter.CLng(ddTechRecom.SelectedValue); exl.TechSex = DataConverter.CLng(ddSex.SelectedValue); exl.TechSpecialty = BaseClass.Htmlcode(txt_TechSpecialty.InnerHtml); exl.TechTitle = ddTitle.SelectedValue; exl.TechType = ddType.SelectedValue; if (id > 0) { bool result = bel.GetUpdate(exl); if (result) { function.WriteSuccessMsg("修改成功!", "LecturerManage.aspx"); } else { function.WriteErrMsg("修改失败!"); } } else { exl.CreateTime = DateTime.Now; int ids = bel.GetInsert(exl); if (ids > 0) { function.WriteSuccessMsg("添加成功!", "LecturerManage.aspx"); } else { function.WriteErrMsg("添加失败!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = DataConverter.CLng(Request.QueryString["id"]); hftid.Value = id.ToString(); if (id > 0) { liCoures.Text = "修改讲师"; M_ExLecturer mel = bel.GetSelect(id); if (mel != null && mel.ID > 0) { txt_name.Text = mel.TechName; txt_Phone.Text = mel.TechPhone; txt_Awardsinfo.InnerHtml = mel.Awardsinfo; txt_Popularity.Text = mel.Popularity.ToString(); txt_TechHobby.InnerHtml = mel.TechHobby; txt_TechIntrodu.InnerHtml = mel.TechIntrodu; txt_TechSpecialty.InnerHtml = mel.TechSpecialty; txtClassname.Text = GetClassname(mel.TechDepart); hfid.Value = mel.TechDepart.ToString(); SFile_Up.FileUrl = mel.FileUpload; ddLevel.SelectedValue = mel.TechLevel.ToString(); ddSex.SelectedValue = mel.TechSex.ToString(); ddTechRecom.SelectedValue = mel.TechRecom.ToString(); ddTitle.SelectedValue = mel.TechTitle; ddType.SelectedValue = mel.TechType; ddProfessional.SelectedValue = mel.Professional.ToString(); } } else { liCoures.Text = "添加讲师"; } Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>讲师管理</li><li>" + liCoures.Text + "</li>"); } }
/// <summary> ///更新记录 /// </summary> /// <param name="ExLecturer"></param> /// <returns></returns> public bool GetUpdate(M_ExLecturer model) { return(DBCenter.UpdateByID(model, model.ID)); }
/// <summary> ///添加记录 /// </summary> public int GetInsert(M_ExLecturer model) { return(DBCenter.Insert(model)); }