📄 wfrmcoursematerialedit.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class WfrmCourseMaterialEdit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
String l_str = Request["IID"];
String l_strC = Request["CourseID"];
CCourseFactory l_cfactory = new CCourseFactory(Session["DbManager"].ToString());
CCourse l_course = l_cfactory.queryByCourseID(l_strC);
CCourseMaterial l_cm = getCMFactory().queryByIID(l_str);
display(l_cm, l_course);
this.設定唯讀(true);
}
}
private void display(CCourseMaterial p_cm,CCourse p_course)
{
txtCourseName.Text = p_course.CourseName;
txtAuther.Text=p_cm.Author;
txtCourseID.Text=p_cm.CourseID;
txtCreator.Text=p_cm.Creator;
txtMaterial.Text=p_cm.Material;
txtMnote.Text=p_cm.MNote;
txtPublisher.Text=p_cm.Publisher;
}
protected void btnOK_Click(object sender, EventArgs e)
{
String l_str = Request["IID"];
CCourseMaterial l_cm =new CCourseMaterial();
l_cm.CourseID = txtCourseID.Text;
l_cm.Author = txtAuther.Text;
l_cm.Material = txtMaterial.Text;
l_cm.MNote = txtMnote.Text;
l_cm.Publisher = txtPublisher.Text;
l_cm.Creator = txtCreator.Text;
l_cm.IID = l_str;
getCMFactory().update(l_cm);
Session["CM"] = "編輯";
Response.Redirect("WfrmCourseMaterial.aspx");
}
private void 設定唯讀(bool isReadOnly)
{
txtCourseID.ReadOnly = isReadOnly;
txtCourseName.ReadOnly = isReadOnly;
}
private CCourseMaterialFactory iv_cmFactory;
private CCourseMaterialFactory getCMFactory()
{
if (iv_cmFactory == null)
{
iv_cmFactory = new CCourseMaterialFactory(Session["DbManager"].ToString());
}
return iv_cmFactory;
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("WfrmCourseMaterial.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -