public int InsertStudentSection(StudentSection theSection) { int ReturnValueSection = 0; using (SqlCommand InsertCommand = new SqlCommand()) { InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValueSection)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@CourseID", SqlDbType.Int, theSection.CourseID)); InsertCommand.Parameters.Add(GetParameter("@StreamID", SqlDbType.Int, theSection.StreamID)); InsertCommand.Parameters.Add(GetParameter("@ClassID", SqlDbType.Int, theSection.ClassID)); InsertCommand.Parameters.Add(GetParameter("@StudentIDS", SqlDbType.VarChar, theSection.StudentIDS)); InsertCommand.Parameters.Add(GetParameter("@SubjectID", SqlDbType.Int, theSection.SubjectID)); InsertCommand.Parameters.Add(GetParameter("@SectionID", SqlDbType.Int, theSection.SectionID)); InsertCommand.Parameters.Add(GetParameter("@SectionName", SqlDbType.VarChar, theSection.SectionName)); InsertCommand.Parameters.Add(GetParameter("@Comment", SqlDbType.VarChar, theSection.Comment)); InsertCommand.Parameters.Add(GetParameter("@SessionID", SqlDbType.Int, theSection.SessionID)); InsertCommand.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, 44)); InsertCommand.Parameters.Add(GetParameter("@CompanyID", SqlDbType.Int, 8)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, 1)); InsertCommand.CommandText = "pICAS_Student_SectionGrouping_InsertNew"; ExecuteStoredProcedure(InsertCommand); ReturnValueSection = int.Parse(InsertCommand.Parameters[0].Value.ToString()); } return(ReturnValueSection); }
public static List <StudentSection> GetStudentListBySectionID(int SectionID) { try { DataTable StudentAllTable = StudentSectionDataAccess.GetInstance.GetStudentListBySectionID(SectionID); List <StudentSection> StudentList = new List <StudentSection>(); foreach (DataRow dr in StudentAllTable.Rows) { StudentSection ObjStudents = new StudentSection(); //ObjStudents.CourseID = int.Parse(dr["CourseID"].ToString()); //ObjStudents.StreamID = int.Parse(dr["StreamID"].ToString()); //ObjStudents.ClassID = int.Parse(dr["ClassID"].ToString()); ObjStudents.StudentID = int.Parse(dr["StudentID"].ToString()); ObjStudents.StudentCode = dr["StudentCode"].ToString(); ObjStudents.StudentName = dr["StudentName"].ToString(); ObjStudents.ROLLNo = dr["ROLLNo"].ToString(); ObjStudents.QualID = int.Parse(dr["QualID"].ToString()); StudentList.Add(ObjStudents); } return(StudentList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
public ActionResult ConfirmDrop(int id) { List <StudentSection> sst = SSservice.GetByStu(id).ToList(); List <Section> sec = Sservice.GetAll().ToList(); StudentSection nsst = new StudentSection(); Section s = new Section(); foreach (var t in sec) { foreach (var it in sst) { if (it.SecId == t.SecId && t.FacultyId == Convert.ToInt32(Session["id"])) { nsst = it; s = t; } } } SSservice.Delete(nsst.StuSec); List <Attendence> ast = Atservice.GetAll().ToList(); foreach (var t in ast) { if (t.StudentId == id && s.SecId == t.SecId) { Atservice.Delete(t.AttId); } } Report rp = new Report(); rp.StuId = nsst.StuId; rp.Comment = "Course Dropped!! Sec Id= " + s.SecId + " Sec Name=" + s.SecName; rpservice.Insert(rp); return(RedirectToAction("Index")); }
public static List <StudentSection> GetSectionList(string searchText) { try { DataTable SectionAllTable = StudentSectionDataAccess.GetInstance.GetSectionList(searchText); List <StudentSection> SectionList = new List <StudentSection>(); foreach (DataRow dr in SectionAllTable.Rows) { StudentSection ObjAllSection = new StudentSection(); ObjAllSection.SectionGroupID = int.Parse(dr["SectionGroupID"].ToString()); ObjAllSection.CourseID = int.Parse(dr["CourseID"].ToString()); ObjAllSection.StreamID = int.Parse(dr["StreamID"].ToString()); ObjAllSection.ClassID = int.Parse(dr["ClassID"].ToString()); ObjAllSection.SubjectID = int.Parse(dr["SubjectID"].ToString()); ObjAllSection.SubjectName = dr["SubjectName"].ToString(); ObjAllSection.StudentIDS = (dr["StudentIDS"].ToString()); ObjAllSection.SectionID = int.Parse(dr["SectionID"].ToString()); ObjAllSection.SectionName = dr["SectionName"].ToString(); ObjAllSection.Comment = dr["Comment"].ToString(); SectionList.Add(ObjAllSection); } return(SectionList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }
private int InsertStudentSections() { int Returnvalue = 0; string X = ""; foreach (GridViewRow row in gridview_StudentSectionList.Rows) { CheckBox chk = (CheckBox)row.FindControl("chk_Section"); Label lbl_StudentID = (Label)row.FindControl("lbl_StudentID"); if (chk.Checked == true) { X = X + lbl_StudentID.Text + ','; } } X = X.Remove(X.Length - 1); StudentSection TheSection = new StudentSection(); TheSection.CourseID = int.Parse(DropDownList_Course.SelectedValue); TheSection.StreamID = int.Parse(DropDownList_Stream.SelectedValue); TheSection.ClassID = int.Parse(DropDownList_Class.SelectedValue); TheSection.StudentIDS = X; TheSection.SubjectID = int.Parse(DropDown_subjectClas.SelectedValue); TheSection.SectionID = int.Parse(DropDown_Section.SelectedValue); TheSection.SectionName = DropDown_Section.SelectedItem.Text; TheSection.Comment = txt_Comment.Text; Returnvalue = StudentSectionManagement.GetInstance.InsertStudentSection(TheSection); return(Returnvalue); }
public int Delete(int id) { StudentSection stusec = this.context.StudentSection.SingleOrDefault(x => x.StuSec == id); this.context.StudentSection.Remove(stusec); return(this.context.SaveChanges()); }
public ActionResult AddStudentToSection(StudentSection sec) { if (ModelState.IsValid) { STCservice.Insert(sec); Student ats = Stservice.Get(sec.StuId); Section sc = Sservice.Get(sec.SecId); Attendence ast = new Attendence(); ast.StudentId = ats.StuId; ast.SecId = sc.SecId; ast.Attend = 0; ast.AttendCounter = 0; int val = Convert.ToInt32(sc.CourseId); ast.CourseId = val; ast.Date = DateTime.Now; Atservice.Insert(ast); Grade gr = new Grade(); gr.SecId = sc.SecId; gr.StuId = ats.StuId; gr.grade = 0; grservice.Insert(gr); return(RedirectToAction("Index")); } else { return(View(sec)); } }
public async Task Register(UserDto userDto) { if (string.IsNullOrWhiteSpace(userDto.Password)) { throw new AppException("Password is required"); } if (await _context.Users.AnyAsync(x => x.Mail == userDto.Mail)) { throw new AppException("Email \"" + userDto.Mail + "\" is already taken"); } var teacher = _context.Users.FirstOrDefault(x => x.Mail == userDto.MailITSCTeacher); if (teacher == null) { throw new AppException("El email \"" + userDto.MailITSCTeacher + "\" de el profesor no es valido"); } var section = _context.Sections.FirstOrDefault(c => c.TeacherId == teacher.TeacherId && c.SectionNumber == userDto.MatterCode); if (section == null) { throw new AppException("El codigo \"" + userDto.MatterCode + "\" de secion no es valido"); } byte[] passwordHash, passwordSalt; CreatePasswordHash(userDto.Password, out passwordHash, out passwordSalt); var users = new User { Mail = userDto.Mail, Name = userDto.Name, PasswordHash = passwordHash, PasswordSalt = passwordSalt, Role = Role.Student, }; var student = new Student { Enrollment = userDto.Enrollment, BelongGroup = userDto.SubjectCode, Career = userDto.Career, User = users, State = "evaluate" }; await _context.AddAsync(student); await _context.SaveChangesAsync(); var studentGetId = _context.Users.FirstOrDefault(x => x.Mail == userDto.Mail).StudentId; var studentSection = new StudentSection { SectionId = section.Id, StudentId = (int)studentGetId }; _context.Add(studentSection); _context.SaveChanges(); }
public int Update(StudentSection stu) { StudentSection ff = this.context.StudentSection.SingleOrDefault(x => x.StuSec == stu.StuSec); ff.StuId = stu.StuId; ff.SecId = stu.SecId; ff.section = stu.section; ff.student = stu.student; return(this.context.SaveChanges()); }
public ActionResult Create(StudentSection studentsection) { if (ModelState.IsValid) { db.StudentSection.Add(studentsection); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Section = new SelectList(db.Section, "Section1", "Section1", studentsection.Section); ViewBag.Student = new SelectList(db.Student, "Identification", "Name", studentsection.Student); return View(studentsection); }
private void PopulateFormField(StudentSection TheSection, int SectionID) { if (TheSection != null) { btn_Submit.Visible = true; btn_Submit1.Visible = true; btn_Submit.Text = MicroEnums.DataOperation.Update.GetStringValue(); btn_Submit1.Text = MicroEnums.DataOperation.Update.GetStringValue(); //txt_Faculty.Text = TheAttn.StaffID.ToString(); DropDownList_Course.SelectedValue = TheSection.CourseID.ToString(); DropDownList_Stream.SelectedValue = TheSection.StreamID.ToString(); BindClassListByStreamAndQual(); DropDownList_Class.SelectedValue = TheSection.ClassID.ToString(); BindSubjectListByCourseStreamClass(); DropDown_subjectClas.SelectedValue = TheSection.SubjectID.ToString(); DropDown_Section.SelectedValue = TheSection.SectionID.ToString(); txt_Comment.Text = TheSection.Comment; } BindAttendanceList(); btn_Go.Enabled = false; if (TheSection != null) { foreach (GridViewRow row in gridview_StudentSectionList.Rows) { CheckBox chk = (CheckBox)row.FindControl("chk_Section"); Label lbl_StudentID = (Label)row.FindControl("lbl_StudentID"); List <StudentSection> TheSectionList = new List <StudentSection>(); TheSectionList = (from xyz in StudentSectionManagement.GetInstance.GetSectionList("") where (TheSection.SectionID.Equals(SectionID) && TheSection.StudentIDS.Contains(lbl_StudentID.Text)) select xyz).ToList(); if (TheSectionList.Count == 0) { chk.Checked = false; } else { chk.Checked = true; } } } else { btn_Submit.Text = MicroEnums.DataOperation.Save.GetStringValue(); btn_Submit1.Text = MicroEnums.DataOperation.Save.GetStringValue(); } }
void CheckSection(string searchText) { StudentSection TheSection = null; try { TheSection = (from xyz in StudentSectionManagement.GetInstance.GetSectionList(searchText) where xyz.SectionID == int.Parse(DropDown_Section.SelectedValue) select xyz).Single(); } catch (Exception ex) { if (ex.Message == "Sequence contains no elements") { } } PopulateFormField(TheSection, int.Parse(DropDown_Section.SelectedValue)); }
public ActionResult DropCourse(int id) { List <StudentSection> sst = SSservice.GetByStu(id).ToList(); List <Section> sec = Sservice.GetAll().ToList(); StudentSection nsst = new StudentSection(); foreach (var t in sec) { foreach (var it in sst) { if (it.SecId == t.SecId && t.FacultyId == Convert.ToInt32(Session["id"])) { nsst = it; } } } return(View(nsst)); }
public ActionResult Grades(int id) { List <Section> sc = service2.GetAll().ToList(); List <Section> news = new List <Section>(); foreach (var v in sc) { if (v.CourseId == id) { news.Add(v); } } List <StudentSection> sts = service4.GetAll().ToList(); StudentSection nsts = new StudentSection(); foreach (var v in sts) { foreach (var vs in news) { if (v.SecId == vs.SecId && v.StuId == Convert.ToInt32(Session["id"])) { nsts = v; } } } List <Grade> grd = grservice.GetAll().ToList(); Grade grds = new Grade(); foreach (var g in grd) { if (g.SecId == nsts.SecId) { grds = g; } } return(View(grds)); }
public int InsertStudentSection(StudentSection theSection) { return(StudentSectionIntegration.InsertStudentSection(theSection)); }
public int UpdateStudentSection(StudentSection theSection) { return(StudentSectionIntegration.UpdateStudentSection(theSection)); }
public int Update(StudentSection stu) { return(this.data.Update(stu)); }
public int Insert(StudentSection stu) { return(this.data.Insert(stu)); }
public static int InsertStudentSection(StudentSection theSection) { return(StudentSectionDataAccess.GetInstance.InsertStudentSection(theSection)); }
public static int UpdateStudentSection(StudentSection theSection) { return(StudentSectionDataAccess.GetInstance.UpdateStudentSection(theSection)); }
public int Insert(StudentSection stu) { this.context.StudentSection.Add(stu); return(this.context.SaveChanges()); }