updateuserinfo.aspx.cs
来自「该服务平台解决了计算机网络与移动网络之间信息交换问题」· CS 代码 · 共 233 行
CS
233 行
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 UserManagement_UpdateUserInfo : System.Web.UI.Page
{
private DataAccess.TableAccessor.UserInfo userInfoAccessor;
private DataAccess.TableAccessor.CountyVillage countyVillageAccessor;
private DataAccess.TableAccessor.UserOperation userOperation;
private DataAccess.TableAccessor.UserConporation userCorporation;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// int pageindex = 0;
int systemUserID = 0;
//// try
// {
// pageindex = int.Parse(Request.QueryString[1].ToString());
// }
//// catch
// //{ Response.Close(); }
//try
{
//int coperationID = int.Parse(Request.QueryString[1].ToString);
systemUserID = int.Parse(Request.QueryString[0].ToString());
int arID = int.Parse(Request.QueryString["arID"].ToString());
//string departID = Request.QueryString["departID"].ToString();
int departID = int.Parse(Request.QueryString["departID"].ToString());
}
//catch
//{
// Response.Write("<script language='javascript'>alert('接收参数错误!');</script>");
// return;
//}
FillArea();
FillControls();
}
}
private void FillArea()
{
countyVillageAccessor = new DataAccess.TableAccessor.CountyVillage();
this.cbArea.DataSource = countyVillageAccessor.GetAreaInfo();
this.cbArea.DataTextField = "AreaName";
this.cbArea.DataValueField = "AreaID";
this.cbArea.DataBind();
ListItem listArea = new ListItem("全部", "0");
this.cbArea.Items.Insert(0, listArea);
}
private void FillCorporation(int areaID)
{
userCorporation = new DataAccess.TableAccessor.UserConporation();
this.cbCorporation.DataSource = userCorporation.GetCorporationInfoByAreaID(areaID);
this.cbCorporation.DataTextField = "CorporationName";
this.cbCorporation.DataValueField = "CorporationID";
this.cbCorporation.DataBind();
}
private void FillControls()
{
userInfoAccessor = new DataAccess.TableAccessor.UserInfo();
userOperation = new DataAccess.TableAccessor.UserOperation();
userCorporation = new DataAccess.TableAccessor.UserConporation();
DataTable dt = userInfoAccessor.GetSingleUserInfo(int.Parse(Request.QueryString[0].ToString()));
this.tbUserDefineID.Text = dt.Rows[0]["UserDefineID"].ToString();
this.tbName.Text = dt.Rows[0]["Name"].ToString();
this.tbMobile.Text = dt.Rows[0]["Mobile"].ToString();
this.tbHomeAddress.Text = dt.Rows[0]["HomeAddress"].ToString();
this.tbSchool.Text = dt.Rows[0]["School"].ToString();
this.tbSchoolAge.Text = dt.Rows[0]["SchoolAge"].ToString();
this.tbDuty.Text = dt.Rows[0]["Duty"].ToString();
this.tbSpecality.Text = dt.Rows[0]["Speciality"].ToString();
this.cbSex.SelectedValue = dt.Rows[0]["Sex"].ToString();
this.tbcard.Text = dt.Rows[0]["IDcard"].ToString();
this.Jiguan.Text = dt.Rows[0]["Jiguan"].ToString();
this.tbrace.Text = dt.Rows[0]["Race"].ToString();
this.tbregist.Text = dt.Rows[0]["Hukou"].ToString();
this.tbNowaddress.Text = dt.Rows[0]["NowAddress"].ToString();
this.tbtime.Text = dt.Rows[0]["Jointime"].ToString();
this.tbbeizhu.Text = dt.Rows[0]["Beizhu"].ToString();
this.tbBirthday.Text = dt.Rows[0]["Birthday"].ToString();
ListItem listArea = new ListItem();
listArea.Text = "当前为:"+dt.Rows[0]["AreaName"].ToString();
listArea.Value = dt.Rows[0]["AreaID"].ToString();
cbArea.Items.Insert(0, listArea);
FillCorporation(int.Parse(this.cbArea.SelectedValue));
ListItem listCorporation = new ListItem();
listCorporation.Text = "当前为:" + dt.Rows[0]["CorporationName"].ToString();
listCorporation.Value = dt.Rows[0]["CorporationID"].ToString();
cbCorporation.Items.Insert(0, listCorporation);
int tradeid = int.Parse(dt.Rows[0]["TradeID"].ToString());
this.cbTrader.SelectedValue = tradeid.ToString(); ;// int.Parse(dt.Rows[0]["TradeID"].ToString());
if (tradeid == 0)
{
this.cbTrader.Visible = true;
this.cbTrader.Text = "农迅通";
}
else if (tradeid == 1)
{
this.cbTrader.Visible = true;
this.cbTrader.Text = "小灵通";
}
else
{
this.cbTrader.Visible = true;
}
DataTable dtUserOperation = userOperation.GetSimpMan(int.Parse(Request.QueryString[0].ToString()));
}
protected void btnOK_Click(object sender, EventArgs e)
{
int arID = int.Parse(Request.QueryString["arID"].ToString());
string departID = Request.QueryString["departID"].ToString();
if (tbMobile.Text != "")
{
userInfoAccessor = new DataAccess.TableAccessor.UserInfo();
userCorporation = new DataAccess.TableAccessor.UserConporation();
int areaID = 0;
try
{
areaID = int.Parse(cbArea.SelectedValue);
}
catch
{
Response.Write("<script language='javascript'>alert('用户组未选择!');</script>");
string goUrl = string.Format("<script language='javascript'>window.location.href = 'UpdateUserInfo.aspx?smsID={0}'; </script>", int.Parse(Request.QueryString[0].ToString()));
Response.Write(goUrl);
return;
}
int countyID = 0;
int villageID = 0;
string name = tbName.Text;
string defineID = tbUserDefineID.Text;
int sex = int.Parse(cbSex.SelectedValue);
string birthday = tbBirthday.Text;;
//if (tbBirthday.Text.Length == 4)
//{
// birthday =
//}
string home = tbHomeAddress.Text;
string mobile = tbMobile.Text;
int trade = int.Parse (cbTrader.SelectedValue);
int userFuncation = int.Parse(cbTrader.SelectedValue);
string school = tbSchool.Text;
string schoolAge = tbSchoolAge.Text;
string duty = tbDuty.Text;
string speciality = tbSpecality.Text;
int userID = int.Parse(Request.QueryString[0].ToString());
int corporationID = 0;
string idcard = tbcard.Text;
string jiguan = Jiguan.Text;
string race = tbrace.Text ;
string hukou = tbregist.Text;
string nowaddress = tbNowaddress.Text;
string jointime = tbtime.Text;
string beizhu = tbbeizhu.Text;
try
{
corporationID = int.Parse(this.cbCorporation.SelectedValue);
}
catch
{
Response.Write("<script language='javascript'>alert('部门单位未选择!');</script>");
string goUrl = string.Format("<script language='javascript'>window.location.href = 'UpdateUserInfo.aspx?smsID={0}'; </script>", int.Parse(Request.QueryString[0].ToString()));
Response.Write(goUrl);
return;
}
try
{
userInfoAccessor.UpdateUserInfo(areaID, corporationID, villageID, defineID, name, sex, birthday, home, mobile,
trade, userFuncation, userID, school, schoolAge, duty, speciality, idcard, jiguan, race, hukou, nowaddress, jointime, beizhu);
//userCorporation.UpdateUserCorporation(corporationID, userID);
Response.Write("<script language='javascript'>alert('更新用户信息成功!');</script>");
string goUrl = string.Format("<script language='javascript'>window.location.href = 'UpdateUserInfo.aspx?smsID={0}&arID={1}&departID={2}'; </script>", int.Parse(Request.QueryString[0].ToString()),arID,departID);
Response.Write(goUrl);
return;
}
catch
{
Response.Write("<script language='javascript'>alert('更新用户信息失败!');</script>");
string goUrl = string.Format("<script language='javascript'>window.location.href = 'UpdateUserInfo.aspx?smsID={0}&arID={1}&departID={2}'; </script>", int.Parse(Request.QueryString[0].ToString()), arID, departID);
Response.Write(goUrl);
return;
}
}
else
{
Response.Write("<script language='javascript'>alert('手机号未输入!');</script>");
string goUrl = string.Format("<script language='javascript'>window.location.href = 'UpdateUserInfo.aspx?smsID={0}&arID={1}&departID={2}'; </script>",
int.Parse(Request.QueryString[0].ToString()), arID, departID);
Response.Write(goUrl);
return;
}
}
protected void btnRetrun_Click(object sender, EventArgs e)
{
int departID = int.Parse(Request.QueryString["departID"].ToString());
int arID = int.Parse(Request.QueryString["arID"].ToString());
//string departID = Request.QueryString["departID"].ToString();
string goUrl = string.Format("<script>window.location.href = 'UserInfoList.aspx?arID={0}&departID={1}'</script>", arID, departID);
Response.Write(goUrl);
}
protected void cbArea_SelectedIndexChanged(object sender, EventArgs e)
{
FillCorporation(int.Parse(this.cbArea.SelectedValue));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?