public Form_addCourseToStaffAndStudent(User u) { InitializeComponent(); // init connection to database dal = new DbContextDal(); //Receives a staff member indicating what authorization is, to know what actions are allowed user = u; if (user != null) { if (user.permission.Equals("Secretary")) { staffMember = secretary = dal.secretaries.Find(user.ID); } else if (user.permission.Equals("Admin")) { staffMember = admin = dal.admins.Find(user.ID); } else if (user.permission.Equals("Lecturer")) { staffMember = lecturer = dal.lecturers.Find(user.ID); } else if (user.permission.Equals("Practitioner")) { staffMember = practitioner = dal.practitiners.Find(user.ID); } else if (user.permission.Equals("Student")) { student = dal.students.Find(user.ID); } else { MessageBox.Show("Error: Could not identify user details!"); clickGoBack = true; Close(); } } else { MessageBox.Show("Error: Could not identify user details!"); clickGoBack = true; Close(); } resertDetailCourse(); UpdateDefaultButton(); initPermission(); GeneralFuntion.BlockResizeListViewColumns(listView_coursesFounded); GeneralFuntion.Form_Center_FixedDialog(this); }
private void btn_resetDetails_Click(object sender, EventArgs e) { txt_TB_ID.Text = ""; txt_TB_Name.Text = ""; txt_TB_Date.Text = ""; txt_TB_Password.Text = ""; txt_TB_Phone.Text = ""; txt_CB_Gender.Text = ""; txt_CB_Type.Text = ""; txt_TB_Email.Text = ""; isOnUpdating = false; staffSelected = null; updateButtons(); listView_staffFounded.Items.Clear(); }
private void txt_TB_idOfStaffMember_TextChanged(object sender, EventArgs e) { GeneralFuntion.textBox_numeric(txt_TB_idOfStaffMember, null); int id = -1; try { id = System.Convert.ToInt32(txt_TB_idOfStaffMember.Text.ToString()); } catch (Exception) { } staffMember = null; if (id > 0) { staffMember = getStaffMemberFromID(id); } if (staffMember != null) { lbl_permission_change.Text = staffMember.Type; btn_add_toStaffmember.Text = "Add to - " + staffMember.Name + " ( " + staffMember.ID + " )"; UpdateButtons(); } else { Student std = dal.students.Find(id); if (std != null) { lbl_permission_change.Text = "Student"; btn_add_toStaffmember.Text = "Add to - " + std.Name + " ( " + std.ID + " )"; UpdateButtons(); } else { lbl_permission_change.Text = "Premission"; btn_add_toStaffmember.Text = "Add"; UpdateButtons(); } } }
private bool validDetailsOfRequiredFields() { bool flag = true; string strErrorMassage = ""; staffSelected = new StaffMember(); try { staffSelected.ID = System.Convert.ToInt32(txt_TB_ID.Text.ToString()); } catch (Exception) { flag = false; } if (txt_CB_Gender.Text.Length > 0) { staffSelected.Gender = txt_CB_Gender.Text.ToString(); } else { flag = false; strErrorMassage += "* Gender field is invalid : 'empty' .\n"; } if (txt_CB_Type.Text.Length > 0) { staffSelected.Type = txt_CB_Type.Text.ToString(); } else { flag = false; strErrorMassage += "* Type field is invalid : 'empty' .\n"; } string str_name = txt_TB_Name.Text.ToString(); if (str_name.Trim().Length > 0) { str_name = GeneralFuntion.CapitalizeFirstLetterEachWord(str_name); staffSelected.Name = str_name; } else { strErrorMassage += "* Name field is invalid : 'empty' .\n"; } DateTime date; bool parseResult = DateTime.TryParse(txt_TB_Date.Text.ToString(), out date); if (parseResult) { //parse was successful, continue DateTime now = DateTime.Today; if (date.Year < now.Year && (now.Year - date.Year) < 120 && (now.Year - date.Year) > 0) { staffSelected.BirthDate = date; int age = now.Year - staffSelected.BirthDate.GetValueOrDefault().Year; if (now < staffSelected.BirthDate.GetValueOrDefault().AddYears(age)) { age--; } if (age >= 0 && age <= 120) { staffSelected.Age = age; } else { staffSelected.Age = -1; } } else { strErrorMassage += "* Birth-Date field is invalid : '" + txt_TB_Date.Text + "' .\n"; } } else { if (txt_TB_Date.TextLength == 0) { strErrorMassage += "* Birth-Date field is invalid : 'empty' .\n"; } else { strErrorMassage += "* Birth-Date field is invalid : '" + txt_TB_Date.Text + "' .\n"; } } string str_phoneNumber = txt_TB_Phone.Text.ToString(); if (GeneralFuntion.ValidPhone(str_phoneNumber) && str_phoneNumber.Length > 0) { staffSelected.Phone = str_phoneNumber; } else { if (str_phoneNumber.Equals("")) { strErrorMassage += "* PhoneNumber field is invalid : 'empty' .\n"; } else { strErrorMassage += "* PhoneNumber field is invalid : '" + str_phoneNumber + "' .\n"; } } if (txt_TB_Password.TextLength == 0) { strErrorMassage += "* Password field is invalid : 'empty' (default password: '******').\n"; } if (dal.users.Where(x => x.email.Equals(txt_TB_Email.Text)).FirstOrDefault() != null) { strErrorMassage += "* Email field is invalid : Already exist student with this email.\n"; txt_TB_Email.Text = ""; } if (!strErrorMassage.Equals("")) { MessageBox.Show("There is some invalid values: \n\n" + strErrorMassage + "\nAdd a " + staffSelected.Type + " with NULL value at thes fields."); } return(flag); }
private void listView_studentFounded_SelectedIndexChanged(object sender, EventArgs e) { // get the id code of course from selected list string strcode = ""; // if there is items in list if (listView_staffFounded.Items.Count > 0) { try { strcode = listView_staffFounded.SelectedItems[0].Text.ToString(); } catch (Exception) { } // if we get nothing , exit if (strcode.Equals("")) { return; } } else { return; } // id of the course int id = -1; // convert from string try { id = System.Convert.ToInt32(strcode); } catch (Exception) { return; } // find the specefic course from database try { userSelected = dal.users.Find(id); if (userSelected != null) { if (userSelected.permission.Equals("Secretary")) { staffSelected = dal.secretaries.Find(id); } else if (userSelected.permission.Equals("Admin")) { staffSelected = dal.admins.Find(id); } else if (userSelected.permission.Equals("Lecturer")) { staffSelected = dal.lecturers.Find(id); } else if (userSelected.permission.Equals("Practitioner")) { staffSelected = dal.practitiners.Find(id); } else if (userSelected.permission.Equals("StudentCoordinator")) { staffSelected = dal.StudentCoordinators.Find(id); } else if (userSelected.permission.Equals("Grader")) { staffSelected = dal.Graders.Find(id); } else if (userSelected.permission.Equals("Registrar")) { staffSelected = dal.Registrars.Find(id); } } } catch (Exception) { return; } // update the detail of course in the down pane of detail course to add my list courses learning if (staffSelected != null && userSelected != null) { isOnUpdating = true; txt_TB_Name.Text = staffSelected.Name; txt_TB_Password.Text = userSelected.password; txt_TB_Email.Text = userSelected.email; txt_TB_Phone.Text = staffSelected.Phone; txt_CB_Gender.Text = staffSelected.Gender; txt_CB_Type.Text = staffSelected.Type; txt_TB_Date.Text = staffSelected.BirthDate.Value.ToShortDateString(); updateButtons(); txt_TB_ID.Text = staffSelected.ID.ToString(); } else { isOnUpdating = false; } updateButtons(); }
private void btn_search_Click(object sender, EventArgs e) { // Clear the ListView control items listView_staffFounded.Items.Clear(); if (lecturer != null) { listAdmins = null; listSecretaries = null; listPractitioners = null; listLecturers = dal.lecturers.Where(x => x.ID == lecturer.ID).ToList <Lecturer>(); } else if (practitioner != null) { listAdmins = null; listSecretaries = null; listLecturers = null; listPractitioners = dal.practitiners.Where(x => x.ID == practitioner.ID).ToList <Practitioner>(); } else if (staffSelected != null) { listView_staffFounded.Items.Clear(); listLecturers = dal.lecturers.Where(x => x.ID == staffSelected.ID).ToList <Lecturer>(); listPractitioners = dal.practitiners.Where(x => x.ID == staffSelected.ID).ToList <Practitioner>(); listSecretaries = dal.secretaries.Where(x => x.ID == staffSelected.ID).ToList <Secretary>(); listAdmins = dal.admins.Where(x => x.ID == staffSelected.ID).ToList <Admin>(); listStudentC = dal.StudentCoordinators.Where(x => x.ID == staffSelected.ID).ToList <StudentCoordinator>(); listRegistrars = dal.Registrars.Where(x => x.ID == staffSelected.ID).ToList <Registrar>(); listGraders = dal.Graders.Where(x => x.ID == staffSelected.ID).ToList <Grader>(); } else { // search course by id - from database if (txt_TB_ID.TextLength > 0) { int id = System.Convert.ToInt32(txt_TB_ID.Text.ToString()); User u = dal.users.Find(id); if (u != null) { if (u.permission.Equals("Secretary")) { staffSelected = dal.secretaries.Find(id); } else if (u.permission.Equals("Lecturer")) { staffSelected = dal.lecturers.Find(id); } else if (u.permission.Equals("Practitioner")) { staffSelected = dal.practitiners.Find(id); } else if (u.permission.Equals("Admin")) { staffSelected = dal.admins.Find(id); } else if (u.permission.Equals("Grader")) { staffSelected = dal.Graders.Find(id); } else if (u.permission.Equals("Registrar")) { staffSelected = dal.Registrars.Find(id); } else if (u.permission.Equals("StudentCoordinator")) { staffSelected = dal.StudentCoordinators.Find(id); } } } // search course by name - from database else if (txt_TB_Name.TextLength > 0) { listSecretaries = dal.secretaries.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Secretary>(); listLecturers = dal.lecturers.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Lecturer>(); listPractitioners = dal.practitiners.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Practitioner>(); listAdmins = dal.admins.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Admin>(); listStudentC = dal.StudentCoordinators.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <StudentCoordinator>(); listRegistrars = dal.Registrars.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Registrar>(); listGraders = dal.Graders.Where(x => x.Name.Contains(txt_TB_Name.Text.ToString())).ToList <Grader>(); } else if (!txt_CB_Gender.Text.Equals("")) { listSecretaries = dal.secretaries.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Secretary>(); listLecturers = dal.lecturers.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Lecturer>(); listPractitioners = dal.practitiners.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Practitioner>(); listAdmins = dal.admins.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Admin>(); listStudentC = dal.StudentCoordinators.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <StudentCoordinator>(); listRegistrars = dal.Registrars.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Registrar>(); listGraders = dal.Graders.Where(x => x.Gender.Equals(txt_CB_Gender.Text.ToString())).ToList <Grader>(); } else if (!txt_CB_Type.Text.Equals("")) { if (txt_CB_Type.Text.Equals("Secretary")) { listSecretaries = dal.secretaries.ToList <Secretary>(); listLecturers = null; listPractitioners = null; listAdmins = null; listGraders = null; listRegistrars = null; listStudentC = null; } else if (txt_CB_Type.Text.Equals("Lecturer")) { listSecretaries = null; listLecturers = dal.lecturers.ToList <Lecturer>(); listPractitioners = null; listAdmins = null; listGraders = null; listRegistrars = null; listStudentC = null; } else if (txt_CB_Type.Text.Equals("Practitioner")) { listSecretaries = null; listLecturers = null; listPractitioners = dal.practitiners.ToList <Practitioner>(); listAdmins = null; listGraders = null; listRegistrars = null; listStudentC = null; } else if (txt_CB_Type.Text.Equals("Admin")) { listSecretaries = null; listLecturers = null; listPractitioners = null; listGraders = null; listRegistrars = null; listStudentC = null; listAdmins = dal.admins.ToList <Admin>(); } else if (txt_CB_Type.Text.Equals("Grader")) { listSecretaries = null; listLecturers = null; listPractitioners = null; listAdmins = null; listGraders = dal.Graders.ToList <Grader>(); listRegistrars = null; listStudentC = null; } else if (txt_CB_Type.Text.Equals("Registrar")) { listSecretaries = null; listLecturers = null; listPractitioners = null; listAdmins = null; listRegistrars = dal.Registrars.ToList <Registrar>(); listGraders = null; listStudentC = null; } else if (txt_CB_Type.Text.Equals("StudentCoordinator")) { listSecretaries = null; listLecturers = null; listPractitioners = null; listAdmins = null; listStudentC = dal.StudentCoordinators.ToList <StudentCoordinator>(); listGraders = null; listRegistrars = null; } } else if (!txt_TB_Date.Text.Equals("")) { try { DateTime date; bool parseResult = DateTime.TryParse(txt_TB_Date.Text.ToString(), out date); if (parseResult) { listSecretaries = dal.secretaries.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Secretary>(); listLecturers = dal.lecturers.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Lecturer>(); listPractitioners = dal.practitiners.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Practitioner>(); listAdmins = dal.admins.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Admin>(); listStudentC = dal.StudentCoordinators.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <StudentCoordinator>(); listRegistrars = dal.Registrars.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Registrar>(); listGraders = dal.Graders.Where(x => x.BirthDate.Value.Year == date.Year && x.BirthDate.Value.Month == date.Month && x.BirthDate.Value.Day == date.Day).ToList <Grader>(); } else { listSecretaries = null; listLecturers = null; listPractitioners = null; listAdmins = null; listGraders = null; listRegistrars = null; listStudentC = null; } } catch (Exception) { listSecretaries = null; listLecturers = null; listPractitioners = null; listAdmins = null; listGraders = null; listRegistrars = null; listStudentC = null; } } else if (!txt_TB_Phone.Text.Equals("")) { listSecretaries = dal.secretaries.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Secretary>(); listLecturers = dal.lecturers.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Lecturer>(); listPractitioners = dal.practitiners.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Practitioner>(); listAdmins = dal.admins.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Admin>(); listGraders = dal.Graders.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Grader>(); listRegistrars = dal.Registrars.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <Registrar>(); listStudentC = dal.StudentCoordinators.Where(x => x.Phone.Contains(txt_TB_Phone.Text.ToString())).ToList <StudentCoordinator>(); } // display all courses - from database else { listSecretaries = dal.secretaries.ToList <Secretary>(); listLecturers = dal.lecturers.ToList <Lecturer>(); listPractitioners = dal.practitiners.ToList <Practitioner>(); listAdmins = dal.admins.ToList <Admin>(); listGraders = dal.Graders.ToList <Grader>(); listRegistrars = dal.Registrars.ToList <Registrar>(); listStudentC = dal.StudentCoordinators.ToList <StudentCoordinator>(); } } // there aren't any courses, exit if (staffSelected == null && listSecretaries == null && listLecturers == null && listPractitioners == null && listAdmins == null && listStudentC == null && listRegistrars == null && listGraders == null) { MessageBox.Show("Can't find any staffMember!"); return; } int j = 0; // add items to listView controll corses string[] arr = new string[9]; ListViewItem itm; //= new ListViewItem(); if (listSecretaries != null) { for (int i = 0; i < listSecretaries.Count(); i++) { arr[0] = listSecretaries.ElementAt(i).ID.ToString(); arr[1] = listSecretaries.ElementAt(i).Name; arr[2] = listSecretaries.ElementAt(i).Gender.ToString(); arr[3] = listSecretaries.ElementAt(i).Age.ToString(); if (listSecretaries.ElementAt(i).BirthDate != null) { arr[4] = listSecretaries.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listSecretaries.ElementAt(i).Phone; arr[6] = dal.users.Find(listSecretaries.ElementAt(i).ID).email; arr[7] = listSecretaries.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listLecturers != null) { for (int i = 0; i < listLecturers.Count(); i++) { arr[0] = listLecturers.ElementAt(i).ID.ToString(); arr[1] = listLecturers.ElementAt(i).Name; arr[2] = listLecturers.ElementAt(i).Gender.ToString(); arr[3] = listLecturers.ElementAt(i).Age.ToString(); if (listLecturers.ElementAt(i).BirthDate != null) { arr[4] = listLecturers.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listLecturers.ElementAt(i).Phone; arr[6] = dal.users.Find(listLecturers.ElementAt(i).ID).email; arr[7] = listLecturers.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listPractitioners != null) { for (int i = 0; i < listPractitioners.Count(); i++) { arr[0] = listPractitioners.ElementAt(i).ID.ToString(); arr[1] = listPractitioners.ElementAt(i).Name; arr[2] = listPractitioners.ElementAt(i).Gender.ToString(); arr[3] = listPractitioners.ElementAt(i).Age.ToString(); if (listPractitioners.ElementAt(i).BirthDate != null) { arr[4] = listPractitioners.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listPractitioners.ElementAt(i).Phone; arr[6] = dal.users.Find(listPractitioners.ElementAt(i).ID).email; arr[7] = listPractitioners.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listAdmins != null) { for (int i = 0; i < listAdmins.Count(); i++) { arr[0] = listAdmins.ElementAt(i).ID.ToString(); arr[1] = listAdmins.ElementAt(i).Name; arr[2] = listAdmins.ElementAt(i).Gender.ToString(); arr[3] = listAdmins.ElementAt(i).Age.ToString(); if (listAdmins.ElementAt(i).BirthDate != null) { arr[4] = listAdmins.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listAdmins.ElementAt(i).Phone; arr[6] = dal.users.Find(listAdmins.ElementAt(i).ID).email; arr[7] = listAdmins.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listStudentC != null) { for (int i = 0; i < listStudentC.Count(); i++) { arr[0] = listStudentC.ElementAt(i).ID.ToString(); arr[1] = listStudentC.ElementAt(i).Name; arr[2] = listStudentC.ElementAt(i).Gender.ToString(); arr[3] = listStudentC.ElementAt(i).Age.ToString(); if (listStudentC.ElementAt(i).BirthDate != null) { arr[4] = listStudentC.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listStudentC.ElementAt(i).Phone; arr[6] = dal.users.Find(listStudentC.ElementAt(i).ID).email; arr[7] = listStudentC.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listRegistrars != null) { for (int i = 0; i < listRegistrars.Count(); i++) { arr[0] = listRegistrars.ElementAt(i).ID.ToString(); arr[1] = listRegistrars.ElementAt(i).Name; arr[2] = listRegistrars.ElementAt(i).Gender.ToString(); arr[3] = listRegistrars.ElementAt(i).Age.ToString(); if (listRegistrars.ElementAt(i).BirthDate != null) { arr[4] = listRegistrars.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listRegistrars.ElementAt(i).Phone; arr[6] = dal.users.Find(listRegistrars.ElementAt(i).ID).email; arr[7] = listRegistrars.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } if (listGraders != null) { for (int i = 0; i < listGraders.Count(); i++) { arr[0] = listGraders.ElementAt(i).ID.ToString(); arr[1] = listGraders.ElementAt(i).Name; arr[2] = listGraders.ElementAt(i).Gender.ToString(); arr[3] = listGraders.ElementAt(i).Age.ToString(); if (listGraders.ElementAt(i).BirthDate != null) { arr[4] = listGraders.ElementAt(i).BirthDate.Value.ToShortDateString(); } else { arr[4] = ""; } arr[5] = listGraders.ElementAt(i).Phone; arr[6] = dal.users.Find(listGraders.ElementAt(i).ID).email; arr[7] = listGraders.ElementAt(i).Type; itm = new ListViewItem(arr); listView_staffFounded.Items.Add(itm); // colored the line in listview if (j % 2 == 1) { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#f2f2f2"); } else { listView_staffFounded.Items[j++].BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff"); } } } listView_staffFounded.Sort(); }
public bool addNewStaffMember(StaffMember s, string password, string email) { return(SettingDatabase.Add_New_StaffMember(s, password, email)); }