private void btn_Ok_Click(object sender, EventArgs e) { try { deviceInfo device = new deviceInfo(); log_tabel condition = new log_tabel(); if (tbx_Name.Text.Trim() != "") { condition.addrow("PersonName", tbx_Name.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal); } if (dtp_Intime.Text != "") { condition.addrow("EnlistmentTime", dtp_Intime.Value.ToString("yyyy-MM-dd"), log_tabel.operatetype.equal, log_tabel.mark.Date); } int Recordcount = device.GetRecordCount(logs.PersonnelInfoList, condition); if (Recordcount > 0) { myPageControl1.PageRecordCount = Recordcount; DataTable dt = device.getpage(logs.PersonnelInfoList, condition, myPageControl1.DataStart, myPageControl1.PageRecordNumber); DataView.DataSource = dt; bindingColName(dt); } else { MessageBox.Show("无匹配数据,请重新更改查询条件!"); } tbx_Name.Text = ""; dtp_Intime.Text = ""; } catch (Exception) { throw; } }
private void btn_Search_Click(object sender, EventArgs e) { try { //if (SearchText.Text.Trim() != "") //{ // string Condition = SearchText.Text.Trim(); // deviceInfo device = new deviceInfo(); // string sql = "select * from PersonnelInfoList where PersonName like '%" + Condition + "%'"; // DataSet ds = device.gettablebycondition(sql); // DataTable dt = ds.Tables[0]; // if (dt.Rows.Count > 0 && dt != null) // { // DataView.DataSource = dt; // PersonResult = dt; // } // else // { // MessageBox.Show("找不到符合条件的人员相关信息,请重新输入!"); // } //} if (SearchText.Text.Trim() != "") { string name = "%" + SearchText.Text.Trim() + "%"; deviceInfo PersonInfo = new deviceInfo(); log_tabel log = new log_tabel(); log.addrow("EquipmentName", name, log_tabel.operatetype.like, log_tabel.mark.normal); int i = PersonInfo.GetRecordCount(logs.EquipmentInfoList, log); if (i > 0) { DataTable dt = PersonInfo.getpage(logs.PersonnelInfoList, log, myPageControl1.DataStart, myPageControl1.PageRecordNumber); DataView.DataSource = dt; bindingColName(dt); } else { MessageBox.Show("无匹配条件数据,请重新查询"); } } } catch (Exception) { throw; } }
private void btn_Ok_Click(object sender, EventArgs e) { if (this.InvokeRequired) { this.Invoke(new Action <object, EventArgs>(btn_Ok_Click), sender, e); } else { try { deviceInfo device = new deviceInfo(); log_tabel condition = new log_tabel(); if (tbx_Name.Text.Trim() != "") { condition.addrow("PersonName", tbx_Name.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal); } if (dtp_Intime.Text != "") { condition.addrow("DutyEventTime", dtp_Intime.Value.ToString("yyyy-MM-dd"), log_tabel.operatetype.lessAndEqual, log_tabel.mark.Date); //condition.addrow("DutyEventTime", "2019-04-06", log_tabel.operatetype.lessAndEqual, log_tabel.mark.Date); } int Recordcount = device.GetRecordCount(logs.DutyRecordInfoList, condition); if (Recordcount > 0) { myPageControl1.PageRecordCount = Recordcount; myPageControl1.PageRecordNumber = 100; DataTable dt = device.getpage(logs.DutyRecordInfoList, condition, myPageControl1.DataStart, myPageControl1.PageRecordNumber); DataView.DataSource = dt; bindingColName(dt); } else { MessageBox.Show("无匹配数据,请重新更改查询条件!"); } tbx_Name.Text = ""; dtp_Intime.Text = ""; } catch (Exception ex) { throw ex; } } }