public void DeleteLoan(string qrId) { SQLManager.DeleteLoanAndLoaner(qrId); }
public bool CheckForExistingPC(bool qrIdExists, string qrId) { qrIdExists = SQLManager.CheckQR(qrId); return(qrIdExists); }
public int CheckExistingUniLoginForStudentOrTeacher(int isStudent, string uniLogin) { isStudent = SQLManager.CheckIsStudentOrTeacher(isStudent, uniLogin); return(isStudent); }
public void Submit() { // Put hele den her i flere metoder og henvis til en "Submit" metode ResetLabelColors(); bool noEmptyFields = false; noEmptyFields = CheckForEmptyFields(noEmptyFields); bool uniLoginExists = true; string uniLogin = UniLoginInput.Text.ToLower(); int isStudent = 1; string name = NameInput.Text.ToLower(); string phone = PhonenumberInput.Text; bool isTeacher = false; string qrId = QRInput.Text; bool pcInStock = false; if (noEmptyFields == true) { uniLoginExists = CheckForExistingUNILogin(uniLoginExists, uniLogin); } if (uniLoginExists == true) { isStudent = CheckExistingUniLoginForStudentOrTeacher(isStudent, uniLogin); } else { isStudent = StudentOrTeacher(isStudent); } if (isStudent == 0) { isTeacher = true; } DateTime startDate = DateTime.Now; DateTime endDate = (DateTime)DateInput.SelectedDate; if (uniLoginExists == false && isTeacher == false) { pcInStock = CheckForPCInStock(pcInStock, qrId); if (pcInStock == true) { PassOnLoanerData(uniLoginExists, uniLogin, name, phone, isStudent); SQLManager.CreateLoan(uniLogin, qrId, startDate, endDate); LoanConfirmationMessageBox(); Clear(); } } else if (uniLoginExists == true && isTeacher == false) { ActiveLoanMessageBox(uniLogin); } else if (uniLoginExists == true && isTeacher == false && IsTeacherCheckBox.IsChecked == true) { UniLoginBelongsToStudentMessage(); } else if (uniLoginExists == true && isTeacher == true && IsStudentCheckBox.IsChecked == true) { UniLoginBelongsToTeacherMessage(); } else if (isTeacher == true) { // Ny metode for de her og henvis til den List <string> qrMultiList = new List <string>(); if (QRInput.Text != "") { QRMultiInput.Items.Add(QRInput.Text); } foreach (var pc in QRMultiInput.Items) { pcInStock = CheckForPCInStock(pcInStock, pc.ToString()); if (pcInStock == true) { qrMultiList.Add(pc.ToString()); } } if (qrMultiList.Count != 0) { PassOnLoanerData(uniLoginExists, uniLogin, name, phone, isStudent); foreach (string qr in qrMultiList) { SQLManager.CreateLoan(uniLogin, qr, startDate, endDate); } LoanConfirmationMessageBox(); qrMultiList.Clear(); Clear(); } } }
public bool CheckForExistingUNILogin(bool uniLoginExists, string uniLogin) { uniLoginExists = SQLManager.CheckUniLogin(uniLogin); return(uniLoginExists); }