public static void FilterListView(ref ListView lv, string tableNameOrQuery,
                                          string orderby, ProgressBar progressbar1 = null, string[] fields = null, bool IsByQuery = false)
        {
            string[] cols;

            List <Hashtable> filteredList;

            if (IsByQuery)
            {
                cols = new string[fields.Count()];
                for (int i = 0; i < fields.Count(); i++)
                {
                    cols[i] = fields[i];
                }
                filteredList = FilterByQuery(ref lv, fields, tableNameOrQuery, orderby);
            }
            else
            {
                filteredList = FilterByTable(ref lv, out cols, tableNameOrQuery, orderby);
            }

            ListViewHelper.Fill(ref lv, filteredList, cols, progressbar1, false);
            Form form1 = (Form)lv.Parent;

            DynamicFormHelper.RefreshStatistics(ref form1, "0", filteredList.Count.ToString());

            // DynamicToolbarsHelper.RefreshFilterTextBoxesPanel(ref lv);
        }
예제 #2
0
        public static ListView ShowList(
            ref Form form1, string listviewName, List <Hashtable> of_list, string[] cols,
            string fromDate, string toDate, string newCount, string tableName,
            string orderby, ProgressBar progressBar1)
        {
            Cursor.Current = Cursors.WaitCursor;
            DynamicToolbarsHelper.orderBy = orderby;

            RefreshStatistics(ref form1, newCount, of_list.Count.ToString());

            ListView listView1     = null;
            int      nLen          = form1.Controls.Count;
            int      listviewIndex = -1;

            for (int i = 0; i < nLen; i++)
            {
                if (form1.Controls[i].Name == listviewName)
                {
                    listviewIndex = i;
                }
            }
            if (listviewIndex >= 0)
            {
                form1.Controls.RemoveAt(listviewIndex);
            }
            Point location = new Point(10, listview_top);

            listView1 = DynamicFormHelper.Create_Listview(ref form1, listviewName, location);

            ListViewHelper.Fill(ref listView1, of_list, cols, progressBar1, false);

            // sets global orderBy variable
            DynamicToolbarsHelper.RefreshToolBars(ref listView1, tableName);
            // listView1.Focus();
            Cursor.Current = Cursors.Default;
            return(listView1);
        }