private void Details() { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.StudentExam t1 = new Entities.StudentExam() { pKId = Session["School"].ToString(), }; Entities.Class c1 = new Entities.Class() { className = "Class 5", }; Entities.ExamType e1 = new Entities.ExamType() { examType = "Mid term", }; DataSet ds = new DataSet(); ds = db.Graph(t1, c1, e1); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string sub; string per; sub = ds.Tables[0].Rows[i]["subjectName"].ToString(); per = ds.Tables[0].Rows[i]["Percentage"].ToString(); chartData = chartData + sub + "-" + per + "$"; } Response.Write(chartData); } }
protected void AssignStudent(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.personalInfo t1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.StudentSubject t2 = new Entities.StudentSubject() { pKId = SchoolID.Value, year = Year.Text, }; Entities.Class c1 = new Entities.Class() { className = DropDownList1.SelectedValue, }; Entities.Section s1 = new Entities.Section() { sectionName = DropDownList2.SelectedValue, }; db.AssignStudentClass(t1, t2, c1, s1); SqlDataSource6.DataBind(); GridView1.DataBind(); } }
protected void AssignTeacher(object sender, EventArgs e) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.Section s3 = new Entities.Section() { sectionName = SectionDropDown.SelectedValue, }; Entities.personalInfo p1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.personalInfo p2 = new Entities.personalInfo() { pKId = TeacherDropDown.SelectedValue, }; Entities.Class c1 = new Entities.Class() { className = ClassDropDown.SelectedValue, }; Entities.Subjects s2 = new Entities.Subjects() { subjectName = SubjectDropDown.SelectedValue, }; db.AssignCourses(s3, p1, p2, c1, s2); GridView2.DataBind(); UpdatePanel1.Update(); Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignCourses')", true); }
public IActionResult Create(ClassViewModel model) { var response = ResponseModelFactory.CreateInstance; if (model.SchoolUuid == null && AuthContextService.CurrentUser.SchoolGuid == null) { response.SetFailed("请登录学校账号"); return(Ok(response)); } using (_dbContext) { if (_dbContext.Class.Any(x => x.IsDelete == 0 && x.ClassName == model.ClassName && x.SchoolUuid == AuthContextService.CurrentUser.SchoolGuid)) { response.SetFailed("已存在该班级名称"); return(Ok(response)); } var entity = new Entities.Class(); entity.ClassUuid = Guid.NewGuid(); //entity.SchoolUuid = model.SchoolUuid; entity.IsDelete = 0; entity.ClassName = model.ClassName; entity.SchoolUuid = AuthContextService.CurrentUser.SchoolGuid; _dbContext.Class.Add(entity); _dbContext.SaveChanges(); response.SetSuccess(); return(Ok(response)); } }
public ActionResult Edit(ClassVM viewModel) { try { // TODO: Add update logic here if (ModelState.IsValid) { Entities.Class entity = new Entities.Class(); entity.ClassId = viewModel.ClassId; entity.ClassName = viewModel.ClassName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; ClassBAL balObject = new ClassBAL(); balObject.Edit(entity); return(RedirectToAction("Index")); } else { return(View(viewModel)); } } catch { return(View(viewModel)); } }
public ActionResult Create(ClassVM viewModel) { try { // TODO: Add insert logic here if (ModelState.IsValid) { Entities.Class entity = new Entities.Class(); entity.ClassId = viewModel.ClassId; entity.ClassName = viewModel.ClassName; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; ClassBAL balObject = new ClassBAL(); balObject.Add(entity); return(RedirectToAction("Index")); } else { // AcademicYearBAL academicYearBAL = new AcademicYearBAL(); // viewModel.AcademicYears = from obj in academicYearBAL.GetAll() where obj.Status == true select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; return(View(viewModel)); } } catch { //AcademicYearBAL academicYearBAL = new AcademicYearBAL(); // viewModel.AcademicYears = from obj in academicYearBAL.GetAll() where obj.Status == true select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() }; return(View(viewModel)); } }
public void InsertClass(Entities.Class c1) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertClass]")) { s1.AddParameter("@classId", System.Data.SqlDbType.NVarChar, c1.classId); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className); s1.Execute(); } }
public DataSet Graph(Entities.StudentExam c1, Entities.Class c2, Entities.ExamType e1) { DataSet ds; using (WSqlCommand dbCom = new WSqlCommand(dbconstring, "[dbo].[spSelectStudentMarks]")) { dbCom.AddParameter("@studentId", SqlDbType.NVarChar, c1.pKId); dbCom.AddParameter("@className", SqlDbType.NVarChar, c2.className); dbCom.AddParameter("@examType", SqlDbType.NVarChar, e1.examType); ds = new DataSet(); ds = dbCom.Execute(); } return(ds); }
public bool Ekle(Entities.Class model) { var result = false; try { this.dbContext.Classes.Add(model); this.dbContext.SaveChanges(); result = true; } catch (Exception ex) { } return(result); }
public DataSet ShowSubNotes(Entities.Notes q1, Entities.personalInfo p1, Entities.Class c1) { DataSet ds; using (WSqlCommand dbCom = new WSqlCommand(dbconstring, "[dbo].[spShowSubNotes]")) { dbCom.AddParameter("@iam", System.Data.SqlDbType.NVarChar, p1.pKId); dbCom.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className); dbCom.AddParameter("@noteType", System.Data.SqlDbType.NVarChar, q1.noteType); dbCom.AddParameter("@minDate", System.Data.SqlDbType.Date, q1.date); dbCom.AddParameter("@maxDate", System.Data.SqlDbType.Date, q1.date); ds = new DataSet(); ds = dbCom.Execute(); } return(ds); }
// // GET: /SysAdmin/Class/Details/5 public ActionResult Details(int id) { ClassVM viewModel = new ClassVM(); ClassBAL balObject = new ClassBAL(); IQueryable <Entities.Class> entites = balObject.FindBy(a => a.ClassId == id); if (entites != null && entites.Count() > 0) { Entities.Class entity = entites.FirstOrDefault(); viewModel.ClassId = entity.ClassId; viewModel.ClassName = entity.ClassName; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
/// <summary> /// Returns an existing, or a brand new method based on the details & parent class provided. /// </summary> /// <param name="details"></param> /// <param name="targetClass"></param> /// <returns></returns> private Entities.Method GetExistingOrNewMethod(LogDetails details, Entities.Class targetClass) { var existingMethod = _methodData.GetByNameAndClassId(targetClass.Id, details.Method); if (existingMethod == null) { existingMethod = new Entities.Method { ClassId = targetClass.Id, Name = details.Method }; existingMethod = _methodData.Save(existingMethod); } return(existingMethod); }
public async Task <ActionResult <Models.AddClassResponse> > AddClass([FromBody] Models.Class _class) { Models.AddClassResponse response; if (User.Identity.IsAuthenticated) { var policyCheck = await authService.AuthorizeAsync(User, "CoachPolicy"); if (!policyCheck.Succeeded) { return(Unauthorized(response = new Models.AddClassResponse() { Success = false, Error = Models.ApiError.UnAuthResponse() })); } } Entities.Class classEnt = new Entities.Class() { ClassGrade = _class.ClassGrade, coachID = _class.coach.ID, Pool = _class.Pool, TimeOfClass = _class.TimeOfClass }; int[] StudentIDs = _class.Students.Select(c => c.ID).ToArray(); List <bool> tempAttendance = new List <bool>(); foreach (int i in StudentIDs) { tempAttendance.Add(_class.Attendance[i]); } bool[] Attendance = tempAttendance.ToArray(); classEnt.StudentAttendance = Attendance; classEnt.StudentIDs = StudentIDs; await resourceDbContext.AddAsync(classEnt); await resourceDbContext.SaveChangesAsync(); _class.ID = classEnt.ID; _class.ClassGrade = classEnt.ClassGrade; response = new Models.AddClassResponse() { Success = true, Class = new Models.standard.Item <Models.Class>() { itemValue = _class } }; return(Ok(response)); }
/// <summary> /// Returns an existing, or a brand new class based on the details provided. /// </summary> /// <param name="details"></param> /// <returns></returns> private Entities.Class GetExistingOrNewClass(LogDetails details) { var existingClass = _classData.GetClassByNameAndNamespace(details.Class, details.Namespace); if (existingClass == null) { existingClass = new Entities.Class() { Name = details.Class, Namespace = details.Namespace }; existingClass = _classData.Save(existingClass); } return(existingClass); }
protected void AddExamDate(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('ExamDate')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.ExamDate cc1 = new Entities.ExamDate() { examDate = EDate.Text, totalMarks = Convert.ToInt32(TotalMarks.Value), }; Entities.Section s1 = new Entities.Section() { sectionName = DropDownList2.SelectedValue, }; Entities.Class c1 = new Entities.Class() { className = DropDownList1.SelectedValue, }; Entities.Subjects s2 = new Entities.Subjects() { subjectName = DropDownList3.SelectedValue, }; Entities.personalInfo p1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.ExamType e1 = new Entities.ExamType() { examTypeId = DropDownList4.SelectedValue, }; db.AddExamDate(cc1, s2, s1, c1, p1, e1); GridView1.DataBind(); UpdatePanel1.Update(); } }
protected void AddExamDate(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('ExamDate')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.ExamDate cc1 = new Entities.ExamDate() { examDate = EDate.Text, totalMarks = Convert.ToInt32(TotalMarks.Value), }; Entities.Section s1 = new Entities.Section() { sectionName = DropDownList2.SelectedValue, }; Entities.Class c1 = new Entities.Class() { className = DropDownList1.SelectedValue, }; Entities.Subjects s2 = new Entities.Subjects() { subjectName = DropDownList3.SelectedValue, }; Entities.personalInfo p1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.ExamType e1 = new Entities.ExamType() { examTypeId = DropDownList4.SelectedValue, }; db.AddExamDate(cc1, s2, s1, c1, p1, e1); GridView1.DataBind(); UpdatePanel1.Update(); } }
protected void AddClass(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AddClasses')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.Class t1 = new Entities.Class() { classId = ClassId.Value, className = ClassName.Value, }; db.InsertClass(t1); SClasses.DataBind(); GClasses.DataBind(); UpdatePanel2.Update(); AddClassSection1.UpdateClass(); TecherSection1.UpdateClass(); StudentSection1.UpdateClass(); ExamDate1.UpdateClass(); ClassLabel.Text = "Class Added Successfully"; } }
protected void AssignTeacher(object sender, EventArgs e) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.Section s3 = new Entities.Section() { sectionName = SectionDropDown.SelectedValue, }; Entities.personalInfo p1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.personalInfo p2 = new Entities.personalInfo() { pKId = TeacherDropDown.SelectedValue, }; Entities.Class c1 = new Entities.Class() { className = ClassDropDown.SelectedValue, }; Entities.Subjects s2 = new Entities.Subjects() { subjectName = SubjectDropDown.SelectedValue, }; db.AssignCourses(s3,p1,p2,c1,s2); GridView2.DataBind(); UpdatePanel1.Update(); Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignCourses')", true); }
public void AssignCourses(Entities.Section s3, Entities.personalInfo p1, Entities.personalInfo p2, Entities.Class c1, Entities.Subjects s2) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAssignTeacher]")) { s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className); s1.AddParameter("@iAm ", System.Data.SqlDbType.NVarChar, p1.pKId); s1.AddParameter("@pKId", System.Data.SqlDbType.NVarChar, p2.pKId); s1.Execute(); } }
public void AddNotes(Entities.Notes c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAddNotes]")) { s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className); s1.AddParameter("@teacher", System.Data.SqlDbType.NVarChar, c1.teacher); s1.AddParameter("@noteType", System.Data.SqlDbType.NVarChar, c1.noteType); s1.AddParameter("@assignDate", System.Data.SqlDbType.Date, c1.date); s1.AddParameter("@fileName", System.Data.SqlDbType.NVarChar, c1.fileName); s1.AddParameter("@dataFile", System.Data.SqlDbType.VarBinary, c1.dataFile); s1.AddParameter("@description", System.Data.SqlDbType.NVarChar, c1.description); s1.Execute(); } }
public void CoursePlan(Entities.CoursePlan c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2, Entities.personalInfo p1) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertCourseProgress]")) { s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className); s1.AddParameter("@pKId", System.Data.SqlDbType.NVarChar, p1.pKId); s1.AddParameter("@progressId", System.Data.SqlDbType.Int, c1.progressId); s1.AddParameter("@year", System.Data.SqlDbType.NVarChar, c1.year); s1.AddParameter("@goal", System.Data.SqlDbType.NVarChar, c1.Goal); s1.Execute(); } }
public void AddExamDate(Entities.ExamDate c1, Entities.Subjects s2, Entities.Section s3, Entities.Class c2, Entities.personalInfo p1, Entities.ExamType e1) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spInsertExamDate]")) { s1.AddParameter("@subjectName", System.Data.SqlDbType.NVarChar, s2.subjectName); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, s3.sectionName); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c2.className); s1.AddParameter("@examTypeId", System.Data.SqlDbType.NVarChar, e1.examTypeId); s1.AddParameter("@iAm", System.Data.SqlDbType.NVarChar, p1.pKId); s1.AddParameter("@examDate", System.Data.SqlDbType.Date, c1.examDate); s1.AddParameter("@totalMarks", System.Data.SqlDbType.Int, c1.totalMarks); s1.Execute(); } }
public void AssignStudentClass(Entities.personalInfo p1, Entities.StudentSubject p2, Entities.Class c1, Entities.Section ss1) { using (WSqlCommand s1 = new WSqlCommand(dbconstring, "[dbo].[spAssignClassSection]")) { s1.AddParameter("@iAm", System.Data.SqlDbType.NVarChar, p1.pKId); s1.AddParameter("@studentId", System.Data.SqlDbType.NVarChar, p2.pKId); s1.AddParameter("@className", System.Data.SqlDbType.NVarChar, c1.className); s1.AddParameter("@sectionName", System.Data.SqlDbType.NVarChar, ss1.sectionName); s1.AddParameter("@year", System.Data.SqlDbType.NVarChar, p2.year); s1.Execute(); } }
protected void AssignStudent(object sender, EventArgs e) { Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true); if (Page.IsValid) { DBHandler.DBHandler db = new DBHandler.DBHandler(con); Entities.personalInfo t1 = new Entities.personalInfo() { pKId = Session["School"].ToString(), }; Entities.StudentSubject t2 = new Entities.StudentSubject() { pKId = SchoolID.Value, year=Year.Text, }; Entities.Class c1 = new Entities.Class() { className = DropDownList1.SelectedValue, }; Entities.Section s1 = new Entities.Section() { sectionName = DropDownList2.SelectedValue, }; db.AssignStudentClass(t1, t2, c1, s1); SqlDataSource6.DataBind(); GridView1.DataBind(); } }