📄 pa02_userinfo.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using WebService;
public partial class UserInfo : System.Web.UI.Page
{
int _operatorID = -1;
string _ticket = "dsgfsd";
string _expMsg = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
int _orgID = int.Parse(Request.QueryString["OrgID"].ToString());//获取从TreeView单击组织ID
ShowEmployeessInfo(_orgID);
}
else
{
int _orgID = int.Parse(Request.QueryString["OrgID"].ToString());//获取从TreeView单击组织ID
tb_employeeInfo.Rows.Clear();
ShowEmployeessInfo(_orgID);
}
}
public void ShowEmployeessInfo(int _OrgID)
{
VinciService vinciService = new VinciService();
EmployeesEntity[] employeesEntity;
employeesEntity = vinciService.GetEmployeessListByOrgID(_OrgID,_operatorID,_ticket,out _expMsg);
//循环查询每一个员工
for (int i = 0; i < employeesEntity.Length; i++)
{
HtmlTableRow htmlTableRow = new HtmlTableRow();
if (i % 2 == 1)
{
htmlTableRow.Attributes["class"] = "LineItem1";
}
HtmlTableCell cell_EmployeeID = new HtmlTableCell();
cell_EmployeeID.InnerText = employeesEntity[i].EmployeeID.ToString();
htmlTableRow.Cells.Add(cell_EmployeeID);
HtmlTableCell cell_LastName = new HtmlTableCell();
cell_LastName.InnerText = employeesEntity[i].LastName;
htmlTableRow.Cells.Add(cell_LastName);
HtmlTableCell cell_FirstName = new HtmlTableCell();
cell_FirstName.InnerText = employeesEntity[i].FirstName;
htmlTableRow.Cells.Add(cell_FirstName);
HtmlTableCell cell_Title = new HtmlTableCell();
cell_Title.InnerText = employeesEntity[i].Title;
htmlTableRow.Cells.Add(cell_Title);
HtmlTableCell cell_BirthDate = new HtmlTableCell();
cell_BirthDate.InnerText = employeesEntity[i].BirthDate.ToString();
htmlTableRow.Cells.Add(cell_BirthDate);
HtmlTableCell cell_HireDate = new HtmlTableCell();
cell_HireDate.InnerText = employeesEntity[i].HireDate.ToString();
htmlTableRow.Cells.Add(cell_HireDate);
HtmlTableCell cell_Address = new HtmlTableCell();
cell_Address.InnerText = employeesEntity[i].Address;
htmlTableRow.Cells.Add(cell_Address);
HtmlTableCell cell_City = new HtmlTableCell();
cell_City.InnerText = employeesEntity[i].City;
htmlTableRow.Cells.Add(cell_City);
HtmlTableCell cell_ReportsTo = new HtmlTableCell();
cell_ReportsTo.InnerText = employeesEntity[i].ReportsTo.ToString(); ;
htmlTableRow.Cells.Add(cell_ReportsTo);
HtmlTableCell cell_OrgID = new HtmlTableCell();
cell_OrgID.InnerText = employeesEntity[i].OrgID.ToString();
htmlTableRow.Cells.Add(cell_OrgID);
HtmlTableCell cell_IsActive = new HtmlTableCell();
cell_IsActive.InnerText = employeesEntity[i].IsActive.ToString();
htmlTableRow.Cells.Add(cell_IsActive);
HtmlTableCell cell_LoginName = new HtmlTableCell();
cell_LoginName.InnerText = employeesEntity[i].LoginName;
htmlTableRow.Cells.Add(cell_LoginName);
HtmlTableCell cell_Notes = new HtmlTableCell();
cell_Notes.InnerText = employeesEntity[i].Notes;
htmlTableRow.Cells.Add(cell_Notes);
HtmlTableCell cell_edit = new HtmlTableCell();
//cell_edit.InnerHtml = "<input id=btn_edit_" + employeesEntity[i].EmployeeID.ToString() + " type='button' value='编辑信息' />";
Button btn_edit = new Button();
btn_edit.ID = "btn_edit_" + employeesEntity[i].EmployeeID.ToString();
btn_edit.Text = "编辑";
btn_edit.Click+=new EventHandler(btn_edit_Click);
cell_edit.Controls.Add(btn_edit);
htmlTableRow.Cells.Add(cell_edit);
HtmlTableCell cell_delete = new HtmlTableCell();
//cell_delete.InnerHtml = "<input id='btn_delete_" + employeesEntity[i].EmployeeID.ToString() + "' type='button' runat='server'onserverclick='Button_ServerClick' value='删除记录' />";
Button btn_delete = new Button();
btn_delete.ID = "btn_delete_" + employeesEntity[i].EmployeeID.ToString();
//btn_delete.Attributes["onclick"] = "btn_delete_Click";
btn_delete.Text = "删除";
btn_delete.Click += new EventHandler(btn_delete_Click);
btn_delete.Attributes["onclick"] = "if(!confirm( \"确定删除? \")) return false; ";
cell_delete.Controls.Add(btn_delete);
htmlTableRow.Cells.Add(cell_delete);
tb_employeeInfo.Rows.Add(htmlTableRow);
}
}
protected void btn_delete_Click(object sender, EventArgs e)
{
string strBtnName = (sender as Button).ID;
//Response.Write("<script language='javascript'>alert('"+((Button)sender).ID.ToString().Split(new char[]{'_'})[2].ToString()+"')</script>");
string employeeID = strBtnName.Split(new char[] { '_' })[2].ToString();
int int_employeeID = int.Parse(employeeID);
VinciService vinciService = new VinciService();
EmployeesEntity employeesEntity=new EmployeesEntity();
employeesEntity = vinciService.GetEmployeesEntity(int_employeeID, _operatorID, _ticket, out _expMsg);
vinciService.DeleteEmployeesInfo(employeesEntity, _operatorID, _ticket);
this.Page_Load(sender, e);
}
protected void btn_edit_Click(object sender, EventArgs e)
{
string strBtnName = (sender as Button).ID;
//Response.Write("<script language='javascript'>alert('"+((Button)sender).ID.ToString().Split(new char[]{'_'})[2].ToString()+"')</script>");
string employeeID =strBtnName.Split(new char[] { '_' })[2].ToString();
Response.Redirect("PA02_EditUserInfo.aspx?employeeID=" + employeeID);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -