⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modify.aspx.cs

📁 走吧旅游网站前后台源代码
💻 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;
using LTP.Common;
namespace Maticsoft.Web.Staffs
{
    public partial class Modify : System.Web.UI.Page
    {       

        		protected void Page_LoadComplete(object sender, EventArgs e)
		{
			(Master.FindControl("lblTitle") as Label).Text = "信息修改";
		}
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null || Request.Params["id"].Trim() != "")
				{
					string id = Request.Params["id"];
					ShowInfo(int.Parse(id));
				}
			}
		}
			
private void ShowInfo(string StaffID)
{
	Maticsoft.BLL.Staffs bll=new Maticsoft.BLL.Staffs();
	Maticsoft.Model.Staffs model=bll.GetModel(StaffID);
	this.lblStaffID.Text=model.StaffID;
	this.txtStaffName.Text=model.StaffName;
	this.txtGender.Text=model.Gender;
	this.txtKnowledge.Text=model.Knowledge;
	this.txtNativePlace.Text=model.NativePlace;
	this.txtBirthDate.Text=model.BirthDate.ToString();
	this.txtPhone.Text=model.Phone;
	this.txtNowAddress.Text=model.NowAddress;
	this.txtIDCardNo.Text=model.IDCardNo;
	this.txtIDCardAddress.Text=model.IDCardAddress;
	this.txtPassword.Text=model.Password;
	this.txtRecUserID.Text=model.RecUserID;
	this.txtRecDate.Text=model.RecDate.ToString();

}
		protected void btnAdd_Click(object sender, EventArgs e)
		{
			
	string strErr="";
	if(this.txtStaffName.Text =="")
	{
		strErr+="StaffName不能为空!\\n";	
	}
	if(this.txtGender.Text =="")
	{
		strErr+="Gender不能为空!\\n";	
	}
	if(this.txtKnowledge.Text =="")
	{
		strErr+="Knowledge不能为空!\\n";	
	}
	if(this.txtNativePlace.Text =="")
	{
		strErr+="NativePlace不能为空!\\n";	
	}
	if(!PageValidate.IsDateTime(txtBirthDate.Text))
	{
		strErr+="BirthDate不是时间格式!\\n";	
	}
	if(this.txtPhone.Text =="")
	{
		strErr+="Phone不能为空!\\n";	
	}
	if(this.txtNowAddress.Text =="")
	{
		strErr+="NowAddress不能为空!\\n";	
	}
	if(this.txtIDCardNo.Text =="")
	{
		strErr+="IDCardNo不能为空!\\n";	
	}
	if(this.txtIDCardAddress.Text =="")
	{
		strErr+="IDCardAddress不能为空!\\n";	
	}
	if(this.txtPassword.Text =="")
	{
		strErr+="Password不能为空!\\n";	
	}
	if(this.txtRecUserID.Text =="")
	{
		strErr+="RecUserID不能为空!\\n";	
	}
	if(!PageValidate.IsDateTime(txtRecDate.Text))
	{
		strErr+="RecDate不是时间格式!\\n";	
	}

	if(strErr!="")
	{
		MessageBox.Show(this,strErr);
		return;
	}
	string StaffName=this.txtStaffName.Text;
	string Gender=this.txtGender.Text;
	string Knowledge=this.txtKnowledge.Text;
	string NativePlace=this.txtNativePlace.Text;
	DateTime BirthDate=DateTime.Parse(this.txtBirthDate.Text);
	string Phone=this.txtPhone.Text;
	string NowAddress=this.txtNowAddress.Text;
	string IDCardNo=this.txtIDCardNo.Text;
	string IDCardAddress=this.txtIDCardAddress.Text;
	string Password=this.txtPassword.Text;
	string RecUserID=this.txtRecUserID.Text;
	DateTime RecDate=DateTime.Parse(this.txtRecDate.Text);


	Maticsoft.Model.Staffs model=new Maticsoft.Model.Staffs();
	model.StaffName=StaffName;
	model.Gender=Gender;
	model.Knowledge=Knowledge;
	model.NativePlace=NativePlace;
	model.BirthDate=BirthDate;
	model.Phone=Phone;
	model.NowAddress=NowAddress;
	model.IDCardNo=IDCardNo;
	model.IDCardAddress=IDCardAddress;
	model.Password=Password;
	model.RecUserID=RecUserID;
	model.RecDate=RecDate;
	Maticsoft.BLL.Staffs bll=new Maticsoft.BLL.Staffs();
	bll.Update(model);
		}

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -