protected void Btn_login_Click1(object sender, EventArgs e) { string username = Tbx_userID.Text; string pwd = Tbx_userpwd.Text; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(pwd)) { Mgr.ShowAlert(this, "用户名或密码为空"); return; } if (!Mgr.CheckStr(username) || !Mgr.CheckStr(pwd)) { Mgr.ShowAlert(this, "包含非法字符"); return; } if (Mgr.Login(this, Tbx_userID.Text, Tbx_userpwd.Text)) { Response.Redirect("Navigate.aspx"); } else { //Lbl_message.Text = "用户名或密码错误"; } }
protected void Button1_Click(object sender, EventArgs e) { DBBase db = new DBBase( ); string s = ""; DataTable dt = new DataTable( ); switch (SelectType.SelectedIndex) { case 0: if (!Mgr.CheckStr(GH.Text)) { Mgr.ShowAlert(this, "工号不正确"); return; } s = "select departmentname AS '部门名字', employeecode AS '工号', chinesename AS '姓名',ondutytime AS '入职日期',qualified as '休假资格',year_s3 as '年假产生年',year_s1 AS '休假年',shouldhav AS '年假天数', h_used AS '已休天数',h_left AS '剩余天数' from dbo.V_employee_yearholiday "; s += " WHERE employeecode = " + GH.Text; s += " AND year_s1 = " + Mgr.QuoteStr(Convert.ToDateTime(YearTime.Text).Year.ToString( )); s += " order By employeecode ASC"; dt = db.SqlOpen(s); GridView1.DataSource = dt; GridView1.DataBind( ); break; case 1: s = "select departmentname AS '部门名字', employeecode AS '工号', chinesename AS '姓名',ondutytime AS '入职日期',qualified as '休假资格',year_s3 as '年假产生年',year_s1 AS '休假年',shouldhav AS '年假天数', h_used AS '已休天数',h_left AS '剩余天数' from dbo.V_employee_yearholiday "; s += " WHERE departmentname = " + Mgr.QuoteStr(cbx_depart.SelectedItem.Text); s += " AND year_s1 = " + Mgr.QuoteStr(Convert.ToDateTime(YearTime.Text).Year.ToString( )); s += " order By employeecode ASC"; dt = db.SqlOpen(s); GridView1.DataSource = dt; GridView1.DataBind( ); break; default: break; } }