コード例 #1
0
        private async void EmpNameSearch(string name)
        {
            try
            {
                string columns = "a_employee_number,a_name_last,a_name_first,a_org_primary,a_object_primary,a_location_primary,a_location_p_desc,a_location_p_short";
                string query   = "SELECT TOP " + maxResults + " " + columns + " FROM pr_employee_master";

                var searchParams = new QueryParamCollection();
                searchParams.Add("a_name_last", name.ToUpper(), false, "OR");
                searchParams.Add("a_name_first", name.ToUpper(), false, "OR");

                SetWorking(true);

                var comms = new MunisComms();
                using (var cmd = comms.GetSqlCommandFromParams(query, searchParams.Parameters))
                    using (var results = await comms.ReturnSqlTableFromCmdAsync(cmd))
                    {
                        if (results.Rows.Count > 0)
                        {
                            MunisResults.DataSource = null;
                            MunisResults.DataSource = results;
                            MunisResults.ClearSelection();
                        }
                    }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                SetWorking(false);
            }
        }
コード例 #2
0
 private void MunisResults_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     selectedEmpInfo.Name   = MunisResults.CurrentRowStringValue("a_name_first") + " " + MunisResults.CurrentRowStringValue("a_name_last");
     selectedEmpInfo.Number = MunisResults.CurrentRowStringValue("a_employee_number");
     SelectedEmpLabel.Text  = "Selected Emp: " + selectedEmpInfo.Name + " - " + selectedEmpInfo.Number;
 }