Esempio n. 1
0
        private void Search()
        {
            try
            {
                if (!tempInput.CheckSameValue(inputSearch.GetInput()))
                {
                    tempInput           = inputSearch.GetInput();
                    personNivyData      = dcore.GetSearchPersonNivyTemplate(tempInput, itemsPerPage, page, out count);
                    gvResult.DataSource = personNivyData;
                }
                else
                {
                    tempInput           = inputSearch.GetInput();
                    personNivyData      = dcore.GetSearchPersonNivyTemplate(tempInput, itemsPerPage, page, out count);
                    gvResult.DataSource = personNivyData;
                }

                if (count <= itemsPerPage)
                {
                    totalPage = Function.CalTotalPage(count, itemsPerPage);
                    labelCountSearchRecord.Text = Convert.ToString(count) + " Record(s)";
                    labelPaging.Text            = page.ToString() + "/" + totalPage.ToString();
                }
                else
                {
                    totalPage = Function.CalTotalPage(count, itemsPerPage);
                    labelCountSearchRecord.Text = Convert.ToString((page * itemsPerPage) - itemsPerPage + 1) + " - " + Convert.ToString(page * itemsPerPage) + " of " + Convert.ToString(count) + " Record(s)";
                    labelPaging.Text            = page.ToString() + "/" + totalPage.ToString();
                }
                EnableButtonPage();
                gvResult.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void Search()
        {
            pictureBox1.Visible = true;
            try
            {
                tempInput = inputSearch.GetInput();
                if (checkBoxSearchNivyAll.Checked)
                {
                    personNavyData = dcore.GetSearchPersonNavy(tempInput, true, itemsPerPage, page, out count);
                }
                else
                {
                    personNavyData = dcore.GetSearchPersonNavy(tempInput, false, itemsPerPage, page, out count);
                }
                gvResult.DataSource = personNavyData;

                if (count <= itemsPerPage)
                {
                    totalPage = Function.CalTotalPage(count, itemsPerPage);
                    labelCountSearchRecord.Text = Convert.ToString(count) + " Record(s)";
                    labelPaging.Text            = page.ToString() + "/" + totalPage.ToString();
                }
                else
                {
                    totalPage = Function.CalTotalPage(count, itemsPerPage);
                    labelCountSearchRecord.Text = Convert.ToString((page * itemsPerPage) - itemsPerPage + 1) + " - " + Convert.ToString(page * itemsPerPage) + " of " + Convert.ToString(count) + " Record(s)";
                    labelPaging.Text            = page.ToString() + "/" + totalPage.ToString();
                }
                EnableButtonPage();

                gvResult.ClearSelection();
                bool focus = gvResult.Focus();
                if (gvResult.Rows.Count > 0)
                {
                    gvResult.Rows[0].Cells[0].Selected = true;
                    gvResult.BeginEdit(true);
                    //gvResult.CurrentRow.Selected = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            pictureBox1.Visible = false;
        }