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 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; }