Пример #1
0
        //Lọc lại danh sách MMTB đã thanh lý/ngưng sử dụng
        private void filter_List()
        {
            Boolean _disposal = bCheck_Disposal.Checked;
            Boolean _noUsed   = bCheck_NoUsed.Checked;

            try
            {
                _tempTable = M0005_DAO.GetInfo_M0005_Filter();
                if (_tempTable.Rows.Count > 0)
                {
                    gridControl.DataSource = _tempTable;
                    advBandedGridView1.FormatRules[0].ApplyToRow = true;
                    bsiRecordsCount.Caption = advBandedGridView1.RowCount.ToString() + " of " + _tempTable.Rows.Count + " records";
                    try
                    {
                        if (_disposal == true && _noUsed == true)
                        {
                            gridControl.DataSource = _tempTable.AsEnumerable()
                                                     .Where(row => row.Field <string>("DocNo_Disposal") != null && row.Field <string>("DesLineCode") == "NoUsed").CopyToDataTable();
                            bsiRecordsCount.Caption = advBandedGridView1.RowCount.ToString() + " of " + _tempTable.Rows.Count + " records";
                        }
                        if (_disposal == true && _noUsed == false)
                        {
                            gridControl.DataSource = _tempTable.AsEnumerable()
                                                     .Where(row => row.Field <string>("DocNo_Disposal") != null).CopyToDataTable();
                            bsiRecordsCount.Caption = advBandedGridView1.RowCount.ToString() + " of " + _tempTable.Rows.Count + " records";
                        }
                        if (_disposal == false && _noUsed == true)
                        {
                            gridControl.DataSource = _tempTable.AsEnumerable()
                                                     .Where(row => row.Field <string>("DesLineCode") == "NoUsed").CopyToDataTable();
                            bsiRecordsCount.Caption = advBandedGridView1.RowCount.ToString() + " of " + _tempTable.Rows.Count + " records";
                        }
                        if (_disposal == false && _noUsed == false)
                        {
                            _tempTable = M0005_DAO.GetInfo_M0005();
                            if (_tempTable.Rows.Count > 0)
                            {
                                gridControl.DataSource = _tempTable;
                                advBandedGridView1.FormatRules[0].ApplyToRow = true;
                                bsiRecordsCount.Caption = advBandedGridView1.RowCount.ToString() + " of " + _tempTable.Rows.Count + " records";
                            }
                        }
                    }
                    catch
                    {
                        gridControl.DataSource = "";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi: " + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }