private void bindFromPIS(string group_id, string pisincs) { SQLServerQuery ss = new SQLServerQuery(); DataTable dt = new DataTable(); string schtext = SchPPLBox.Text.TrimEnd(); dt = ss.LoadPIS(schtext, pisincs); ResultListBox.DataSource = dt; ResultListBox.DataTextField = "NAME_fk"; ResultListBox.DataValueField = "P_ID"; ResultListBox.DataBind(); }
protected void SchBox_Changed(object sender, EventArgs e) { string sch = SchBox.Text; try { // DataTable dt_temp = ViewState["ALLPPL"] as DataTable; SQLServerQuery ss = new SQLServerQuery(); string result = ""; //foreach (DataRow r in dt_temp.Rows) //{ // result = result + r["EMPLOYEE_ID"].ToString() + ","; //} //result = result.TrimEnd(','); DataTable dt = ss.LoadPIS(sch, result); if (dt.Rows.Count > 0) { string EmployeeID = dt.Rows[0]["P_ID"].ToString(); string Name = dt.Rows[0]["FULLNAMETH"].ToString(); string posname = dt.Rows[0]["POSNAME"].ToString(); string unitname = dt.Rows[0]["unitname"].ToString(); string MOBILE = dt.Rows[0]["mobile"].ToString(); string UNITCODE = dt.Rows[0]["UNITCODE"].ToString(); SetGroup(EmployeeID, UNITCODE); EmployeeIDLabel.Text = EmployeeID; NameLabel.Text = Name; posnameLabel.Text = posname; unitnameLabel.Text = unitname; TelLabel.Text = MOBILE; resultppl.Visible = true; SavePPL.Enabled = true; NoResult.Visible = false; } else { string EmployeeID = ""; string Name = ""; string posname = ""; string unitname = ""; string MOBILE = ""; EmployeeIDLabel.Text = EmployeeID; NameLabel.Text = Name; posnameLabel.Text = posname; unitnameLabel.Text = unitname; TelLabel.Text = MOBILE; SavePPL.Enabled = false; NoResult.Visible = true; errorlabel.Text = "ไม่พบข้อมูล"; resultppl.Visible = false; } } catch { string EmployeeID = ""; string Name = ""; string posname = ""; string unitname = ""; string MOBILE = ""; EmployeeIDLabel.Text = EmployeeID; NameLabel.Text = Name; posnameLabel.Text = posname; unitnameLabel.Text = unitname; TelLabel.Text = MOBILE; SavePPL.Enabled = false; NoResult.Visible = true; errorlabel.Text = "ไม่พบข้อมูล"; resultppl.Visible = false; } }