Ejemplo n.º 1
0
        private void SearchData()
        {
            Cursor.Current = Cursors.WaitCursor;
            string strSearchCustomer;
            string strSearchUseYN;

            try
            {
                strSearchCustomer = lueSearchCustomer.EditValue.ToString();
                if (string.IsNullOrEmpty(strSearchCustomer))
                {
                    strSearchCustomer = "%";
                }


                strSearchUseYN = lueSearchUseYN.Properties.GetKeyValueByDisplayText(lueSearchUseYN.Text).ToString();
                if (string.IsNullOrEmpty(strSearchUseYN))
                {
                    strSearchUseYN = "%";
                }

                var qry = db.stp_Customer_Select(strSearchCustomer, strSearchUseYN).ToList();
                if (qry.Count() > 0)
                {
                    gcList.DataSource = qry;
                    string[] arr = { "CustomerID" };
                    Functions.SetInvisible(ref gvList, arr);
                    gvList.BestFitColumns();
                    gvList.OptionsBehavior.ReadOnly = true;
                    gvList.FocusedRowHandle         = gvList.GetVisibleRowHandle(0);
                }
                else
                {
                    gcList.DataSource = null;
                    MessageBox.Show("No Results", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Couldn't Search Customer List!" + Environment.NewLine + ex.Message.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }