示例#1
0
 /// <summary>
 /// 模糊搜索事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CheckSimpleButton_Click(object sender, EventArgs e)
 {
     if (BGW1.IsBusy == false)
     {
         gridControl1.RefreshDataSource();
         BGW1.RunWorkerAsync("SearchData");
     }
 }
示例#2
0
 /// <summary>
 /// 分页事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridViewPaging1_PagingChanged(object sender, MyPagingEventArgs e)
 {
     if (BGW1.IsBusy == false)
     {
         gridControl1.RefreshDataSource();
         BGW1.RunWorkerAsync("SearchData");
     }
 }
示例#3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            //excel side of things
            dgRes.Rows.Clear();
            searchInProgress = true;
            PopulateExcelData();

            if (cbSQL.Checked)
            {
                //sql side of things - first build the query string
                queryString = "SELECT * FROM [" + tableName + "]";

                if (txtName.Text != "" || txtEmpNum.Text != "" || cmbGender.Text != "" || txtHighSal.Text != "" || txtLowSal.Text != "")
                {
                    queryString = queryString + " WHERE "; //if any of the fields have been included, we must develop this query string further
                    if (!string.IsNullOrEmpty(txtName.Text))
                    {
                        queryString = queryString + " [NAME] = '" + txtName.Text + "' AND "; //add name elements to the query string
                    }
                    if (!string.IsNullOrEmpty(cmbGender.Text))
                    {
                        queryString = queryString + " [GENDER] = '" + cmbGender.Text + "' AND "; //add gender elements...
                    }
                    if (!string.IsNullOrEmpty(txtEmpNum.Text))
                    {
                        if (rdoExactEmpNum.Checked)
                        {
                            queryString = queryString + " [EMPLOYEE NUMBER] = '" + txtEmpNum.Text + "' AND "; //add employee number...
                        }
                        else
                        {
                            queryString = queryString + " [EMPLOYEE NUMBER] LIKE '%" + txtEmpNum.Text + "%' AND ";
                        }
                    }
                    if (!string.IsNullOrEmpty(txtLowSal.Text) && !string.IsNullOrEmpty(txtHighSal.Text))
                    {
                        queryString = queryString + " [SALARY] BETWEEN '" + txtLowSal.Text + "' AND '" + txtHighSal.Text + "' AND "; //add salary elements...
                    }
                    //take the last AND off the query string and close it
                    char[] trimLastAnd = { ' ', 'A', 'N', 'D', ' ' };
                    queryString = (queryString.TrimEnd(trimLastAnd));
                    //queryString = queryString + ")";
                }

                btnSearch.Enabled = false;
                BGW1.RunWorkerAsync(); //run search operations in a backgroundworker so as not to disrupt other stuff or risk non-responsiveness on larger tables
            }
        }
示例#4
0
 /// <summary>
 /// 窗体初始化加载
 /// </summary>
 private void frmInterfaceChoose_Load(object sender, EventArgs e)
 {
     client = new SRDevice.DeviceServiceClient();
     BGW1.RunWorkerAsync("SearchData");
 }