asp.net中的c#编程语句不明白 高手指点

来源:百度知道 编辑:UC知道 时间:2024/07/07 23:33:14
private int insert()
{
PxOA.Model.MR.Diary model = new PxOA.Model.MR.Diary();
model.EmpID = empID;
model.DiaryDate = tbDiaryDate.Text.ToString().ToString();
model.DiaryContent = tbDiaryContent.Text.ToString().ToString();
return new PxOA.BLL.MR.Diary().Add(model);
}
public SqlDataReader getDrDiary(string empID, string diaryID)
{
return new PxOA.BLL.MR.Diary().GetReaderByEmpIDAndDiaryID(empID, diaryID);
}
protected void btnOK_Click(object sender, EventArgs e)
{
if (insert() > 0)
{
JScript.Alert("添加成功");
Response.Write("<script>window.location='DiaryManage.aspx'</script>");
}
else
{
JScript.Alert("添加失败");
}
}
}
希望详细点 万分感谢!

private int insert()
{
//这一句是申明实体类,3层的模式
PxOA.Model.MR.Diary model = new PxOA.Model.MR.Diary();
//给实体类的EmpID赋值
model.EmpID = empID;
//给实体类的DiaryDate 赋值,获取的页面上控件的值
model.DiaryDate = tbDiaryDate.Text.ToString().ToString();
//给实体类的DiaryContent 赋值,获取的页面上控件的值
model.DiaryContent = tbDiaryContent.Text.ToString().ToString();
//使用添加方法添加数据,bll逻辑层
return new PxOA.BLL.MR.Diary().Add(model);
}
//这个方法是根据empID和diaryID获取对应的SqlDataReader
public SqlDataReader getDrDiary(string empID, string diaryID)
{
//调用的是bll逻辑层的方法处理数据
return new PxOA.BLL.MR.Diary().GetReaderByEmpIDAndDiaryID(empID, diaryID);
}
//按钮事件
protected void btnOK_Click(object sender, EventArgs e)
{
//判断添加是否成功
if (insert() > 0)
{
//让js显示提示
JScript.Alert("添加成功");
//跳转页面,可以使用其他方法
Response.Write("<script>window.location='DiaryManage.aspx'</script>");
}
e