public async Task <IActionResult> Edit(int id, [Bind("Id,Address,PhoneNo,RegisterNo,StudentId")] StudentDetails studentDetails) { if (id != studentDetails.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studentDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentDetailsExists(studentDetails.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "Id", "Id", studentDetails.StudentId); return(View(studentDetails)); }
public ActionResultTO SaveStudent(string studentName, string studentSurname, string studentSex, int studentAge) { ActionResultTO result = new ActionResultTO(); result = StudentDetails.SaveStudent(studentName, studentSurname, studentSex, studentAge); return(result); }
internal StudentDetails GetStudentByID(int id) { DataTable td = new DataTable(); StudentDetails obj = new StudentDetails(); try { string sqlquery = "SELECT * FROM Student where Id = @id"; SqlCommand cmd = new SqlCommand(sqlquery, Conn); cmd.Parameters.Add(new SqlParameter("id", id)); SqlDataAdapter adp = new SqlDataAdapter(cmd); Conn.Open(); adp.Fill(td); obj.ID = Convert.ToInt32(td.Rows[0]["Id"]); obj.Name = Convert.ToString(td.Rows[0]["Name"]); obj.Department = Convert.ToString(td.Rows[0]["Department"]); } catch (Exception) { } finally { Conn.Close(); } return(obj); }
public List <StudentDetails> GetAllStudents() { DataTable td = new DataTable(); List <StudentDetails> list = new List <StudentDetails>(); try { string sqlquery = "SELECT * FROM Student ORDER BY Id DESC"; SqlCommand cmd = new SqlCommand(sqlquery, Conn); SqlDataAdapter adp = new SqlDataAdapter(cmd); Conn.Open(); adp.Fill(td); foreach (DataRow row in td.Rows) { StudentDetails obj = new StudentDetails(); obj.ID = Convert.ToInt32(row["Id"]); obj.Name = Convert.ToString(row["Name"]); obj.Department = Convert.ToString(row["Department"]); list.Add(obj); } } catch (Exception) { } finally { Conn.Close(); } return(list); }
private void btnSave_Click(object sender, EventArgs e) { StudentDetails sd = new StudentDetails(); sd.FullName = txtFullname.Text; sd.Email = txtEmail.Text; sd.PhoneNo = txtPhoneNo.Text; sd.Gender = rbdMale.Checked ? "Male" : "Female"; sd.RollNo = txtRollNo.Text; //image convertion from jpg to byte ms = new MemoryStream(); pictureBox1.Image.Save(ms, ImageFormat.Jpeg); byte[] photo_aray = new byte[ms.Length]; ms.Position = 0; ms.Read(photo_aray, 0, photo_aray.Length); sd.Photo = photo_aray.ToString(); int i = bls.addStudent(sd); if (i > 0) { MessageBox.Show("Student Added"); } else { MessageBox.Show("Operation Failed"); } loadGrid(); }
private void StudentBtn_Click(object sender, EventArgs e) { StudentDetails sd = new StudentDetails(); sd.Show(); Hide(); }
public StudentProfileViewModel(StudentDetails details) { api = new K12RestApi(); // what's this, precious? this.Details = details; Init(); }
public async Task <ActionResult <StudentViewModel> > PostStudentDetails(StudentViewModel StudentData) { StudentDetails stu = new StudentDetails(); stu.FirstName = StudentData.firstName; stu.LastName = StudentData.lastName; stu.ClassId = StudentData.classId; _context.StudentDetails.Add(stu); await _context.SaveChangesAsync(); StudentDetails student = _context.StudentDetails.SingleOrDefault(x => x.FirstName == StudentData.firstName);//Need to make FirstName as unique key. yet to code for making it unique. foreach (var stuData in StudentData.subjectMarksDetail) { StuSubjectMarks subMarks = new StuSubjectMarks(); subMarks.SubjectId = stuData.subId; subMarks.StudentId = student.StudentId; subMarks.Marks = stuData.marks; _context.StuSubjectMarks.Add(subMarks); } await _context.SaveChangesAsync(); return(CreatedAtAction("GetStudentDetail", new { id = StudentData.stuId }, StudentData)); }
public ActionResult Edit(/*StudentsDetailsViewModel studentDetailsModel*/) { StudentsDetailsViewModel studentDetailsModel = new StudentsDetailsViewModel(); UpdateModel <IStudentDetails>(studentDetailsModel); if (ModelState.IsValid) { StudentDetails studentDetails = new StudentDetails(); studentDetails.Id = studentDetailsModel.Id; studentDetails.FirstName = studentDetailsModel.FirstName; studentDetails.LastName = studentDetailsModel.LastName; foreach (string strStudentEmail in studentDetailsModel.studentEmails) { studentDetails.studentEmails.Add(strStudentEmail); } StudentBusinessLayer studentBusinessLayer = new StudentBusinessLayer(); studentBusinessLayer.UpdateStudent(studentDetails); return(RedirectToAction("Index")); } return(View()); }
public void GetStudentById_WhenOneExist_Test() { StudentsController studentsController = new StudentsController(this.allRepositories); SetupController(studentsController); School school = new School() { Name = "Telerik" }; DbSet <School> schools = this.dbContext.Set <School>(); schools.Add(school); this.dbContext.SaveChanges(); Student initialStudent = new Student() { FirstName = "Pesho", LastName = "Ivanov", Age = 15, Grade = 9, School = school }; DbSet <Student> students = this.dbContext.Set <Student>(); students.Add(initialStudent); this.dbContext.SaveChanges(); StudentDetails resultStudent = studentsController.GetStudents(initialStudent.Id); Assert.IsNotNull(resultStudent); Assert.AreEqual(initialStudent.Id, resultStudent.Id); }
public ActionResult GetOneStudent(int id) { var db = new DatabaseContext(); var student = db.Students.Include(i => i.ProgressReports).FirstOrDefault(st => st.Id == id); if (student == null) { return(NotFound()); } else { // create our json object var rv = new StudentDetails { Id = student.Id, FullName = student.FullName, GPA = student.GPA, IsJoyful = student.IsJoyful, ProgressReports = student.ProgressReports.Select(pr => new CreatedProgressReport { AttendanceIssues = pr.AttendanceIssues, DoingWell = pr.DoingWell, Improvement = pr.Improvement, StudentId = pr.StudentId, Id = pr.Id }).ToList() }; return(Ok(rv)); } }
public StudentDetails Get(int id) { var studentEntity = this.data.Get(id); var studentModel = new StudentDetails(studentEntity); return(studentModel); }
public void RegisterMapperTest1() { TransformerObserver observer = new TransformerObserver(); IList <IPropertyMapper <Student, Person> > propMappers = new List <IPropertyMapper <Student, Person> > { new PropertyMapper <Student, Person>((student, person) => person.Name = student.Name, "Name", "Name") , new PropertyMapper <Student, Person>((student, person) => person.AnnoNascita = student.AnnoNascita) , new PropertyMapper <Student, Person>((student, person) => person.Parent = student.Father) }; SourceMapper <Student, Person> mapper1 = new SourceMapper <Student, Person>(propMappers, null, null); observer.RegisterMapper(mapper1); Student st = new Student { Name = "mario", Surname = "monti", AnnoNascita = 19 }; StudentDetails st2 = new StudentDetails { Name = "mario", Surname = "monti", AnnoNascita = 19, CF = "CF" }; var res = observer.TryToMap <Student, Person>(st); var res2 = observer.TryToMap <Student, Person>(st2); Assert.IsNotNull(res); Assert.IsNotNull(res2); }
//get personal details button private void getDetailsButton_Click(object sender, EventArgs e) { try { IStudentData _studentData = new StudentPersonalDetails(); _studentID = 700; StudentDetails _studentPersonalDetails = _studentData.GetStudentDetailsBy(_studentID); firstnameTextbox.Text = string.IsNullOrEmpty(_studentPersonalDetails.FirstName) == true ? "Empty" : _studentPersonalDetails.FirstName; lastnameTextBox.Text = _studentPersonalDetails.LastName; dob = _studentPersonalDetails.DateOfBirth; displayDOBlabel.Text = "D.O.B. " + dob; //genderCombobox.SelectedItem = _studentPersonalDetails.Gender; //genderCombobox.SelectedText = _studentPersonalDetails.Gender; genderCombobox.SelectedText = "Female";// _studentPersonalDetails.Gender.ToString(); // genderCombobox.SelectedIndex = 0; emailidTextbox.Text = _studentPersonalDetails.Email; phonenumberTextbox.Text = _studentPersonalDetails.PhoneNo; addressLine1TextBox.Text = _studentPersonalDetails.AddressL1; if (!string.IsNullOrEmpty(addressLine2TextBox.Text)) { addressLine2TextBox.Text = _studentPersonalDetails.AddressL2; } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public async Task <IActionResult> PutStudentDetails(int id, StudentDetails studentDetails) { if (id != studentDetails.ID) { return(BadRequest()); } _context.Entry(studentDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static void SearchStudent() { StudentDetails studentDetails = new StudentDetails(); Console.Write("Search a Student by its Student id :"); int findByID = int.Parse(Console.ReadLine()); Console.WriteLine(studentDetails.studentID); if (stdetaillist.Exists(x => x.studentID == findByID)) { foreach (StudentDetails searchedBook in stdetaillist) { if (searchedBook.studentID == findByID) { Console.WriteLine( "Student ID :{0}\n" + "Student Name :{1}\n" + "Student Grade :{2}\n" + "Student Address :{3}", searchedBook.studentID, searchedBook.studentName, searchedBook.studentGrade, searchedBook.schoolAddress); } } } else { Console.WriteLine("Student id {0} is not found from Website", findByID); } }
public async Task <IActionResult> PutStudentDetails(Guid id, StudentDetails studentDetails) { if (id != studentDetails.ID) { return(BadRequest()); } _studentRepository.Update(studentDetails); try { _studentRepository.Save(); } catch (DbUpdateConcurrencyException) { if (!_studentRepository.StudentDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <StudentDetails> > PostStudentDetails(StudentDetails studentDetails) { _studentRepository.Insert(studentDetails); _studentRepository.Save(); return(CreatedAtAction("GetStudentDetails", new { id = studentDetails.ID }, studentDetails)); }
public ActionResult EditStudent(int id) { HomeDbUtil dbObj = new HomeDbUtil(); StudentDetails stdobj = dbObj.GetStudentByID(id); return(View(stdobj)); }
public ActionResult NewQuestion_Request(string Sub, string Unit, string Q_heading, string Q_desc) { var user = new StudentDetails(User.Identity.Name); Stu_AddQuestionReq sa = new Stu_AddQuestionReq() { StudentID = user.Stuid, CourseID = user.CourseId, Sem = user.Sem, SubjectID = Int32.Parse(Sub), Unit = Int32.Parse(Unit), Qestion_Heading = Q_heading, Question_Description = Q_desc, IsAnswered = false, Question_Date = DateTime.Now }; dbcontext.Stu_AddQuestionReq.Add(sa); int status = dbcontext.SaveChanges(); if (status > 0) { TempData["Message"] = "Your Question has been Posted Successfully"; } else { TempData["Message"] = "There was an error While Posting Your Question, Please try after sometime"; } return(RedirectToAction("Success")); }
public void Test() { ISourceMapper <Student, Person> mapper1 = FactoryMapper.DynamicResolutionMapper <Student, Person>(); ISourceMapper mapper2 = FactoryMapper.DynamicResolutionMapper(typeof(PersonaGiuridica), typeof(PersonDetails)); ISourceMapper mapper3 = FactoryMapper.DynamicResolutionMapper(typeof(IPersonHeader), typeof(PersonDetails)); IList <IPropertyMapper <Student, Person> > propMappers = new List <IPropertyMapper <Student, Person> > { new PropertyMapper <Student, Person>((student, person) => person.Name = student.Name, "Name", "Name") , new PropertyMapper <Student, Person>((student, person) => person.AnnoNascita = student.AnnoNascita) , new PropertyMapper <Student, Person>((student, person) => person.Parent = student.Father) }; SourceMapper <Student, Person> mapper4 = new SourceMapper <Student, Person>(propMappers, null, null); StudentDetails example = new StudentDetails(); ServiceTransformer <ISourceMapper <Student, Person> > srv1 = new ServiceTransformer <ISourceMapper <Student, Person> >("default", mapper4); var res1 = srv1.Match <ISourceMapper <Student, Person> >("default"); var res2 = srv1.Match <SourceMapper <Student, Person> >("default"); var res3 = srv1.Match <ISourceMapper <Student, Person> >("ss"); var res4 = srv1.Match <SourceMapper <Student, Person> >("ss"); var res5 = srv1.Match("default", example.GetType(), typeof(Person)); Assert.IsTrue(res1); Assert.IsFalse(res2); Assert.IsFalse(res3); Assert.IsFalse(res4); Assert.IsTrue(res5); }
public ActionResult Details(string id) { var student = _context.Users.SingleOrDefault(c => c.Id == id); if (student == null) { return(HttpNotFound()); } var userSubscriptionList = _context.Subscriptions.Where(subscription => subscription.Student_Id.Equals(student.Id)).ToList(); var userList = _context.Users; List <CourseDto> dtoList = new List <CourseDto>(); userSubscriptionList.ForEach(course => { User user = userList.SingleOrDefault(u => u.Id.Equals(course.Cours.Author_Id)); CourseDto dto = Mapper.Map <CourseDto>(course.Cours); dto.Author_Id = user.Email; dtoList.Add(dto); }); var viewModel = new StudentDetails { Student = Mapper.Map <User, StudentDto>(student), StudentCourses = dtoList }; return(View(viewModel)); }
public void TestMethod0() { var controller = new StudentDetails(); var result = controller.Details("AnyHash") as ViewResult; Assert.AreEqual("StudentDetails", result.ViewName); }
public async Task <ActionResult <StudentDetails> > PostStudentDetails(StudentDetails studentDetails) { _context.StudentsDetails.Add(studentDetails); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStudentDetails", new { id = studentDetails.ID }, studentDetails)); }
public int SaveStudentsDetails(Models.StudentDetails StudentDetails) { var dbStudentDetails = new StudentDetails() { Surname = StudentDetails.Surname, FirstNames = StudentDetails.FirstNames, Idnumber = StudentDetails.Idnumber, ResidentialAddressId = SaveAddress(StudentDetails.ResidentialAddress), PostalAddressId = SaveAddress(StudentDetails.PostalAddress), TelWork = StudentDetails.TelWork, TelHome = StudentDetails.TelHome, Cell = StudentDetails.Cell, Fax = StudentDetails.Fax, Email = StudentDetails.Email, Title = StudentDetails.Title, Race = StudentDetails.Race, OtherRace = StudentDetails.OtherRace, Gander = StudentDetails.Gander, DisabilitiesOrMedicalConditionAffectStudies = StudentDetails.DisabilitiesOrMedicalConditionAffectStudies, NatureOfDisabilityOrMedicalCondition = StudentDetails.NatureOfDisabilityOrMedicalCondition }; _ffsaDbContext.Add(dbStudentDetails); _ffsaDbContext.SaveChanges(); return(dbStudentDetails.Id); }
// GET api/Students/5 public StudentDetails GetStudents(int id) { DbStudentsRepository studentRepository = this.allRepositories.GetStudentsRepository(); var student = studentRepository.Get(id); if (student == null) { var errResponse = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "No such user was found"); throw new HttpResponseException(errResponse); } var studentDetails = new StudentDetails() { Id = student.Id, FirstName = student.FirstName, LastName = student.LastName, Age = student.Age, Grade = student.Grade, SchoolId = student.School.Id, Marks = (from mark in student.Marks select new MarkModel() { Id = mark.Id, Subject = mark.Subject, Value = mark.Value }).ToList() }; return(studentDetails); }
// GET: StudentController/Edit/5 public ActionResult Edit(int id) { StudentDetails data = students.FirstOrDefault(x => x.Sid == id); return(View(data)); // return View(); }
private void LoadRecord(out Student student, out StudentDetails details, out Requirement requirement) { student = new Student { FirstName = txtFName.Text, MiddleName = txtMName.Text, LastName = txtLName.Text, NameSuffix = txtNameSuffix.Text, BirthDate = dpDOB.Value, Contact = txtContact.Text, Gender = (rbMale.Checked == true ? "Male" : "Female"), }; details = new StudentDetails { Address = string.Concat(txtStreet.Text, ", ", txtCity.Text, ", ", txtState.Text, ", ", txtZIP.Text), Religion = txtReligion.Text, Citizenship = txtCitizenship.Text, FatherName = txtFathersName.Text, FatherOccup = txtFathersOccup.Text, MotherName = txtMothersName.Text, MotherOccup = txtMothersOccup.Text, GuardianName = txtGuardiansName.Text, GuardianOccup = txtGuardiansOccup.Text, Relationship = txtRelationship.Text, ContactInCaseOfEmergency = txtContactInEmergency.Text, Status = Status.Pre_registration, }; requirement = new Requirement { FORM137 = false, GM = false, NSO = false, PDS = false }; }
public string UpdateStudentRecords([FromBody] StudentDetails StudentData) { UpdateStudentData updateStudentData = new UpdateStudentData(); updateStudentData.UpdateRecord(StudentData.Id, StudentData); return("Updated Successfully"); }
public ActionResult AddStudent(StudentDetails std) { /* * Creating object of DAL class `HomeDbUtil` */ HomeDbUtil db = new HomeDbUtil(); /* * @param StudentDetails modal class to CreateAccount method of Account class * @return number of rows affected */ int rows = db.CreateStudent(std); if (rows > 0) { /* * if insert success */ Session["Notification"] = 1; return(RedirectToAction("Index")); } else { /* * if insert failure */ Session["Notification"] = 2; return(RedirectToAction("Index")); } }
public ActionResult StudentFee(int class_id=0,int exam_id = 0) { if (Session[Configuration.SESSION_USER_ID] == null) { return RedirectToAction("Index", "Login"); } int school_id = SessionHandler.GetSchoolID(); ExamDetails _ed = new ExamDetails(); ClassDetails _cd = new ClassDetails(); ViewBag.exams = _ed.GetAll(school_id).ToList(); ViewBag.classes = _cd.GetAll(school_id).ToList(); if (school_id != 0 && class_id != 0 && exam_id != 0) { StudentDetails _sd = new StudentDetails(); var stds = _sd.GetAll(school_id,class_id); //if (stds.ToList().Count == 0 || exam_types.Count != rests.ToList().Count) //{ // foreach (var exam in exam_types) // { // if (rests.ToList().Count == 0) // { // _ed.InsertSubjectExam(school_id, subject_id, exam.exam_id, class_id, 1); // } // else // { // foreach (var se in rests) // { // if (se.exam_id == exam.exam_id && se.subject_id == subject_id && class_id == se.class_id) // continue; // _ed.InsertSubjectExam(school_id, subject_id, exam.exam_id, class_id, 1); // } // } // } //} } return View(); }
public ActionResult KidsAttendance(int kid_id = 0, string date = "") { ViewBag.date = date; var kids = new StudentDetails().GetAllChildren(SessionHandler.GetSchoolID(),SessionHandler.GetUserID()); ViewBag.kids = kids; if (date != "" && kid_id >= 0) { var kid_obj = (from k in kids where k.user_id == kid_id select k).FirstOrDefault(); ViewBag.kid = kid_obj; int school_id = SessionHandler.GetSchoolID(); StudentAttendance _sd = GetStudentAttendance(kid_id, date); return View("KidsAttendance", _sd); } return View("KidsAttendance"); }
public ActionResult EditStudent(int student_id = 0, int class_id = 0, string date = "") { if (Session[Configuration.SESSION_USER_ID] == null) { return RedirectToAction("Index", "Login"); } var _sdd = new StudentDetails(); int school_id = SessionHandler.GetSchoolID(); ViewBag.classes = new ClassDetails().GetAll(school_id); var stds = _sdd.GetAll(school_id).ToList(); var sss = (from s in stds select new { fullname = s.first_name + " " + s.last_name, id = s.user_id, cid = s.class_id }).ToList().ToJSON(); ViewBag.students = sss; var std = _ad.FindSingle(student_id, school_id); return View(std); }
public static IEnumerable<Student> GetClassStudent(int school_id, int class_id) { var classes = new ClassDetails().GetAll(school_id); var length = classes.Count(); string cls_ids = "("; int i = 0; foreach (var cls in classes) { cls_ids += cls.class_id; if ((i + 1) != length) { cls_ids += ","; } i++; } cls_ids += ")"; int indexOfComma = cls_ids.LastIndexOf(','); var _sd = new StudentDetails().GetAll(school_id, cls_ids); return _sd; }
public ActionResult FamilyReport(int p_id=0) { int school_id = SessionHandler.GetSchoolID(); var parents = new ParentDetails().GetAll(school_id); ViewBag.parents = parents; if (p_id > 0) { ViewBag.isSelected = true; var stds = new StudentDetails().GetAllChildren(school_id, p_id); var length = parents.Count(); if(length > 0) { string stds_ids = "("; int i = 0; foreach (var std in stds) { stds_ids += std.user_id; if ((i + 1) != length) { stds_ids += ","; } i++; } stds_ids += ")"; ViewBag.children = stds; var student_fees = new StudentFeeDetails().GetAll(school_id, stds_ids); return View("FamilyReport", student_fees); } } return View("FamilyReport"); }
public string StudentFee(IEnumerable<StudentFee> stdFee, IEnumerable<StudentFee> stdAdd, int total, int discount,int c_id = -1,int s_id = -1) { if (stdFee != null || stdFee.Count() > 0 || stdAdd != null || stdAdd.Count() > 0) { var school_id = SessionHandler.GetSchoolID(); var user_id = SessionHandler.GetUserID(); foreach(var fee in stdFee) { fee.updated_by = user_id; fee.school_id = school_id; if(fee.status) { fee.paid_status = FeePaidStatus.PAID; } else { fee.paid_status = FeePaidStatus.UNPAID; } _fsd.UpdateStudentFee(fee); } foreach(var fee in stdAdd) { fee.updated_by = user_id; fee.school_id = school_id; if(fee.status) { fee.paid_date = DateTime.Now.ToString("yyyy-mm-dd"); fee.paid_status = FeePaidStatus.PAID; } else { fee.paid_status = FeePaidStatus.UNPAID; } _fsd.UpdateStudentFee(fee); } StudentDetails _sd = new StudentDetails(); _sd.Update(school_id , s_id,c_id, discount); } return false.ToJSON(); }
public ActionResult StudentMarks(int class_id = 0, int subject_id = 0, int exam_id = 0) { int school_id = SessionHandler.GetSchoolID(); int user_id = SessionHandler.GetUserID(); SubjectDetails sbs = new SubjectDetails(); ClassDetails clss = new ClassDetails(); ViewBag.subjects = sbs.GetAll(school_id).ToList().ToJSON(); ViewBag.classes = clss.GetAll(school_id); ViewBag.exams = _ed.GetAll(school_id).ToList(); if (school_id != 0 && class_id != 0 && subject_id != 0 && exam_id != 0) { StudentDetails stds = new StudentDetails(); var stnds_result = stds.GetAll(school_id, class_id).ToList(); var rests = _ed.FindMarksOnCondition(school_id, class_id, subject_id, exam_id); if (rests.ToList().Count == 0 || stnds_result.Count != rests.ToList().Count) { foreach (var std in stnds_result) { if (rests.ToList().Count == 0) { _ed.InsertSubjectMarks(school_id, subject_id, exam_id, class_id, std.user_id, user_id); } else { bool isExisted = false; foreach (var se in rests) { if (se.exam_id == exam_id && se.subject_id == subject_id && class_id == se.class_id && se.student_id == std.user_id) isExisted = true; } if (!isExisted) { _ed.InsertSubjectMarks(school_id, subject_id, exam_id, class_id, std.user_id, user_id); } } } } ViewBag.class_id = class_id; ViewBag.subject_id = subject_id; var rest = _ed.FindMarksOnCondition(school_id, class_id, subject_id, exam_id); return View(rest); } return View(); }
public ActionResult ViewClass(int class_id = 0, string date = "") { ClassDetails _cd = new ClassDetails(); int school_id = SessionHandler.GetSchoolID(); ViewBag.classes = _cd.GetAll(school_id); ViewBag.Days = 0; ViewBag.class_id = class_id; ViewBag.date = date; if (class_id != 0 && date != "") { string startDate = ""; string endDate = ""; date.makeDateString(ref startDate, ref endDate); int daysInMonth = date.GetDaysInMonth(); var result = _ad.GetAll(school_id, class_id, startDate, endDate).ToList(); var _sd = new StudentDetails(); var stds = _sd.GetAll(school_id, class_id); ViewBag.Days = daysInMonth; List<StudentAttendance> attendance = new List<StudentAttendance>(); foreach (var std in stds) { StudentAttendance stdAttnd = new StudentAttendance() { student_name = std.first_name + " " + std.last_name, student_id = std.user_id }; for (int x = 1; x <= daysInMonth; x++) { PresentStatus _ps = new PresentStatus() { dayOfMonth = x, status = -1 }; foreach (var atnd in result) { int dayInAtnd = atnd.date.GetDayOfMonth(); if (atnd.student_id == std.user_id && x == dayInAtnd) { _ps.status = atnd.status; break; } } stdAttnd.AttendanceDays.Add(_ps); } attendance.Add(stdAttnd); } return View(attendance); } return View(); }
public ActionResult StudentFee(int student_id=0, int class_id=0) { int school_id = SessionHandler.GetSchoolID(); var session_id = SessionHandler.GetSchoolSessionID(); var classes = Utils.GetClasses(school_id); var _sd = Utils.GetClassStudent(school_id, class_id); var sds = (from s in _sd select new { fullname = s.first_name + " " + s.last_name, id = s.user_id,class_id= s.class_id }).ToList().ToJSON(); ViewBag.classes = classes; ViewBag.student_id = student_id; ViewBag.class_id = class_id; ViewBag.students = sds; if(student_id != 0 && class_id != 0) { ViewBag.isSelected = true; var fees = new StudentFeeDetails().GetAll(school_id, student_id, class_id); var std_itself = new StudentDetails().FindSingle(student_id, school_id); var parent = new ParentDetails().FindSingle(std_itself.parent_id, school_id); var cls = new ClassDetails().FindSingle(std_itself.class_id, school_id); std_itself.parent_name = parent.full_name; std_itself.class_name = cls.name; ViewBag.student = std_itself; var add_fee = (from f in fees where f.type == FeeType.EXAMINATION_FEE || f.type == FeeType.ADMISSION_FEE || f.type == FeeType.OTHER_CHARGES select f).ToList(); var monthly_fee = (from f in fees where f.type == FeeType.MONTHLY_FEE select f).ToList(); foreach (var f in add_fee) { if (f.type == FeeType.ADMISSION_FEE) f.fee = std_itself.admission_fee; if (f.type == FeeType.EXAMINATION_FEE) f.fee = std_itself.examination_fee; if (f.type == FeeType.OTHER_CHARGES) f.fee = std_itself.other_charges; } var total = 0; foreach (var f in fees) { f.fee = std_itself.monthly_fee; if (f.paid_status == FeePaidStatus.PAID) { total += f.fee; } } //to find the discount amount int discount = (int)(from std in _sd where std.user_id == student_id select std.discount).FirstOrDefault(); ViewBag.total = total - discount; ViewBag.discount = discount; ViewBag.add_fee = add_fee; return View("StudentFee", monthly_fee); } return View("StudentFee"); }
public ActionResult MarkClass(int class_id = 0, string date = "") { if (Session[Configuration.SESSION_USER_ID] == null) { return RedirectToAction("Index", "Login"); } ClassDetails _cd = new ClassDetails(); int school_id = SessionHandler.GetSchoolID(); ViewBag.class_id = class_id; ViewBag.date = date; ViewBag.classes = _cd.GetAll(school_id); ViewBag.Days = 0; if (class_id != 0) { var result = _ad.GetAll(school_id, class_id).ToList(); var _sd = new StudentDetails(); var stds = _sd.GetAll(school_id, class_id); var adResult = _ad.GetAll(school_id, class_id, date).ToList(); //int daysInMonth = this.GetDaysInMonth(date); ViewBag.Days = 1; var day = date.GetDayOfMonth(); List<StudentOneDay> attendance = new List<StudentOneDay>(); foreach (var std in stds) { StudentOneDay stdAttnd = new StudentOneDay() { student_name = std.first_name + " " + std.last_name, student_id = std.user_id, status = -1 }; attendance.Add(stdAttnd); var isExsited = false; foreach (var adr in adResult) { if (std.user_id == adr.student_id) { isExsited = true; } } if (!isExsited) { Attendance atd = new Attendance() { student_id = std.user_id, school_id = SessionHandler.GetSchoolID(), status = -1, class_id = class_id, date = date, updated_by = SessionHandler.GetUserID() }; _ad.Insert(atd); } } return View(attendance); } return View(); }
public ActionResult MineFee() { int school_id = SessionHandler.GetSchoolID(); int student_id = SessionHandler.GetUserID(); ViewBag.isSelected = true; var std_itself = new StudentDetails().FindSingle(student_id, school_id); var fees = new StudentFeeDetails().GetAll(school_id, student_id, std_itself.class_id); var parent = new ParentDetails().FindSingle(std_itself.parent_id, school_id); var cls = new ClassDetails().FindSingle(std_itself.class_id, school_id); std_itself.parent_name = parent.full_name; std_itself.class_name = cls.name; ViewBag.student = std_itself; var add_fee = (from f in fees where f.type == FeeType.EXAMINATION_FEE || f.type == FeeType.ADMISSION_FEE || f.type == FeeType.OTHER_CHARGES select f).ToList(); var total = 0; foreach (var f in add_fee) { if (f.type == FeeType.ADMISSION_FEE) f.fee = std_itself.admission_fee; if (f.type == FeeType.EXAMINATION_FEE) f.fee = std_itself.examination_fee; if (f.type == FeeType.OTHER_CHARGES) f.fee = std_itself.other_charges; if (f.paid_status == FeePaidStatus.PAID) total += f.fee; } var monthly_fee = (from f in fees where f.type == FeeType.MONTHLY_FEE select f).ToList(); foreach (var f in monthly_fee) { f.fee = std_itself.monthly_fee; if (f.paid_status == FeePaidStatus.PAID) { total += f.fee; } } //to find the discount amount int discount = std_itself.discount; ViewBag.total = total - discount; ViewBag.discount = discount; ViewBag.add_fee = add_fee; return View("MineFee", monthly_fee); }
public ActionResult ViewStudent(int student_id = 0, int class_id = 0, string date = "") { var _sdd = new StudentDetails(); int school_id = SessionHandler.GetSchoolID(); ViewBag.classes = new ClassDetails().GetAll(school_id); ViewBag.class_id = class_id; ViewBag.student_id = student_id; ViewBag.date = date; var stds = _sdd.GetAll(school_id).ToList(); var sss = (from s in stds select new { fullname = s.first_name + " " + s.last_name, id = s.user_id, cid = s.class_id }).ToList().ToJSON(); ViewBag.students = sss; string startDate = ""; string endDate = ""; if (class_id != 0 && student_id != 0 && date != "") { var std = _sdd.FindSingle(student_id, school_id); date.makeDateString(ref startDate, ref endDate); int daysInMonth = date.GetDaysInMonth(); var stdAtnd = _ad.GetAll(school_id, class_id, student_id, startDate, endDate); StudentAttendance _sd = GetStudentAttendance(student_id, date); return View(_sd); } return View(); }
private StudentAttendance GetStudentAttendance(int student_id, string date) { var school_id = SessionHandler.GetSchoolID(); var std = new StudentDetails().FindSingle(student_id, school_id); string startDate = "", endDate = ""; date.makeDateString(ref startDate, ref endDate); int daysInMonth = date.GetDaysInMonth(); var stdAtnd = _ad.GetAll(school_id, std.class_id, student_id, startDate, endDate); StudentAttendance _sd = new StudentAttendance(); _sd.student_id = std.user_id; _sd.student_name = std.first_name + " " + std.last_name; for (int i = 0; i < daysInMonth; i++) { var reqDate = ""; var dayName = ""; startDate.getDayAndDate(ref dayName, ref reqDate, i); PresentStatus _ps = new PresentStatus(); _ps.status = -1; _ps.date = reqDate; _ps.dayName = dayName; foreach (var attnd in stdAtnd) { if (attnd.date.ComapareDate(reqDate)) { _ps.status = attnd.status; break; } } _sd.AttendanceDays.Add(_ps); } return _sd; }
public ActionResult StudentAttendance(string date = "") { ViewBag.date = date; if (date != "") { int school_id = SessionHandler.GetSchoolID(); int user_id = SessionHandler.GetUserID(); var std = new StudentDetails().FindSingle(user_id, school_id); StudentAttendance _sd = GetStudentAttendance(user_id, date); return View("StudentAttendance", _sd); } return View("StudentAttendance"); }
public static IEnumerable<Student> GetParentStudent(int school_id, int class_id) { var parents = new ParentDetails().GetAll(school_id); var length = parents.Count(); string parent_ids = "("; int i = 0; foreach (var prnt in parents) { parent_ids += prnt.user_id; if ((i + 1) != length) { parent_ids += ","; } i++; } parent_ids += ")"; int indexOfComma = parent_ids.LastIndexOf(','); var _sd = new StudentDetails().GetAll(school_id, parent_ids); return _sd; }