public SV getSV_ByMSSV(string mssv) { SV s = new SV(); foreach (SV i in CSDL_TG.Instance.GetListSV(0)) { if (mssv == i.MSSV) { s = i; } } return(s); }
private void addFUNC() { SV s = new SV(); s = getInform(); if (CSDL_TG.Instance.addSV(s)) { MessageBox.Show("Thêm sinh viên thành công", "Thông báo"); } else { MessageBox.Show("Mã số sinh viên đã bị trùng!", "Thông báo"); } }
private void showEdit() { SV s = CSDL_TG.Instance.getSV_ByMSSV(IDSV); tbMSSV.Text = s.MSSV; tbHoTen.Text = s.HoTen; comboBox1.SelectedIndex = s.ID_Lop - 1; dateTimePicker1.Value = s.NgaySinh; if (radioButton1.Checked) { s.GioiTinh = true; } else { s.GioiTinh = false; } }
private SV getInform() { SV s = new SV(); s.HoTen = tbHoTen.Text.ToString(); s.MSSV = tbMSSV.Text.ToString(); s.ID_Lop = ((CBBox)comboBox1.SelectedItem).Value; s.NgaySinh = Convert.ToDateTime(dateTimePicker1.Value); if (radioButton1.Checked) { s.GioiTinh = true; } else { s.GioiTinh = false; } return(s); }
//public List<SV> listSVbySort(string indexOption) //{ // List<SV> DS = new List<SV>(); // DS = GetListSV(0); // for(int i=0; i < DS.Count-1;i++) // for(int j=i+1; j < DS.Count; j++) // { // switch(indexOption) // { // case "MSSV": // if (String.Compare(DS[i].MSSV.ToString(), DS[j].MSSV.ToString()) < 0) // { // SV tmp = DS[i]; // DS[i] = DS[j]; // DS[j] = tmp; // } // break; // case "HoTen": // if (String.Compare(DS[i].HoTen.ToString(), DS[j].HoTen.ToString()) < 0) // { // SV tmp = DS[i]; // DS[i] = DS[j]; // DS[j] = tmp; // } // break; // case "NgaySinh": // if (String.Compare(DS[i].NgaySinh.ToString(), DS[j].NgaySinh.ToString()) < 0) // { // SV tmp = DS[i]; // DS[i] = DS[j]; // DS[j] = tmp; // } // break; // case "GioiTinh": // if (String.Compare(DS[i].GioiTinh.ToString(), DS[j].GioiTinh.ToString()) < 0) // { // SV tmp = DS[i]; // DS[i] = DS[j]; // DS[j] = tmp; // } // break; // case "ID_Lop": // if (DS[i].ID_Lop < DS[j].ID_Lop) // { // SV tmp = DS[i]; // DS[i]=DS[j]; // DS[j] = tmp; // } // break; // } // } // return DS; //} public List <SV> listSVbySort(Del_Sort d, int ID_Lop) { List <SV> s = GetListSV(ID_Lop); for (int i = 0; i < s.Count - 1; i++) { for (int j = i + 1; j < s.Count; j++) { if (d(s[i], s[j])) { SV tmp = s[i]; s[i] = s[j]; s[j] = tmp; } } } return(s); }
public Boolean addSV(SV s) { Boolean add = true; List <SV> DS = new List <SV>(); //đầu tiên là phải kiểm tra mssv có bị trùng không foreach (SV i in GetListSV(0)) { if (i.MSSV == s.MSSV) { return(add = false); } } foreach (SV i in GetListSV(0)) { DS.Add(i); } DS.Add(s); CSDL.Instance.setDTSV(DS); return(add); }
public void editSV(SV s) { List <SV> DS = new List <SV>(); DS = GetListSV(0); int index = 0; foreach (SV i in DS) { if (s.MSSV != i.MSSV) { index++; } else { break; } } DS[index] = s; CSDL.Instance.setDTSV(DS); }
public static bool isCompareGioiTinh(SV s1, SV s2) { return(String.Compare(s1.GioiTinh.ToString(), s2.NgaySinh.ToString()) < 0); }
public static bool isCompareNgaySinh(SV s1, SV s2) { return(DateTime.Compare(s1.NgaySinh, s2.NgaySinh) < 0); }
public static bool isCompareID_Lop(SV s1, SV s2) { return(s1.ID_Lop < s2.ID_Lop); }
public static bool isCompareHoTen(SV s1, SV s2) { return(String.Compare(s1.HoTen, s2.HoTen) < 0); }
public static bool isCompareMSSV(SV s1, SV s2) { return(String.Compare(s1.MSSV, s2.MSSV) < 0); }