protected void RegistrationSubmit_Button_Click(object sender, EventArgs e) { string name = string.IsNullOrWhiteSpace(Name_Textbox.Text) ? "" : Name_Textbox.Text; string email = string.IsNullOrWhiteSpace(Email_Textbox.Text) ? "" : Email_Textbox.Text; string login = string.IsNullOrWhiteSpace(LoginName_Textbox.Text) ? "" : LoginName_Textbox.Text; string reason = string.IsNullOrWhiteSpace(Reason_Textbox.Text) ? "" : Reason_Textbox.Text; string newOrReactivate = string.IsNullOrWhiteSpace(NewOrReactivate_RadioButtonList.SelectedItem.Value) ? "" : NewOrReactivate_RadioButtonList.SelectedItem.Value; DateTime needDate = DateTime.MinValue; if (!DateTime.TryParse(DateNeeded_Textbox.Text, out needDate)) { needDate = DateTime.Now; } if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(email) && !string.IsNullOrWhiteSpace(login) && !string.IsNullOrWhiteSpace(reason) && !string.IsNullOrWhiteSpace(newOrReactivate)) { //SaveRegistrationInformation(name, email, login, reason, newOrReactivate, needDate); CourseRegistrationRepository repo = new CourseRegistrationRepository(); int loginId; repo.SaveRegistrationData(name, email, login, reason, newOrReactivate, needDate, out loginId); } Response.Redirect("PostRegistration.aspx"); }
private void SectionComboBox_SelectedIndexChanged(object sender, EventArgs e) { section = this.SectionComboBox.Text; CourseRegistrationRepository cr = new CourseRegistrationRepository(); this.IDComboBox.DataSource = cr.GetOnlyID(semester, ID, course, section); }
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"); } }
protected void Register_Button_Click(object sender, EventArgs e) { string classIdAsString = RegisterClass_Textbox.Text; int classId; if (int.TryParse(classIdAsString, out classId)) { if (RegisteredClassIds.Contains(classId)) { Feedback_Label.Text = "It appears you have already registered for that class."; Feedback_Label.CssClass = "feedback-text-attention"; } else { Student student = ((Student)Session["LoggedInUser"]); CourseRegistrationRepository repo = new CourseRegistrationRepository(); if (repo.RegisterClassForStudentId(classId, student.StudentId)) { Feedback_Label.Text = "Congrats! You have registered for the class."; Feedback_Label.CssClass = "feedback-text-success"; } else { Feedback_Label.Text = "Something went wrong -- please try again later."; Feedback_Label.CssClass = "feedback-text-attention"; } } } else { Feedback_Label.Text = "Something went wrong -- Class ID needs to be a number."; Feedback_Label.CssClass = "feedback-text-attention"; } }
public async Task <ActionResult <Payment> > GenerateRegistration( [FromHeader] int idUser, int idCourse, [FromServices] CourseRegistrationRepository context, [FromServices] PaymentRepository paymentContext ) { var payment = await paymentContext.VerifyPayments(idUser, idCourse); if (payment == null) { return(NotFound(new { message = "Inscrição e pagamentos não encontrados" })); } if (payment.PaymentsReceived > 0) { await context.GenerateRegistration(idUser, idCourse); return(Ok(new { message = "Matrícula gerada com sucesso" })); } else { return(BadRequest(new { message = "Realize um pagamento para gerar a matrícula." })); } }
private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e) { semester = this.SemesterComboBox.Text; CourseRegistrationRepository cr = new CourseRegistrationRepository(); this.CourseComboBox.DataSource = cr.GetOnlyCourses(semester, ID); }
private void comboBoxSelectCourse_SelectedIndexChanged(object sender, EventArgs e) { string fullName = comboBoxSelectCourse.Text; string nameCourse = fullName.Remove(fullName.Length - 2, 2); string nameSection = comboBoxSelectCourse.Text; nameSection = "" + nameSection[fullName.Length - 1]; //labelUserName.Text = nameCourse+" "+ nameSection; CourseRegistrationRepository crr = new CourseRegistrationRepository(); List <CourseRegistration> cList = new List <CourseRegistration>(); cList = crr.GetAllStudents(comboBoxSelectSemester.Text, nameCourse, nameSection); //List<CourseRegistration>mList=new List<CourseRegistration>(); //for (int i = 0; i < cList.Count; i++) //{ // mList.Add(cList[i]); //} DataTable table = new DataTable(); table.Columns.Add("Student Id", typeof(string)); table.Columns.Add("Student Name", typeof(string)); List <string> cTempList = new List <string>(cList.Count); for (int i = 0; i < cList.Count; i++) { cTempList.Add(cList[i].AccountId); } //Account ac = new Account(); for (int i = 0; i < cList.Count; i++) { cTempList.Remove(cList[i].AccountId); if (!cTempList.Contains(cList[i].AccountId)) { AccountRepository ar = new AccountRepository(); Account ac = ar.GetAccount(cList[i].AccountId); //ac = new ar.GetAccount(cList[i].AccountId); table.Rows.Add(cList[i].AccountId, ac.Name); } } //for (int i = 0; i < cList.Count; i++) //{ // mList.Remove(cList[i]); // if (!mList.Contains(cList[i])) // { // //AccountRepository ar = new AccountRepository(); // ////Account ac = new Account(); // //Account ac = new ar.GetAccount(cList[i].AccountId); // table.Rows.Add(cList[i].AccountId, cList[i].); // } //} dataGridView1.DataSource = table; dataGridView1.ReadOnly = true; dataGridView1.Visible = true; }
private List <Class> GetAllClasses() { // TODO: Have this method called once per request. It's called three times. CourseRegistrationRepository repo = new CourseRegistrationRepository(); List <Class> classes; repo.GetAllClasses(out classes); return(classes); }
private void DropClicked(object sender, EventArgs e) { CourseRegistrationRepository cor = new CourseRegistrationRepository(); if (cor.DropCourse(ID, semester, courseName)) { MessageBox.Show("Dropping for this subject is Applied", "Done"); } else { MessageBox.Show("Dropping this subject is not possible", "Error"); } }
public async Task <ActionResult <dynamic> > ListRegistration( [FromHeader] int idUser, int idCourse, [FromServices] CourseRegistrationRepository context ) { var registration = context.Get().CourseRegistration.Where(x => x.UserId == idUser && x.CourseId == idCourse); if (registration == null) { return(NotFound(new { message = "Você não se matriculou nesse curso." })); } return(Ok(registration)); }
private void viewbutton_Click(object sender, EventArgs e) { CourseRegistrationRepository cr = new CourseRegistrationRepository(); CourseRepository cRepo = new CourseRepository(); if (cr.CourseVerification2(this.courseidtextBox.Text) == this.courseidtextBox.Text) { this.semestertextBox.Text = cRepo.GetCourse2(this.courseidtextBox.Text).Semester; this.sectiontextBox.Text = cRepo.GetCourse2(this.courseidtextBox.Text).Section; this.coursetextBox.Text = cRepo.GetCourse2(this.courseidtextBox.Text).Name; } else { MessageBox.Show("No Course Found"); } }
private List <Class> GetClassesByStudentId() { // TODO: Have this method called once per request. It's called three times. if (Session["LoggedInUser"] == null) { return(null); } int studentId; studentId = ((Student)Session["LoggedInUser"]).StudentId; CourseRegistrationRepository repo = new CourseRegistrationRepository(); List <Class> classes; repo.GetClassesByStudentId(studentId, out classes); return(classes); }
private List <int> GetRegisteredClassIds() { List <int> ids = new List <int>(); int loggedInStudentId; if (Session["LoggedInUser"] == null) { return(ids); } Student student = ((Student)Session["LoggedInUser"]); loggedInStudentId = student.StudentId; CourseRegistrationRepository repo = new CourseRegistrationRepository(); repo.GetRegisteredClassIds(loggedInStudentId, out ids); return(ids); }
protected void Login_Button_Click(object sender, EventArgs e) { string login = LoginName_Textbox.Text; string password = Password_Textbox.Text; int id = 0; CourseRegistrationRepository repo = new CourseRegistrationRepository(); if (repo.GetStudentIdFromLoginPassword(login, password, out id)) { var student = new Student(); if (repo.GetStudentFromId(id, out student)) { Session["LoggedInUser"] = student; } } Response.Redirect("Login.aspx"); }
private void button5_Click(object sender, EventArgs e) { CourseRegistrationRepository r = new CourseRegistrationRepository(); AccountRepository ar = new AccountRepository(); StudentBalanceRepository sr = new StudentBalanceRepository(); if (r.RoutineVerification2(this.accountidtextBox.Text, this.semestertextBox.Text)) { List <Course> aList = r.GetAllCourse2(this.accountidtextBox.Text, this.semestertextBox.Text); string q = this.accountidtextBox.Text + this.semestertextBox.Text + "payment.pdf"; FileStream fs = new FileStream(q, FileMode.Create, FileAccess.Write, FileShare.None); Document doc = new Document(); PdfWriter writer = PdfWriter.GetInstance(doc, fs); doc.Open(); Paragraph p = new Paragraph(this.accountidtextBox.Text); p.Alignment = Element.ALIGN_CENTER; doc.Add(p); Paragraph s = new Paragraph(this.semestertextBox.Text); s.Alignment = Element.ALIGN_CENTER; doc.Add(s); Paragraph n = new Paragraph(ar.GetAccountTypeShovon2(this.accountidtextBox.Text).Name); n.Alignment = Element.ALIGN_RIGHT; doc.Add(n); foreach (Course c in aList) { Paragraph c1 = new Paragraph(c.Name + " " + c.Schedule); doc.Add(c1); } Paragraph p1 = new Paragraph("Pay:" + sr.GetBalance(this.accountidtextBox.Text).ToString() + "Taka"); doc.Add(p1); MessageBox.Show("Payment Created"); doc.Close(); } else { MessageBox.Show("Student Is Not Registered For This Semester"); } }
private void comboBoxSelectCourse_SelectedIndexChanged(object sender, EventArgs e) { comboBoxSelectStudent.Items.Clear(); comboBoxSelectStudent.Text = ""; buttonUploadQuizMark.Visible = false; buttonUploadTermMark.Visible = false; numericUpDownUploadQuizMark.Visible = false; numericUpDownUploadTermMark.Visible = false; buttonUploadQuiz.Visible = false; buttonUploadTerm.Visible = false; string fullName = comboBoxSelectCourse.Text; string nameCourse = fullName.Remove(fullName.Length - 2, 2); string nameSection = comboBoxSelectCourse.Text; nameSection = "" + nameSection[fullName.Length - 1]; //labelUserName.Text = nameCourse+" "+ nameSection; CourseRegistrationRepository crr = new CourseRegistrationRepository(); List <CourseRegistration> cList = new List <CourseRegistration>(); cList = crr.GetAllStudents(comboBoxSelectSemester.Text, nameCourse, nameSection); List <string> cTempList = new List <string>(cList.Count); for (int i = 0; i < cList.Count; i++) { cTempList.Add(cList[i].AccountId); } for (int i = 0; i < cList.Count; i++) { cTempList.Remove(cList[i].AccountId); if (!cTempList.Contains(cList[i].AccountId)) { AccountRepository ar = new AccountRepository(); Account ac = ar.GetAccount(cList[i].AccountId); comboBoxSelectStudent.Items.Add(ac.AccountId + " " + ac.Name); } } }
private void DoneRegistrationClicked(object sender, EventArgs e) { string fullName = CourseComboBox.Text; string nameCourse = fullName.Remove(fullName.Length - 2, 2); course = nameCourse; section = CourseComboBox.Text; section = "" + section[fullName.Length - 1]; List <Course> cList = new List <Course>(); CourseRepository cvr = new CourseRepository(); cList = cvr.GetCourseIdStudent(course, semester, section); string courseId = ""; int maxStudent = 0, currentStudent = 0; for (int i = 0; i < cList.Count(); i++) { courseId = cList[i].CourseId; maxStudent = cList[i].MaxStudent; currentStudent = cList[i].CurrentStudent; } CourseRegistrationRepository cdr = new CourseRegistrationRepository(); CourseResultsRepository xdr = new CourseResultsRepository(); bool yo = xdr.DoReg(ID, courseId, semester, section, course); if (cdr.DoRegistration(ID, courseId, semester, section, course)) { MessageBox.Show("Registration for this subject is Done", "Done"); } else { MessageBox.Show("Registration for this subject is not Possible", "Error"); } this.RegistrationLabel.Text += semester + ": " + course + " " + section + "\n"; }
//private void CourseInfo_Load(object sender, EventArgs e) //{ // // TODO: This line of code loads data into the 'courseRegistrationTableDataSet.CourseRegTable' table. You can move, or remove it, as needed. // this.courseRegTableTableAdapter.Fill(this.courseRegistrationTableDataSet.CourseRegTable); //} private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e) { string semester = SemesterComboBox.Text; CourseRegistrationRepository crr = new CourseRegistrationRepository(); List <CourseRegistration> cList = new List <CourseRegistration>(); cList = crr.GetAllCourseInfo(semester, ID); DataTable cTable = new DataTable(); cTable.Columns.Add("Course ID", typeof(string)); cTable.Columns.Add("Course Name", typeof(string)); cTable.Columns.Add("Section", typeof(string)); cTable.Columns.Add("Status", typeof(string)); for (int i = 0; i < cList.Count; i++) { cTable.Rows.Add(cList[i].CourseId, cList[i].CourseName, cList[i].Section, cList[i].Status); } CourseInfoGridView.DataSource = cTable; CourseInfoGridView.ReadOnly = true; }
private void refreshbutton_Click(object sender, EventArgs e) { CourseRegistrationRepository cr = new CourseRegistrationRepository(); this.dataGridView.DataSource = cr.GetAllCourses2(); }
private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e) { semester = SemesterComboBox.Text; CourseRegistrationRepository gr = new CourseRegistrationRepository(); List <CourseRegistration> gList = new List <CourseRegistration>(); gList = gr.GetAllCourseInfo(semester, ID); AllCourseFalse(); if (gList.Count == 6) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; this.Course2Btn.Visible = true; this.Course2Btn.Text = gList[1].CourseName + " " + gList[1].Section; this.Course3Btn.Visible = true; this.Course3Btn.Text = gList[2].CourseName + " " + gList[2].Section; this.Course4Btn.Visible = true; this.Course4Btn.Text = gList[3].CourseName + " " + gList[3].Section; this.Course5Btn.Visible = true; this.Course5Btn.Text = gList[4].CourseName + " " + gList[4].Section; this.Course6Btn.Visible = true; this.Course6Btn.Text = gList[5].CourseName + " " + gList[5].Section; } else if (gList.Count == 5) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; this.Course2Btn.Visible = true; this.Course2Btn.Text = gList[1].CourseName + " " + gList[1].Section; this.Course3Btn.Visible = true; this.Course3Btn.Text = gList[2].CourseName + " " + gList[2].Section; this.Course4Btn.Visible = true; this.Course4Btn.Text = gList[3].CourseName + " " + gList[3].Section; this.Course5Btn.Visible = true; this.Course5Btn.Text = gList[4].CourseName + " " + gList[4].Section; } else if (gList.Count == 4) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; this.Course2Btn.Visible = true; this.Course2Btn.Text = gList[1].CourseName + " " + gList[1].Section; this.Course3Btn.Visible = true; this.Course3Btn.Text = gList[2].CourseName + " " + gList[2].Section; this.Course4Btn.Visible = true; this.Course4Btn.Text = gList[3].CourseName + " " + gList[3].Section; } else if (gList.Count == 3) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; this.Course2Btn.Visible = true; this.Course2Btn.Text = gList[1].CourseName + " " + gList[1].Section; this.Course3Btn.Visible = true; this.Course3Btn.Text = gList[2].CourseName + " " + gList[2].Section; } else if (gList.Count == 2) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; this.Course2Btn.Visible = true; this.Course2Btn.Text = gList[1].CourseName + " " + gList[1].Section; } else if (gList.Count == 1) { this.Course1Btn.Visible = true; this.Course1Btn.Text = gList[0].CourseName + " " + gList[0].Section; } }