Beispiel #1
0
        private void btnSort_Click(object sender, EventArgs e)
        {
            BLL_QLSV      bll  = new BLL_QLSV();
            List <string> LMMS = new List <string>();

            foreach (SV i in bll.GetListSV_BLL())
            {
                LMMS.Add(i.MSSV);
            }
            switch (cbbSort.Text)
            {
            case "Tên, A->Z":
                dtgSV.DataSource = bll.ListSVSort(LMMS, SV.Compare_NameAZ);
                break;

            case "Tên, Z->A":
                dtgSV.DataSource = bll.ListSVSort(LMMS, SV.Compare_NameZA);
                break;

            case "MSSV, Thấp -> Cao":
                dtgSV.DataSource = bll.ListSVSort(LMMS, SV.Compare_MSSVThapCao);
                break;

            case "MSSV, Cao -> Thấp":
                dtgSV.DataSource = bll.ListSVSort(LMMS, SV.Compare_MSSVCaoThap);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void Show(int ID_Lop, string txtSearch = "", string sortBy = "")
        {
            List <SV> listSV;

            if (ID_Lop > 0)
            {
                listSV = BLL_QLSV.Instance.GetAllSVByIdLop(ID_Lop);
            }
            else
            {
                listSV = BLL_QLSV.Instance.GetAllSV();
            }

            List <string> listMSSV = new List <string>();

            foreach (SV sv in listSV)
            {
                listMSSV.Add(sv.MSSV);
            }

            switch (sortBy)
            {
            case "NameSV":
                listSV = BLL_QLSV.ListSVSort(listMSSV, BLL_QLSV.sortNameSVDESC);
                break;

            case "MSSV":
                listSV = BLL_QLSV.ListSVSort(listMSSV, BLL_QLSV.sortMSSVDESC);
                break;
            }

            if (!txtSearch.Equals(""))
            {
                listSV = BLL_QLSV.searchByText(txtSearch, listSV);
            }

            for (int i = 0; i < listSV.Count; i++)
            {
                foreach (CBBItem item in this.cbbLopSH.Items)
                {
                    if (listSV[i].ID_Lop.Equals(Convert.ToInt32(item.value)))
                    {
                        listSV[i].Ten_Lop = item.key;
                    }
                }
            }

            this.dgvDSSV.DataSource = listSV;
            // Hide id column, Id_Lop column of SV in data gridview
            this.dgvDSSV.Columns[0].Visible = false;
            this.dgvDSSV.Columns[4].Visible = false;
        }
Beispiel #3
0
        private void btnSort_Click(object sender, EventArgs e)
        {
            List <string> listMSSV = new List <string>();

            foreach (DataGridViewRow dr in this.dgvDSSV.Rows)
            {
                string s = dr.Cells["MSSV"].Value.ToString();
                listMSSV.Add(s);
            }

            string sortBy = GetSortByFromCBB();

            if (sortBy.Equals("NameSV"))
            {
                this.dgvDSSV.DataSource = BLL_QLSV.ListSVSort(listMSSV, BLL_QLSV.sortNameSVDESC);
            }
            else if (sortBy.Equals("MSSV"))
            {
                this.dgvDSSV.DataSource = BLL_QLSV.ListSVSort(listMSSV, BLL_QLSV.sortMSSVDESC);
            }
        }