MyLesson/ServiceUser/Dept_Edit.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyLesson.ServiceUser
{
public partial class Dept_Edit : UserForm
{
protected void Page_Load(object sender, EventArgs e)
{
this.ValidateLogin();
if (!this.IsPostBack)
{
this.txtDeptID.Text = Request.QueryString["DeptID"] + "";
this.InitForm();
}
}
public void InitForm()
{
if (this.txtDeptID.Text != "")
{
PRDataContext pr = new PRDataContext();
this.txtDeptID.Enabled = false;
Inf_Dept dept = pr.Inf_Dept.Where(s => s.DeptID == this.txtDeptID.Text).SingleOrDefault();
if (dept != null)
{
this.txtDeptID.Text = dept.DeptID;
this.txtDeptName.Text = dept.DeptName;
this.txtContent.Text = dept.Content;
}
}
}
protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("Dept_List.aspx");
}
protected void btnOK_Click(object sender, EventArgs e)
{
PRDataContext pr = new PRDataContext();
Inf_Dept dept = new Inf_Dept();
if (!this.txtDeptID.Enabled)
dept = pr.GetTable<Inf_Dept>().Where(s => s.DeptID == this.txtDeptID.Text).SingleOrDefault();
if (dept != null)
{
dept.DeptID = this.txtDeptID.Text;
dept.DeptName = this.txtDeptName.Text;
dept.Content = this.txtContent.Text;
}
if (this.txtDeptID.Enabled)
{
pr.Inf_Dept.InsertOnSubmit(dept);
this.ClearTextData(this);
后面还有 11 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
