private void createbutton_Click(object sender, EventArgs e) { CourseRegistration c = new CourseRegistration(); CourseRepository cRepo = new CourseRepository(); CourseRegistrationRepository d = new CourseRegistrationRepository(); CourseResultsRepository rr = new CourseResultsRepository(); c.CourseId = this.courseidtextBox.Text; c.CourseName = d.GetCourse2(this.courseidtextBox.Text).CourseName; c.Section = d.GetCourse2(this.courseidtextBox.Text).Section; c.Semester = d.GetCourse2(this.courseidtextBox.Text).Semester; c.AccountId = this.accountidtextBox.Text; c.Status = "Confirmed"; CourseRegistrationRepository cr = new CourseRegistrationRepository(); CourseRepository r = new CourseRepository(); AccountRepository ar = new AccountRepository(); StudentBalanceRepository sRepo = new StudentBalanceRepository(); StudentBalance sb = new StudentBalance(); sb.AccountId = this.accountidtextBox.Text; try { s = ar.GetAccountTypeShovon2(c.AccountId).AccountType; } catch { } if (cr.CourseVerification2(c.CourseId) == this.courseidtextBox.Text && s == "Student" && cRepo.GetCourse2(this.courseidtextBox.Text).MaxStudent != cRepo.GetCourse2(this.courseidtextBox.Text).CurrentStudent) { if (cr.DoubleIDRegistrationVerify(this.accountidtextBox.Text, this.courseidtextBox.Text).Contains(this.accountidtextBox.Text)) { MessageBox.Show("Student Already In the Course "); } else { if (cr.Insert2(c) && rr.DoReg(c.AccountId, c.CourseId, c.Semester, c.Section, c.CourseName) && sRepo.UpdateStudentBalance(sb)) { if (r.Increase2(c.CourseId)) { MessageBox.Show("Successful"); } else { MessageBox.Show("Error Current Student Not Increased"); } } else { MessageBox.Show("Error Inserting"); } } } else { MessageBox.Show("Error Course Or Student Verification"); } }
public bool UpdateInvalide2(StudentBalance s) { try { string query = "UPDATE StudentBalanceTable SET Validation = 'Valid', Balance = '" + s.Balance + "' WHERE AccountId = '" + s.AccountId + "'"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); return(true); } catch { return(false); } }
public bool UpdateScholarshipEligible2(StudentBalance s) { try { string query = "UPDATE StudentBalanceTable SET Scholarship = '" + s.Scholarship + "' WHERE AccountId= '" + s.AccountId + "'"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); return(true); } catch { return(false); } }
public bool Insert2(StudentBalance a) { try { string query = "INSERT into StudentBalanceTable VALUES ('" + a.AccountId + "', '" + a.Semester + "','" + a.Scholarship + "', " + a.Balance + ",'" + a.Validation + "')"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); dcc.CloseConnection(); return(true); } catch { return(false); } }
private void EligibleClicked(object sender, EventArgs e) { StudentBalanceRepository sRepo = new StudentBalanceRepository(); StudentBalance s = new StudentBalance(); s.AccountId = this.comboBoxAccountId.Text; s.Scholarship = "Eligible For Scholarship"; if (sRepo.UpdateScholarshipEligible2(s)) { MessageBox.Show("Scholarship Is Eligible Now", "Successful"); } else { MessageBox.Show("Error", "Failed"); } }
private void ValidClicked(object sender, EventArgs e) { StudentBalance s = new StudentBalance(); s.AccountId = this.comboBoxAccountId.Text; s.Balance = 0; StudentBalanceRepository sRepo = new StudentBalanceRepository(); if (sRepo.UpdateInvalide2(s)) { MessageBox.Show("Validation Updated", "Successful"); } else { MessageBox.Show("Error", "Failed"); } }
private void ApproveClicked(object sender, EventArgs e) { StudentBalanceRepository sRepo = new StudentBalanceRepository(); StudentBalance s = new StudentBalance(); s.AccountId = this.comboBoxAccountId.Text; s.Scholarship = this.textBoxScholarshipPercentage.Text; if (sRepo.UpdateScholarshipPercentage2(s)) { MessageBox.Show("Scholarship Updated", "Successful"); } else { MessageBox.Show("Error", "Failed"); } }
private void createbutton_MouseClick(object sender, MouseEventArgs e) { Account t = new Account(); t.AccountId = this.idtextBox.Text; t.Password = this.passsettextBox.Text; t.Gender = this.gendercomboBox.Text; t.Address = this.addresstextBox.Text; t.Name = this.nametextBox.Text; t.AccountType = "Student"; t.BloodGroup = this.bloodgrouptextbox.Text; t.DOB = this.dobtextbox.Text; StudentBalance q = new StudentBalance(); q.AccountId = this.idtextBox.Text; q.Semester = "none"; q.Scholarship = "none"; q.Balance = 0; q.Validation = "invalid"; AccountRepository aRepo = new AccountRepository(); StudentBalanceRepository sRepo = new StudentBalanceRepository(); if (aRepo.DoubleAccountIDRegistrationVerify().Contains(this.idtextBox.Text)) { MessageBox.Show("Account Exixists"); } else { if (aRepo.Insert2(t)) { if (sRepo.Insert2(q)) { MessageBox.Show("Successful Creation"); } } else { MessageBox.Show("Creation Failed ", "Failed"); } } }
public List <string> GetAccountIdsScholarshipApprove2() { string query = "SELECT * from StudentBalanceTable WHERE Scholarship = 'Eligible For Scholarship'"; List <string> sList = new List <string>(); DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query); while (sdr.Read()) { StudentBalance s = new StudentBalance(); s.AccountId = sdr["AccountId"].ToString(); s.Semester = sdr["Semester"].ToString(); s.Scholarship = sdr["Scholarship"].ToString(); s.Balance = Convert.ToDouble(sdr["Balance"]); s.Validation = sdr["Validation"].ToString(); sList.Add(s.AccountId); } dcc.CloseConnection(); return(sList); }