本文整理汇总了C#中Operation.NameToPSID方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.NameToPSID方法的具体用法?C# Operation.NameToPSID怎么用?C# Operation.NameToPSID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation.NameToPSID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
//查询用户
protected void Button1_Click(object sender, EventArgs e)
{
//输入异常检查
string strIn = TextBox1.Text.Trim();
//有点问题,数字挂字母??
Regex r=new Regex(@"\d{1,100}");
if(r.IsMatch(strIn) & (strIn.Length<5|strIn.Length>6))
{
if (Session["lang"].ToString() == "zh-cn")
Response.Write("<script>alert('PSID的长度必须是5或者6!');window.location.href='./Query_employee.aspx'</script>");
else
Response.Write("<script>alert('The length of PSID must be 5 or 6!');window.location.href='./Query_employee.aspx'</script>");
return;
}
Query qr = new Query();
DataTable dt = new DataTable();
DataTable dtEmployeeExist = new DataTable();
//Query by PSID or Name
if (r.IsMatch(strIn))
{
dt = qr.QueryByPSID(strIn);
Session["PSID"] = strIn;
dtEmployeeExist = qr.GetEmployeeByPSID(strIn);
}
else
{
dt = qr.QueryByName(strIn);
Operation op = new Operation();
Session["PSID"] = op.NameToPSID(strIn);
dtEmployeeExist = qr.GetEmployeeByName(strIn);
}
//该employee不存在的处理
if (dtEmployeeExist.Rows.Count == 0)
{
if (Session["lang"].ToString() == "zh-cn")
Response.Write("<script>alert('" + TextBox1.Text.Trim() + " 不存在!');window.location.href='./Query_employee.aspx'</script>");
else
Response.Write("<script>alert('" + TextBox1.Text.Trim() + " does not exist!');window.location.href='./Query_employee.aspx'</script>");
return;
}
//有该employee,但借阅记录为空的处理
if (dt.Rows.Count == 0)
{
if (Session["lang"].ToString() == "zh-cn")
Response.Write("<script>alert('" + TextBox1.Text.Trim() + " 没有借阅任何图书!');window.location.href='./Query_employee.aspx'</script>");
else
Response.Write("<script>alert('" + TextBox1.Text.Trim() + " did not borrow any book!');window.location.href='./Query_employee.aspx'</script>");
return;
}
GridView1.DataSource = dt;
GridView1.DataBind();
}