Beispiel #1
0
        public SearchPersonRequestForm()
        {
            InitializeComponent();
            AddEnterKeyDown();

            rbAddNew.Checked       = true;
            rbEditOrDelete.Checked = false;
            paramSearch            = new ParamSearchPerson();
            pTable          = new PersonRequestDataSet.PersonDataTable();
            prTable         = new PersonRequestDataSet.PersonRequestDataTable();
            dcore           = new DataCoreLibrary();
            rcore           = new ReportCoreLibrary();
            mtxtYearin.Text = dcore.GetMaxYearin();
        }
Beispiel #2
0
        private void Search()
        {
            try
            {
                ParamSearchPerson param = new ParamSearchPerson();
                param.name   = textBoxName.Text;
                param.sname  = textBoxSname.Text;
                param.id8    = mTextBoxID8.Text;
                param.yearin = mtxtYearin.Text;

                gvResult.Columns.Clear();
                if (rbAddNew.Checked)
                {
                    pTable = dcore.GetSearchPersonForRequest(param);
                    setDataSource(pTable);
                    gvResult.DataSource          = soucre;
                    gvResult.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                    try
                    {
                        gvResult.Columns["navyid"].Visible    = false;
                        gvResult.Columns["oldyearin"].Visible = false;
                    }
                    catch { }
                    count = pTable.Rows.Count;
                }
                else if (rbEditOrDelete.Checked)
                {
                    prTable = dcore.GetSearchRequest(param, QueryString.Search.RequestPersonFilter.All);
                    setDataSource(prTable);
                    gvResult.DataSource          = soucre;
                    gvResult.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                    try
                    {
                        gvResult.Columns["navyid"].Visible      = false;
                        gvResult.Columns["unit"].Visible        = false;
                        gvResult.Columns["num"].Visible         = false;
                        gvResult.Columns["oldyearin"].Visible   = false;
                        gvResult.Columns["updatecount"].Visible = false;
                    }
                    catch { }
                    count = prTable.Rows.Count;
                }
                else if (rbSorting.Checked)
                {
                    prTable = dcore.GetSearchRequest(param, QueryString.Search.RequestPersonFilter.All);
                    //gvResult.DataSource = prTable;
                    setDataSource(prTable);
                    gvResult.DataSource          = soucre;
                    gvResult.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                    try
                    {
                        gvResult.Columns["navyid"].Visible      = false;
                        gvResult.Columns["unit"].Visible        = false;
                        gvResult.Columns["oldyearin"].Visible   = false;
                        gvResult.Columns["updatecount"].Visible = false;
                    }
                    catch { }
                    count = prTable.Rows.Count;
                }
                toolStripStatusLabel1.Text = Convert.ToString(count) + " Record(s)";
                gvResult.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }