protected void btnDelete_Click(object sender, EventArgs e) { sessionId = Convert.ToInt32(Session["sessionId"]); Collection <AttendanceCL> attendanceCL = new Collection <AttendanceCL>(); foreach (GridViewRow item in grdStudent.Rows) { int studentId = Convert.ToInt32(grdStudent.DataKeys[item.RowIndex].Value.ToString()); int attendanceId = attendanceBLL.viewAttendanceByStudentIdandDate(studentId, Convert.ToDateTime(txtDate.Text)).id; StudentCL studentCL = studentBLL.viewStudentById(studentId, sessionId); DropDownList ddlStudentLeaveType = item.FindControl("ddlGrdStudentLeaveType") as DropDownList; if (Convert.ToInt32(ddlStudentLeaveType.SelectedValue) != -1) { attendanceCL.Add(new AttendanceCL() { classId = studentCL.classId, date = Convert.ToDateTime(txtDate.Text), dateCreated = DateTime.Now, dateModified = DateTime.Now, isDeleted = false, studentId = studentId, studentLeaveType = ddlStudentLeaveType.SelectedItem.ToString(), studentLeaveTypeId = Convert.ToInt32(ddlStudentLeaveType.SelectedValue), id = attendanceId, }); } } int attendanceUpdated = attendanceBLL.deleteAttendance(attendanceCL); lblUpdate.Text = attendanceUpdated + " Entries have been deleted. The page will refresh in 5 seconds"; Response.AppendHeader("Refresh", "5;url=ManageAttendance.aspx"); }
protected void txtAdmissionNo_TextChanged(object sender, EventArgs e) { if (txtAdmissionNo.Text != "") { StudentCL getStudent = studentBLL.viewStudentByAdmissionNo(Convert.ToInt32(txtAdmissionNo.Text), Convert.ToInt32(Session["sessionId"])); if (getStudent.id == 0) { string script = "alert(\"Incorrect Admission Number.\");"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); } else { Collection <ClassCL> classCol = classBLL.viewClasses(Convert.ToInt32(Session["sessionId"])); ddlClass.DataSource = classCol; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "classSection"; ddlClass.DataBind(); ddlClass.SelectedValue = getStudent.classId.ToString(); txtAddress.Text = getStudent.address; txtDateUpdated.Text = getStudent.dateModified.ToString("dd MMMM yyyy"); txtDOB.Text = getStudent.dob.ToString("yyyy-MM-dd"); txtEmailAddress.Text = getStudent.emailAddress; txtFatherName.Text = getStudent.fatherName; txtMobileNumber.Text = getStudent.fatherMobileNumber; txtStudentName.Text = getStudent.studentName; } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { int admissionNo = Convert.ToInt32(Session["AdmNo"]); long MobileNo = Convert.ToInt64(Session["MobNo"]); StudentCL getUserbyMobNo = userBLL.getStudentByMobileNo(MobileNo, admissionNo); GlobalVariables.SetGlobalLong(getUserbyMobNo.id); lblAddress.Text = getUserbyMobNo.address; lblAdmissionNo.Text = getUserbyMobNo.admissionNo.ToString(); lblClass.Text = getUserbyMobNo.studentClass + " - " + getUserbyMobNo.section; lblFatherName.Text = getUserbyMobNo.fathersname; lblGender.Text = (getUserbyMobNo.gender) ? "Male" : "Female"; lblMotherName.Text = getUserbyMobNo.mothername; lblStudentName.Text = getUserbyMobNo.name; } } catch (Exception ex) { MsgBox("404 Not Found", this.Page, this); Response.Redirect("index.aspx"); } }
protected void AddData() { sessionId = Convert.ToInt32(Session["sessionId"]); Collection <AttendanceCL> attendanceCL = new Collection <AttendanceCL>(); foreach (GridViewRow item in grdStudent.Rows) { int studentId = Convert.ToInt32(grdStudent.DataKeys[item.RowIndex].Value.ToString()); StudentCL studentCL = studentBLL.viewStudentById(studentId, sessionId); DropDownList ddlStudentLeaveType1 = item.FindControl("ddlGrdStudentLeaveType") as DropDownList; if (Convert.ToInt32(ddlStudentLeaveType1.SelectedValue) != -1) { attendanceCL.Add(new AttendanceCL() { classId = studentCL.classId, date = Convert.ToDateTime(txtDate.Text), dateCreated = DateTime.Now, dateModified = DateTime.Now, isDeleted = false, studentId = studentId, studentLeaveType = ddlStudentLeaveType1.SelectedItem.ToString(), studentLeaveTypeId = Convert.ToInt32(ddlStudentLeaveType1.SelectedValue), }); } } Collection <AttendanceCL> attendanceUpdated = attendanceBLL.addAttendance(attendanceCL); //lblUpdate.Text = attendanceUpdated.Count() + " Entries have been added. The page will refresh in 5 seconds"; //Response.AppendHeader("Refresh", "5;url=ManageAttendance.aspx?classId=" + attendanceUpdated[0].classId + "&date=" + attendanceUpdated[0].date); }
protected void UpdateData() { DateTime dateHosting = DateTime.UtcNow; TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"); DateTime dateNow = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId); StudentCL studentCL = new StudentCL(); studentCL.id = Convert.ToInt32(Request.QueryString["studentId"]); studentCL.isDeleted = true; studentCL.dateDeleted = Convert.ToDateTime(txtDateofIssue.Text); bool exists = System.IO.Directory.Exists(Server.MapPath("Data/")); if (!exists) { System.IO.Directory.CreateDirectory(Server.MapPath("Data/")); } if (fuTransferCertificate.HasFile) { string TCFilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + "InactiveTC-" + Path.GetExtension(fuTransferCertificate.FileName); fuTransferCertificate.PostedFile.SaveAs(Server.MapPath("Data/") + TCFilePath); studentCL.deletedTransferCertificate = "http://www.rainbowjanakpuri.com/Student/Data/" + TCFilePath; } StudentCL deletedStudent = studentBLL.updateTCStudent(studentCL); Response.Redirect("ManageTC.aspx?studentId=" + deletedStudent.id); }
/// <summary> /// This method creates new student data in the database. /// </summary> /// <param name="studentCL">Student Data entered by Backend User</param> /// <returns>Student Id created after adding Student.</returns> public int createStudent(StudentCL studentCL) { Student student = dbcontext.Students.Add(new Student { Address = studentCL.address, AdmissionNo = studentCL.admissionNo, Class = studentCL.studentClass, DateCreated = studentCL.dateCreated, DateModified = studentCL.dateModified, FathersName = studentCL.fathersname, Gender = studentCL.gender, IsDeleted = studentCL.isDeleted, MobileNumber = studentCL.mobileNumber, MothersName = studentCL.mothername, Name = studentCL.name, Section = studentCL.section, }); dbcontext.SaveChanges(); Left_Fee leftFee = dbcontext.Left_Fees.Add(new Left_Fee { AdminCharges = 0, AdmissionFee = 0, AnnualCharges = 0, ComputerFeeMonthly = 0, ComputerFeeYearly = 0, DateCreated = DateTime.Now, DateModified = DateTime.Now, DevelopmentChargesYearly = 0, IsDeleted = false, LabFee = 0, Month = DateTime.Now, ProjectFee = 0, RefreshmentAccFee = 0, SmartClassCharges = 0, TotalFee = 0, TutionFee = 0, }); dbcontext.SaveChanges(); Payment_Detail paymentDetail = dbcontext.Payment_Details.Add(new Payment_Detail { DateCreated = DateTime.Now, DateModified = DateTime.Now, IsDeleted = false, LeftFeesAmount = leftFee.TotalFee, LeftfeesId = leftFee.Id, ModeOfPayment = "Cash", StudentId = student.Id, }); dbcontext.SaveChanges(); return(student.Id); }
protected void UpdateData() { DateTime dateHosting = DateTime.UtcNow; TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"); DateTime dateNow = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId); StudentCL studentCL = new StudentCL(); studentCL.id = Convert.ToInt32(Request.QueryString["studentId"]); if (txtAadharCardNo.Text != string.Empty && txtAadharCardNo.Enabled != false) { studentCL.aadharCardNo = txtAadharCardNo.Text; } else { studentCL.aadharCardNo = null; } studentCL.address = txtAddress.Text; studentCL.admissionNo = Convert.ToInt32(txtAdmissionNo.Text); studentCL.classId = Convert.ToInt32(ddlClass.SelectedValue); studentCL.dateCreated = Convert.ToDateTime(txtDateCreated.Text); studentCL.dateModified = dateNow; studentCL.dob = Convert.ToDateTime(txtDOB.Text); if (txtEmailAddress.Text != string.Empty && txtEmailAddress.Enabled != false) { studentCL.emailAddress = txtEmailAddress.Text; } else { studentCL.emailAddress = null; } studentCL.fatherMobileNumber = txtMobileNumber.Text; studentCL.fatherName = txtFatherName.Text; studentCL.gender = Convert.ToBoolean(ddlGender.SelectedValue); studentCL.isDeleted = false; studentCL.motherName = txtMotherName.Text; if (txtSiblingAdmissionNo.Text != "" && txtSiblingAdmissionNo.Enabled != false) { studentCL.siblingAdmissionNo = Convert.ToInt32(txtSiblingAdmissionNo.Text); } else { studentCL.siblingAdmissionNo = null; } studentCL.studentCategoryId = Convert.ToInt32(ddlStudentCategory.SelectedValue); studentCL.studentName = txtStudentName.Text; StudentCL studentReturn = studentBLL.updateStudent(studentCL); Response.Redirect("ManageStudent.aspx?studentId=" + studentReturn.id); }
protected void btnDelete_Click(object sender, EventArgs e) { DateTime dateHosting = DateTime.UtcNow; TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"); DateTime dateNow = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId); StudentCL studentCL = new StudentCL(); studentCL.id = Convert.ToInt32(Request.QueryString["studentId"]); studentCL.isDeleted = false; studentCL.dateDeleted = null; studentCL.miscellaneous1Link = null; StudentCL deletedStudent = studentBLL.updateTCStudent(studentCL); Response.Redirect("TC.aspx"); }
public StudentCL updateTCStudent(StudentCL studentsInput) { StudentCL studentReturn = new StudentCL(); Student studentsQuery = (from x in dbcontext.Students where x.Id == studentsInput.id select x).FirstOrDefault(); studentsQuery.IsDeleted = studentsInput.isDeleted; studentsQuery.DeletedTransferCertificate = studentsInput.deletedTransferCertificate; studentsQuery.DateDeleted = studentsInput.dateDeleted; dbcontext.SaveChanges(); studentReturn.id = studentsQuery.Id; studentReturn.isDeleted = studentsQuery.IsDeleted; studentReturn.deletedTransferCertificate = studentsQuery.DeletedTransferCertificate; studentReturn.dateDeleted = studentsQuery.DateDeleted; return(studentReturn); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { int admissionNo = Convert.ToInt32(Session["AdmNo"]); StudentCL getUser = frontUserBLL.getStudentByAdmissionNo(admissionNo); Session["MobNo"] = getUser.mobileNumber; lblMobNo.Text = Session["MobNo"].ToString().Substring(0, 6) + "XXXX"; } } catch (Exception ex) { MsgBox("404 Not Found", this.Page, this); Response.Redirect("index.aspx"); } }
protected void UpdateData() { sessionId = Convert.ToInt32(Session["sessionId"]); int classId = Convert.ToInt32(Request.QueryString["classId"]); Collection <AttendanceCL> attendanceCL = new Collection <AttendanceCL>(); foreach (GridViewRow item in grdStudent.Rows) { int studentId = Convert.ToInt32(grdStudent.DataKeys[item.RowIndex].Value.ToString()); AttendanceCL getAttendance = attendanceBLL.viewAttendanceByStudentIdandDate(studentId, Convert.ToDateTime(txtDate.Text)); StudentCL studentCL = studentBLL.viewStudentById(studentId, sessionId); DropDownList ddlStudentLeaveType = item.FindControl("ddlGrdStudentLeaveType") as DropDownList; if (Convert.ToInt32(ddlStudentLeaveType.SelectedValue) != -1) { attendanceCL.Add(new AttendanceCL() { classId = classId, date = Convert.ToDateTime(txtDate.Text), dateCreated = DateTime.Now, dateModified = DateTime.Now, isDeleted = false, studentId = studentId, studentLeaveType = ddlStudentLeaveType.SelectedItem.ToString(), studentLeaveTypeId = Convert.ToInt32(ddlStudentLeaveType.SelectedValue), id = getAttendance.id, }); } else { if (getAttendance.studentLeaveTypeId != -1) { AttendanceCL deletedAttendance = new AttendanceCL() { id = getAttendance.id, }; attendanceBLL.deleteAttendanceCL(deletedAttendance); } } } AttendanceCL attendanceUpdated = attendanceBLL.updateAttendance(attendanceCL); lblUpdate.Text = " Entries have been updated. The page will refresh in 5 seconds"; Response.AppendHeader("Refresh", "5;url=index.aspx"); }
protected void FetchControls() { sessionId = Convert.ToInt32(Session["sessionId"]); Collection <ClassCL> classCol = classBLL.viewClasses(sessionId); if (Request.QueryString["studentId"] != null) { int studentId = Convert.ToInt32(Request.QueryString["studentId"]); StudentCL studentCL = studentBLL.viewStudentById(studentId, sessionId); lblHeading.Text = "Update/Remove Transfer Certificate"; ddlClass.DataSource = classCol; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "classSection"; ddlClass.DataBind(); ddlClass.SelectedIndex = studentCL.classId; txtAddress.Text = studentCL.address; txtAdmissionNo.Text = studentCL.admissionNo.ToString(); txtDateUpdated.Text = studentCL.dateModified.ToString("dd MMMM yyyy"); txtDOB.Text = studentCL.dob.ToString("yyyy-MM-dd"); txtEmailAddress.Text = studentCL.emailAddress; txtFatherName.Text = studentCL.fatherName; txtMobileNumber.Text = studentCL.fatherMobileNumber; DateTime DateOfIssue = Convert.ToDateTime(studentCL.dateDeleted); txtDateofIssue.Text = DateOfIssue.ToString("yyyy-MM-dd"); txtStudentName.Text = studentCL.studentName; linkTC.Visible = true; linkTC.Text = studentCL.admissionNo + " - Issued TC on " + DateOfIssue.ToString("dd MMMM yy"); linkTC.NavigateUrl = studentCL.deletedTransferCertificate; } else { lblHeading.Text = "Add Transfer Certificate"; ddlClass.DataSource = classCol; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "classSection"; ddlClass.DataBind(); txtAdmissionNo.ReadOnly = false; linkTC.Visible = false; btnDelete.Visible = false; btnUpdate.Text = "Submit"; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { int admissionNo = Convert.ToInt32(Session["AdmNo"]); long MobileNo = Convert.ToInt64(Session["MobNo"]); StudentCL getUserbyMobNo = studentBLL.getStudentByMobileNo(MobileNo, admissionNo); lblAdmissionNo.Text = getUserbyMobNo.admissionNo.ToString(); lblStudentName.Text = getUserbyMobNo.name.ToString(); lblMobileNo.Text = getUserbyMobNo.mobileNumber.ToString(); Collection <LeftFeesCL> leftFeeDetailbyStudentId = paymentBLL.getLeftFeeCollection(getUserbyMobNo.id); Collection <LeftFeesCL> leftDuesByStudentId = paymentBLL.getLeftFeeDueCollection(getUserbyMobNo.id); grdFeeDetails.DataSource = leftFeeDetailbyStudentId; grdFeeDetails.DataBind(); grdLateFees.DataSource = leftDuesByStudentId; grdLateFees.DataBind(); long totalFee = (leftFeeDetailbyStudentId.Sum(x => x.totalFee) + leftDuesByStudentId.Sum(x => x.totalFee)); if (totalFee == 0) { lblTransFees.Visible = false; lblTotalLeftAmt.Text = "No Fees Available."; lblTransFeeNote.Visible = false; btnPayInsta.Visible = false; btnRtgs.Visible = false; } else { lblTransFees.Visible = true; lblTotalLeftAmt.Text = (leftFeeDetailbyStudentId.Sum(x => x.totalFee) + leftDuesByStudentId.Sum(x => x.totalFee)).ToString(); } } } catch (Exception ex) { MsgBox("404 Not Found", this.Page, this); Response.Redirect("index.aspx"); } }
public StudentCL viewStudentByAdmissionNo(int admissionNo, int sessionId) { Student item = (from x in dbcontext.Students where x.AdmissionNo == admissionNo && x.Class.SessionId == sessionId && x.IsDeleted == false select x).FirstOrDefault(); StudentCL studentCL = new StudentCL() { aadharCardNo = item.AadharCard, address = item.Address, admissionNo = item.AdmissionNo, classId = item.Class.Id, dob = item.DOB, emailAddress = item.EmailAddress, fatherMobileNumber = item.FatherMobileNumber, fatherName = item.FatherName, gender = item.Gender, id = item.Id, motherName = item.MotherName, siblingAdmissionNo = item.SiblingAdmissionNo, studentCategoryId = item.StudentCategoryId, studentName = item.StudentName, birthCertificate = item.BirthCertificate, classSection = item.Class.Class1 + "-" + item.Class.Section, dateCreated = item.DateCreated, dateModified = item.DateModified, deletedTransferCertificate = item.DeletedTransferCertificate, isDeleted = item.IsDeleted, miscellaneous1Link = item.Miscellaneous1Link, miscellaneous1Name = item.Miscellaneous1Name, miscellaneous2Link = item.Miscellaneous2Link, miscellaneous2Name = item.Miscellaneous2Name, miscellaneous3Link = item.Miscellaneous3Link, miscellaneous3Name = item.Miscellaneous3Name, session = item.Class.Session.StartingYear + "-" + item.Class.Session.EndingYear, studentCategory = item.StudentCategory.Name, transferCertificate = item.TransferCertificate, dateDeleted = item.DateDeleted, }; return(studentCL); }
protected async void Page_Load(object sender, EventArgs e) { if (Request.QueryString["payment_id"].Count() == 0) { throw (new Exception("404 Page Not Found")); } else { Instamojo.NET.Instamojo im = new Instamojo.NET.Instamojo("74daa5061b049d6cdc8540a79cfd7a1a", "a1ff98eeb01b5358e479494464b62849"); string paymentId = Request.QueryString["payment_id"]; string paymentRequestId = Request.QueryString["payment_request_id"]; PaymentRequest npr = await im.GetPaymentRequest(paymentRequestId); StudentCL getStudent = userBLL.getStudentByMobileNo(Convert.ToInt64(npr.phone.Substring(3)), npr.buyer_name); Collection <PaymentDetailCL> getFeeCollection = paymentBLL.getPaymentFeeCollection(getStudent.id); Collection <LeftFeesCL> leftFeeDetailbyStudentId = paymentBLL.getLeftFeeCollection(getStudent.id); Collection <LeftFeesCL> leftDuesByStudentId = paymentBLL.getLeftFeeDueCollection(getStudent.id); long TotalAmountWithoutTransCost = (leftFeeDetailbyStudentId.Sum(x => x.totalFee) + leftDuesByStudentId.Sum(x => x.totalFee)); double TotalAmountWithTransCost1 = (TotalAmountWithoutTransCost + 1.18 * 0); double TotalAmountWithTransCost2 = (TotalAmountWithTransCost1 / (1 - 1.18 * 1.9 / 100)); TotalAmountWithTransCost2 = Math.Round(TotalAmountWithTransCost2, 2); if (npr.status == "Completed" && npr.amount == TotalAmountWithTransCost2.ToString()) { if (getFeeCollection.FirstOrDefault().isPaid == false) { int FeeMonthCount = userBLL.deleteLeftFeePayment(getFeeCollection); lblTransactionStatus.Text = "Thankyou for your Transaction. Your Transaction has been successful.Reference Id :" + paymentId; } else { lblTransactionStatus.Text = "You have already paid for this Month Fees & Dues. Your Transaction Reference Id is " + paymentId; } } else { lblTransactionStatus.Text = "Sorry for the inconvenience but the Transaction had failed due to some technical error. Please retry logging in."; } } }
public StudentCL updateStudent(StudentCL studentsInput) { StudentCL studentReturn = new StudentCL(); Student studentsQuery = (from x in dbcontext.Students where x.Id == studentsInput.id select x).FirstOrDefault(); studentsQuery.AadharCard = studentsInput.aadharCardNo; studentsQuery.Address = studentsInput.address; studentsQuery.AdmissionNo = studentsInput.admissionNo; studentsQuery.ClassId = studentsInput.classId; studentsQuery.DateCreated = studentsInput.dateCreated; studentsQuery.DateModified = studentsInput.dateModified; studentsQuery.DOB = studentsInput.dob; studentsQuery.EmailAddress = studentsInput.emailAddress; studentsQuery.FatherMobileNumber = studentsInput.fatherMobileNumber; studentsQuery.FatherName = studentsInput.fatherName; studentsQuery.Gender = studentsInput.gender; studentsQuery.MotherName = studentsInput.motherName; studentsQuery.SiblingAdmissionNo = studentsInput.siblingAdmissionNo; studentsQuery.StudentCategoryId = studentsInput.studentCategoryId; studentsQuery.StudentName = studentsInput.studentName; dbcontext.SaveChanges(); studentReturn.aadharCardNo = studentsQuery.AadharCard; studentReturn.address = studentsQuery.Address; studentReturn.admissionNo = studentsQuery.AdmissionNo; studentReturn.classId = studentsQuery.ClassId; studentReturn.dateCreated = studentsQuery.DateCreated; studentReturn.dateModified = studentsQuery.DateModified; studentReturn.dob = studentsQuery.DOB; studentReturn.emailAddress = studentsQuery.EmailAddress; studentReturn.fatherMobileNumber = studentsQuery.FatherMobileNumber; studentReturn.fatherName = studentsQuery.FatherName; studentReturn.gender = studentsQuery.Gender; studentReturn.motherName = studentsQuery.MotherName; studentReturn.siblingAdmissionNo = studentsQuery.SiblingAdmissionNo; studentReturn.studentCategoryId = studentsQuery.StudentCategoryId; studentReturn.studentName = studentsQuery.StudentName; studentReturn.id = studentsQuery.Id; return(studentReturn); }
/// <summary> /// This method gets the Student Data by querying the Mobile Number /// </summary> /// <param name="mobileNo">Mobile Number entered by User</param> /// <returns>Student Table data found in Database.</returns> public StudentCL getStudentByMobileNo(long mobileNo, string studentName) { Student query = (from xyz in dbcontext.Students where xyz.Name == studentName && xyz.MobileNumber == mobileNo && xyz.IsDeleted == false select xyz).FirstOrDefault(); StudentCL getUserbyMobileNo = new StudentCL() { id = query.Id, address = query.Address, dateCreated = query.DateCreated, dateModified = query.DateModified, fathersname = query.FathersName, gender = query.Gender, isDeleted = query.IsDeleted, studentClass = query.Class, mothername = query.MothersName, section = query.Section, name = query.Name, admissionNo = query.AdmissionNo, mobileNumber = query.MobileNumber }; return(getUserbyMobileNo); }
public int addStudent(StudentCL studentsInput) { Student studentQuery = dbcontext.Students.Add(new Student { AadharCard = studentsInput.aadharCardNo, Address = studentsInput.address, AdmissionNo = studentsInput.admissionNo, TransferCertificate = studentsInput.transferCertificate, BirthCertificate = studentsInput.birthCertificate, ClassId = studentsInput.classId, DateCreated = studentsInput.dateCreated, DateModified = studentsInput.dateModified, DeletedTransferCertificate = studentsInput.deletedTransferCertificate, DOB = studentsInput.dob, EmailAddress = studentsInput.emailAddress, FatherMobileNumber = studentsInput.fatherMobileNumber, FatherName = studentsInput.fatherName, Gender = studentsInput.gender, Id = studentsInput.id, IsDeleted = studentsInput.isDeleted, Miscellaneous1Link = studentsInput.miscellaneous1Link, Miscellaneous1Name = studentsInput.miscellaneous1Name, Miscellaneous2Link = studentsInput.miscellaneous2Link, Miscellaneous2Name = studentsInput.miscellaneous2Name, Miscellaneous3Link = studentsInput.miscellaneous3Link, Miscellaneous3Name = studentsInput.miscellaneous3Name, MotherName = studentsInput.motherName, SiblingAdmissionNo = studentsInput.siblingAdmissionNo, StudentCategoryId = studentsInput.studentCategoryId, StudentName = studentsInput.studentName, DateDeleted = null, }); dbcontext.SaveChanges(); int StudentId = studentQuery.Id; return(StudentId); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } imgLogo.ImageUrl = "logo.jpg"; lblStudentName.Text = studentCL.studentName; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; lblExamination.Text = "PRE-BOARD 1"; int examinationId = reportBLL.viewExamIdByClass(studentCL.classId, "PRE-BOARD 1"); Collection <SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksCol = reportBLL.viewMarksByStudentId(studentId, examinationId); Collection <GradeEntryCL> gradeCol = reportBLL.viewGradesByStudentId(studentId, examinationId); Collection <MarksEntryCL> marksColCopy = marksCol; MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, examinationId); for (int i = 54; i <= 71; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 116); DeletePractical(subjectCol, 121); DeletePractical(subjectCol, 122); for (int i = 144; i <= 150; i++) { DeletePractical(subjectCol, i); } var subjectColl = subjectCol.OrderBy(x => x.name); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("Subjects", typeof(string))); dt.Columns.Add(new DataColumn("Max. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Min. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Theory", typeof(string))); dt.Columns.Add(new DataColumn("Practical", typeof(string))); dt.Columns.Add(new DataColumn("Total", typeof(string))); IDictionary <int, string> marksSubjectDict = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalSubjectDict = new Dictionary <int, string>(); foreach (MarksEntryCL item in marksCol) { if (item.subjectName == "Physics(042)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 55)); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 56)); } else if (item.subjectName == "Biology(044)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 57)); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 58)); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 59)); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 60)); } else if (item.subjectName == "Psychology(037)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 61)); } else if (item.subjectName == "Marketing(783)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 62)); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 63)); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 64)); } else if (item.subjectName == "Economics(030)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 65)); } else if (item.subjectName == "History(027)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 66)); } else if (item.subjectName == "Hindi(302)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 121)); } else if (item.subjectName == "English(301)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 145)); } else if (item.subjectName == "Political Science(028)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 146)); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 147)); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 116)); } else { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, string.Empty); } } double grandTotal = 0; foreach (SubjectCL item in subjectCol) { dr = dt.NewRow(); dr["Subjects"] = item.name; dr["Max. Marks"] = 100; dr["Min. Marks"] = 40; if (marksSubjectDict.ContainsKey(item.id)) { dr["Theory"] = marksSubjectDict[item.id]; if (marksPracticalSubjectDict[item.id] == string.Empty) { dr["Total"] = marksSubjectDict[item.id]; grandTotal = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]); } else { dr["Practical"] = marksPracticalSubjectDict[item.id]; dr["Total"] = Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]); grandTotal = grandTotal + Convert.ToDouble(Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id])); } } else { dr["Theory"] = string.Empty; dr["Practical"] = string.Empty; dr["Total"] = string.Empty; } dt.Rows.Add(dr); } grdMarksReport.DataSource = dt; grdMarksReport.DataBind(); lblGrandTotal.Text = grandTotal.ToString(); lblPercentage.Text = (grandTotal / 5) + "%"; lblPunctuality.Text = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade; lblOppGender.Text = gradeCol.Where(x => x.subjectId == 68).FirstOrDefault().grade; lblClassMates.Text = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade; lblTeachers.Text = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade; lblDiscipline.Text = gradeCol.Where(x => x.subjectId == 71).FirstOrDefault().grade; lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } imgLogo.ImageUrl = "logo.jpg"; lblStudentName.Text = studentCL.studentName; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; lblExamination.Text = "TERM 2"; int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2"); Collection <SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksCol = reportBLL.viewMarksByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksColCopy = marksCol; Collection <GradeEntryCL> gradesColTERM1 = reportBLL.viewGradesByStudentId(studentId, term1ExamId); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term1ExamId); for (int i = 54; i <= 71; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 116); DeletePractical(subjectCol, 54); DeletePractical(subjectCol, 121); var subjectColl = subjectCol.OrderBy(x => x.name); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("Subjects", typeof(string))); dt.Columns.Add(new DataColumn("Max. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Min. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Theory", typeof(string))); dt.Columns.Add(new DataColumn("Practical", typeof(string))); dt.Columns.Add(new DataColumn("Total", typeof(string))); IDictionary <int, string> marksSubjectDict = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalSubjectDict = new Dictionary <int, string>(); int count = 0; foreach (MarksEntryCL item in marksCol) { if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115 && item.subjectId != 13) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, string.Empty); } if (item.subjectId == 14) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 66)); } if (item.subjectId == 2) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 55)); } if (item.subjectId == 3) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 56)); } if (item.subjectId == 4) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 57)); } if (item.subjectId == 5) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 58)); } if (item.subjectId == 6) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 59)); } if (item.subjectId == 15) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 60)); } if (item.subjectId == 7) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 61)); } if (item.subjectId == 11) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 62)); } if (item.subjectId == 9) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 63)); } if (item.subjectId == 8) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 64)); } if (item.subjectId == 10) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 65)); } if (item.subjectId == 115) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 116)); } if (item.subjectId == 13) { marksSubjectDict.Add(item.subjectId, item.marks); marksPracticalSubjectDict.Add(item.subjectId, CheckSubjectInCol(marksColCopy, 121)); } } double grandTotal = 0; foreach (SubjectCL item in subjectCol) { dr = dt.NewRow(); dr["Subjects"] = item.name; dr["Max. Marks"] = 100; dr["Min. Marks"] = 40; if (marksSubjectDict.ContainsKey(item.id)) { // count++; // dr["Theory"] = marksSubjectDict[item.id]; // if (marksPracticalSubjectDict[item.id] == string.Empty) // { // dr["Total"] = marksSubjectDict[item.id]; // grandTotal = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]); // } // else // { // dr["Practical"] = marksPracticalSubjectDict[item.id]; // dr["Total"] = Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id]); // grandTotal = grandTotal + Convert.ToDouble(Convert.ToDouble(marksSubjectDict[item.id]) + Convert.ToDouble(marksPracticalSubjectDict[item.id])); // } } else { dr["Theory"] = string.Empty; dr["Practical"] = string.Empty; dr["Total"] = string.Empty; } dt.Rows.Add(dr); } grdMarksReport.DataSource = dt; grdMarksReport.DataBind(); //lblGrandTotal.Text = grandTotal.ToString(); //lblPercentage.Text = Math.Round(grandTotal / 5, 2) + "%"; //lblDiscipline.Text = gradesColTERM1.Where(x => x.subjectId == 71).FirstOrDefault().grade; //lblPunctuality.Text = gradesColTERM1.Where(x => x.subjectId == 67).FirstOrDefault().grade; //lblRespectToGender.Text = gradesColTERM1.Where(x => x.subjectId == 68).FirstOrDefault().grade; //lblAttitudeClassmates.Text = gradesColTERM1.Where(x => x.subjectId == 69).FirstOrDefault().grade; //lblAttitudeTeachers.Text = gradesColTERM1.Where(x => x.subjectId == 70).FirstOrDefault().grade; //lblAttendance.Text = remarksAttendance.attendance; //lblRemarks.Text = remarksAttendance.remarks; } } } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { //Creating Collection of StudentCL for storing multiple data entries provided by excel file. Collection <StudentCL> studentCol = new Collection <StudentCL>(); //Getting the CSV Location from session which is saved in temporary storage. string CSVLocation = Session["CSVLocation"].ToString(); //Reading All text string ReadCSV = File.ReadAllText(CSVLocation); //spliting row after new line foreach (string csvRow in ReadCSV.Split('\n')) { //Checking whether the data is empty. if (!string.IsNullOrEmpty(csvRow)) { //Creating StudentCL instance for storing single data entry in loop. StudentCL studentCL = new StudentCL(); //Creating studentCount variable for counting student data entries. int studentCount = 0; //Creating count variable for splitting data in columns. int count = 0; //Creating Address Count Varaible for splitting Address Column from other data. int AddressCount = 0; //Creating an array to split Address Column from Other Columns. string[] def = csvRow.Split('"'); //Checking whether Address field has commas with "" or not. if (def.Count() == 1) { //Loop for splitting the data and inputting the data in StudentCL intance. foreach (string FileRec in csvRow.Split(',')) { if (count == 0) { studentCL.admissionNo = Convert.ToInt32(FileRec); } if (count == 1) { studentCL.name = FileRec; } if (count == 2) { studentCL.fathersname = FileRec; } if (count == 3) { studentCL.mothername = FileRec; } if (count == 4) { studentCL.studentClass = FileRec.Remove(FileRec.Length - 1); studentCL.section = FileRec.Substring(FileRec.Length - 1); } if (count == 5) { studentCL.mobileNumber = Convert.ToInt64(FileRec); } if (count == 6) { bool gender = true; if (FileRec == "Male") { gender = true; } else { gender = false; } studentCL.gender = gender; } if (count == 7) { studentCL.address = FileRec; break; } count++; } } //Address field doesn't have commas and "". else { //Loop for splitting the data and inputting the data in StudentCL intance. foreach (string FileRec in def.Take(def.Length - 1)) { string[] abc = FileRec.Split(','); foreach (string x in abc.Take(abc.Length - 1)) { if (AddressCount != 0) { break; } if (count == 0) { studentCL.admissionNo = Convert.ToInt32(x); } if (count == 1) { studentCL.name = x; } if (count == 2) { studentCL.fathersname = x; } if (count == 3) { studentCL.mothername = x; } if (count == 4) { studentCL.studentClass = x.Remove(x.Length - 1); studentCL.section = x.Substring(x.Length - 1); } if (count == 5) { studentCL.mobileNumber = Convert.ToInt64(x); } if (count == 6) { bool gender = true; if (x == "Male") { gender = true; } else { gender = false; } studentCL.gender = gender; } count++; } if (AddressCount == 0) { AddressCount++; continue; } studentCL.address = FileRec; } } //Increasing the studentCount to input in Id Field to store multiple entries in Entity Framework. studentCount++; studentCL.dateCreated = DateTime.Now; studentCL.dateModified = DateTime.Now; studentCL.isDeleted = false; studentCL.id = studentCount; //Adding StudentCL instance in Collection instance. studentCol.Add(studentCL); } } //Sending the data to database from Collection data. int AddedStudents = backUserBLL.createStudentCollection(studentCol); //Redirecting to the same page on successful tranmission. Response.Redirect("CreateStudent.aspx"); } catch (Exception ex) { throw(new Exception(ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } imgLogo.ImageUrl = "logo.jpg"; lblStudentName.Text = studentCL.studentName; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; int ptId = reportBLL.viewExamIdByClass(studentCL.classId, "Avg of Best 2 PT(5)"); int maId = reportBLL.viewExamIdByClass(studentCL.classId, "MA2(5)"); int seaId = reportBLL.viewExamIdByClass(studentCL.classId, "SEA2(5)"); int portfolioId = reportBLL.viewExamIdByClass(studentCL.classId, "Portfolio2(5)"); int term1Id = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(20)"); int term2Id = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(60)"); int itTheoryId = reportBLL.viewExamIdByClass(studentCL.classId, "IT Theory(50)"); int itPracticalId = reportBLL.viewExamIdByClass(studentCL.classId, "IT Practical(50)"); int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL"); //int examinationId = Convert.ToInt32(Request.QueryString["examId"]); //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId); Collection <MarksEntryCL> marksPTCol = reportBLL.viewMarksByStudentId(studentId, ptId); Collection <MarksEntryCL> marksMACol = reportBLL.viewMarksByStudentId(studentId, maId); Collection <MarksEntryCL> marksSEACol = reportBLL.viewMarksByStudentId(studentId, seaId); Collection <MarksEntryCL> marksPortfolioCol = reportBLL.viewMarksByStudentId(studentId, portfolioId); Collection <MarksEntryCL> marksTERM1Col = reportBLL.viewMarksByStudentId(studentId, term1Id); Collection <MarksEntryCL> marksTERM2Col = reportBLL.viewMarksByStudentId(studentId, term2Id); Collection <MarksEntryCL> marksTheoryCol = reportBLL.viewMarksByStudentId(studentId, itTheoryId); Collection <MarksEntryCL> marksPracticalCol = reportBLL.viewMarksByStudentId(studentId, itPracticalId); Collection <GradeEntryCL> gradeCol = reportBLL.viewGradesByStudentId(studentId, term2GenExamId); lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; lblEnglishPT.Text = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishMA.Text = marksMACol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishSEA.Text = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishPortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTerm1.Text = marksTERM1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTerm2.Text = marksTERM2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTotal.Text = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishMA.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishPortfolio.Text) + Convert.ToDouble(lblEnglishTerm1.Text) + Convert.ToDouble(lblEnglishTerm2.Text)).ToString(); lblEnglishGrade.Text = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text)); lblHindiPT.Text = marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiMA.Text = marksMACol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiSEA.Text = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiPortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTerm1.Text = marksTERM1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTerm2.Text = marksTERM2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTotal.Text = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiMA.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiPortfolio.Text) + Convert.ToDouble(lblHindiTerm1.Text) + Convert.ToDouble(lblHindiTerm2.Text)).ToString(); lblHindiGrade.Text = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text)); lblMathematicsPT.Text = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsMA.Text = marksMACol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsSEA.Text = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsPortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTerm1.Text = marksTERM1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTerm2.Text = marksTERM2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTotal.Text = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsMA.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsPortfolio.Text) + Convert.ToDouble(lblMathematicsTerm1.Text) + Convert.ToDouble(lblMathematicsTerm2.Text)).ToString(); lblMathematicsGrade.Text = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text)); lblSciencePT.Text = marksPTCol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceMA.Text = marksMACol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceSEA.Text = marksSEACol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblSciencePortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceTerm1.Text = marksTERM1Col.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceTerm2.Text = marksTERM2Col.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceTotal.Text = (Convert.ToDouble(lblSciencePT.Text) + Convert.ToDouble(lblScienceMA.Text) + Convert.ToDouble(lblScienceSEA.Text) + Convert.ToDouble(lblSciencePortfolio.Text) + Convert.ToDouble(lblScienceTerm1.Text) + Convert.ToDouble(lblScienceTerm2.Text)).ToString(); lblScienceGrade.Text = ConvertToGrade(Convert.ToDouble(lblScienceTotal.Text)); lblSocialSciencePT.Text = marksPTCol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceMA.Text = marksMACol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceSEA.Text = marksSEACol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialSciencePortfolio.Text = marksPortfolioCol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceTerm1.Text = marksTERM1Col.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceTerm2.Text = marksTERM2Col.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceTotal.Text = (Convert.ToDouble(lblSocialSciencePT.Text) + Convert.ToDouble(lblSocialScienceMA.Text) + Convert.ToDouble(lblSocialScienceSEA.Text) + Convert.ToDouble(lblSocialSciencePortfolio.Text) + Convert.ToDouble(lblSocialScienceTerm1.Text) + Convert.ToDouble(lblSocialScienceTerm2.Text)).ToString(); lblSocialScienceGrade.Text = ConvertToGrade(Convert.ToDouble(lblSocialScienceTotal.Text)); lblITTheory.Text = marksTheoryCol.FirstOrDefault().marks; lblITPractical.Text = marksPracticalCol.FirstOrDefault().marks; lblITTotal.Text = (Convert.ToDouble(lblITTheory.Text) + Convert.ToDouble(lblITPractical.Text)).ToString(); lblITGrade.Text = ConvertToGrade(Convert.ToDouble(lblITTotal.Text)); lblGrandTotal.Text = Math.Ceiling(Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblScienceTotal.Text) + Convert.ToDouble(lblSocialScienceTotal.Text)).ToString(); lblPercentage.Text = Math.Ceiling(Convert.ToDouble(lblGrandTotal.Text) / 5).ToString(); lblGrade.Text = ConvertToGrade(Convert.ToDouble(lblPercentage.Text)).ToString(); lblArtEdu.Text = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade; lblWorkEdu.Text = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade; lblPhysicalEdu.Text = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade; } } } }
protected void btnImport_Click(object sender, EventArgs e) { int admissionNoError = 0; try { //Creating Collection of FeeExcelCL for storing multiple data entries provided by excel file. Collection <StudentCL> studentCol = new Collection <StudentCL>(); //Getting the CSV Location from session which is saved in temporary storage. string CSVLocation = Session["CSVLocation"].ToString(); //Reading All text string ReadCSV = File.ReadAllText(CSVLocation); //spliting row after new line foreach (string csvRow in ReadCSV.Split('\n')) { if (ReadCSV.IndexOf(csvRow) != 0) { //Checking whether the data is empty. if (!string.IsNullOrEmpty(csvRow)) { //Creating StudentCL instance for storing single data entry in loop. StudentCL studentCL = new StudentCL(); //Creating studentCount variable for counting student data entries. int feeCount = 0; //Creating count variable for splitting data in columns. int count = 0; //Storing Admission No for handling Exception and returning AdmissionNo. admissionNoError = Convert.ToInt32(csvRow.Split(',')[0]); //Loop for splitting the data and inputting the data in StudentCL intance. foreach (string FileRec in csvRow.Split(',')) { if (count == 0) { studentCL.admissionNo = Convert.ToInt32(FileRec); } if (count == 1) { studentCL.studentName = FileRec; } if (count == 2) { studentCL.fatherName = FileRec; } if (count == 3) { studentCL.motherName = FileRec; } if (count == 4) { studentCL.fatherMobileNumber = FileRec; } if (count == 5) { studentCL.gender = Convert.ToBoolean((FileRec == "1") ? "True" : "False"); } if (count == 6) { studentCL.dob = Convert.ToDateTime(FileRec + " 00:00"); } if (count == 7) { studentCL.address = FileRec; continue; } count++; } //Increasing the studentCount to input in Id Field to store multiple entries in Entity Framework. feeCount++; studentCL.dateCreated = DateTime.Now; studentCL.dateModified = DateTime.Now; studentCL.isDeleted = false; studentCL.id = feeCount; studentCL.aadharCardNo = string.Empty; studentCL.birthCertificate = string.Empty; studentCL.emailAddress = string.Empty; studentCL.studentCategoryId = Convert.ToInt32(ddlStudentcategory.SelectedValue); studentCL.classId = Convert.ToInt32(ddlClass.SelectedValue); studentCL.transferCertificate = string.Empty; //Adding StudentCL instance in Collection instance. studentCol.Add(studentCL); } } } int studentsCount = studentBLL.createupdateStudentCollection(studentCol); lblConfirm.Text = studentsCount + " Students Imported or Updated successfully. The page will refresh in 10 seconds"; Response.AppendHeader("Refresh", "10;url=ImportStudent.aspx"); } catch (Exception ex) { lblError.Text = "Error in Line with Admission No. " + admissionNoError; } }
protected void AddData() { DateTime dateHosting = DateTime.UtcNow; TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"); DateTime dateNow = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId); StudentCL studentCL = new StudentCL(); if (txtAadharCardNo.Text != string.Empty) { studentCL.aadharCardNo = txtAadharCardNo.Text; } else { studentCL.aadharCardNo = null; } studentCL.address = txtAddress.Text; studentCL.admissionNo = Convert.ToInt32(txtAdmissionNo.Text); studentCL.classId = Convert.ToInt32(ddlClass.SelectedValue); studentCL.dateCreated = dateNow; studentCL.dateModified = dateNow; studentCL.dob = Convert.ToDateTime(txtDOB.Text); if (txtEmailAddress.Text != string.Empty) { studentCL.emailAddress = txtEmailAddress.Text; } else { studentCL.emailAddress = null; } studentCL.fatherMobileNumber = txtMobileNumber.Text; studentCL.fatherName = txtFatherName.Text; studentCL.gender = Convert.ToBoolean(ddlGender.SelectedValue); studentCL.isDeleted = false; studentCL.motherName = txtMotherName.Text; bool exists = System.IO.Directory.Exists(Server.MapPath("Data/")); if (!exists) { System.IO.Directory.CreateDirectory(Server.MapPath("Data/")); } if (txtSiblingAdmissionNo.Text != string.Empty) { studentCL.siblingAdmissionNo = Convert.ToInt32(txtSiblingAdmissionNo.Text); } else { studentCL.siblingAdmissionNo = null; } studentCL.studentCategoryId = Convert.ToInt32(ddlStudentCategory.SelectedValue); studentCL.studentName = txtStudentName.Text; if (fuMisc1.HasFile) { string Misc1FilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + txtFileUpload1.Text + Path.GetExtension(fuMisc1.FileName); fuMisc1.PostedFile.SaveAs(Server.MapPath("Data/") + Misc1FilePath); studentCL.miscellaneous1Link = "http://www.rainbowjanakpuri.com/Student/Data/" + Misc1FilePath; studentCL.miscellaneous1Name = txtFileUpload1.Text; } if (fuMisc2.HasFile) { string Misc2FilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + txtFileUpload2.Text + Path.GetExtension(fuMisc2.FileName); fuMisc2.PostedFile.SaveAs(Server.MapPath("Data/") + Misc2FilePath); studentCL.miscellaneous2Link = "http://www.rainbowjanakpuri.com/Student/Data/" + Misc2FilePath; studentCL.miscellaneous2Name = txtFileUpload2.Text; } if (fuMisc3.HasFile) { string Misc3FilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + txtFileUpload3.Text + Path.GetExtension(fuMisc3.FileName); fuMisc3.PostedFile.SaveAs(Server.MapPath("Data/") + Misc3FilePath); studentCL.miscellaneous3Link = "http://www.rainbowjanakpuri.com/Student/Data/" + Misc3FilePath; studentCL.miscellaneous3Name = txtFileUpload3.Text; } if (fuTransferCertificate.HasFile) { string TCFilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + "TC" + Path.GetExtension(fuTransferCertificate.FileName); fuTransferCertificate.PostedFile.SaveAs(Server.MapPath("Data/") + TCFilePath); studentCL.transferCertificate = "http://www.rainbowjanakpuri.com/Student/Data/" + TCFilePath; } if (fuBirthCertificate.HasFile) { string BirthCertificateFilePath = txtAdmissionNo.Text + "-" + dateNow.ToString("yyyy-mm-dd") + "BirthCertificate" + Path.GetExtension(fuBirthCertificate.FileName); fuBirthCertificate.PostedFile.SaveAs(Server.MapPath("Data/") + BirthCertificateFilePath); studentCL.birthCertificate = "http://www.rainbowjanakpuri.com/Student/Data/" + BirthCertificateFilePath; } else { studentCL.birthCertificate = string.Empty; } studentCL.deletedTransferCertificate = null; int studentId = studentBLL.addStudent(studentCL); Response.Redirect("ManageStudent.aspx?studentId=" + studentId); }
protected void FetchControls() { sessionId = Convert.ToInt32(Session["sessionId"]); Collection <StudentCategoryCL> studentCategoryCol = studentCategoryBLL.viewStudentCategories(); Collection <ClassCL> classCol = classBLL.viewClasses(sessionId); if (Request.QueryString["studentId"] != null) { int studentId = Convert.ToInt32(Request.QueryString["studentId"]); StudentCL studentCL = studentBLL.viewStudentById(studentId, sessionId); lblHeading.Text = "Update Student"; ddlStudentCategory.DataSource = studentCategoryCol; ddlStudentCategory.DataValueField = "id"; ddlStudentCategory.DataTextField = "name"; ddlStudentCategory.DataBind(); ddlStudentCategory.SelectedValue = studentCL.studentCategoryId.ToString(); ddlClass.DataSource = classCol; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "classSection"; ddlClass.DataBind(); ddlClass.SelectedValue = studentCL.classId.ToString(); if (studentCL.aadharCardNo == null) { txtAadharCardNo.Enabled = false; } else { txtAadharCardNo.Text = studentCL.aadharCardNo; } txtAddress.Text = studentCL.address; txtAdmissionNo.Text = studentCL.admissionNo.ToString(); txtDateCreated.Text = studentCL.dateCreated.ToString("dd MMMM yyyy"); txtDateUpdated.Text = studentCL.dateModified.ToString("dd MMMM yyyy"); txtDOB.Text = studentCL.dob.ToString("yyyy-MM-dd"); txtEmailAddress.Text = studentCL.emailAddress; txtFatherName.Text = studentCL.fatherName; txtMobileNumber.Text = studentCL.fatherMobileNumber; txtMotherName.Text = studentCL.motherName; if (studentCL.siblingAdmissionNo == null) { txtSiblingAdmissionNo.Enabled = false; } else { txtSiblingAdmissionNo.Text = studentCL.siblingAdmissionNo.ToString(); } if (studentCL.miscellaneous1Link == null) { linkMisc1.Visible = false; } else { linkMisc1.Text = studentCL.miscellaneous1Name; linkMisc1.NavigateUrl = studentCL.miscellaneous1Link; } if (studentCL.miscellaneous2Link == null) { linkMisc2.Visible = false; } else { linkMisc2.Text = studentCL.miscellaneous2Name; linkMisc2.NavigateUrl = studentCL.miscellaneous2Link; } if (studentCL.miscellaneous3Link == null) { linkMisc3.Visible = false; } else { linkMisc3.Text = studentCL.miscellaneous3Name; linkMisc3.NavigateUrl = studentCL.miscellaneous3Link; } if (studentCL.transferCertificate == null) { linkTC.Visible = false; } else { linkTC.Text = studentCL.admissionNo + " - TransferCertificate"; linkTC.NavigateUrl = studentCL.transferCertificate; } if (studentCL.birthCertificate == null || studentCL.birthCertificate == string.Empty) { linkBirthC.Visible = false; } else { linkBirthC.Text = studentCL.admissionNo + " - Birth Cerificate"; linkBirthC.NavigateUrl = studentCL.birthCertificate; } txtStudentName.Text = studentCL.studentName; txtFileUpload1.Enabled = false; txtFileUpload2.Enabled = false; txtFileUpload3.Enabled = false; fuBirthCertificate.Enabled = false; fuMisc1.Enabled = false; fuMisc2.Enabled = false; fuMisc3.Enabled = false; fuTransferCertificate.Enabled = false; } else { lblHeading.Text = "Add Student"; linkBirthC.Visible = false; linkMisc1.Visible = false; linkMisc2.Visible = false; linkMisc3.Visible = false; linkTC.Visible = false; btnAadharEnable.Enabled = false; btnSiblingEnable.Enabled = false; ddlStudentCategory.DataSource = studentCategoryCol; ddlStudentCategory.DataValueField = "id"; ddlStudentCategory.DataTextField = "name"; ddlStudentCategory.DataBind(); ddlClass.DataSource = classCol; ddlClass.DataValueField = "id"; ddlClass.DataTextField = "classSection"; ddlClass.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } imgLogo.ImageUrl = "logo.jpg"; lblStudentName.Text = studentCL.studentName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1"); int term2ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2"); int ptId = reportBLL.viewExamIdByClass(studentCL.classId, "PT(30)"); int pt2Id = reportBLL.viewExamIdByClass(studentCL.classId, "PT2(30)"); int nsId = reportBLL.viewExamIdByClass(studentCL.classId, "NS(5)"); int ns2Id = reportBLL.viewExamIdByClass(studentCL.classId, "NS2(5)"); int seaId = reportBLL.viewExamIdByClass(studentCL.classId, "SEA(5)"); int sea2Id = reportBLL.viewExamIdByClass(studentCL.classId, "SEA2(5)"); int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL"); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId); //int examinationId = Convert.ToInt32(Request.QueryString["examId"]); //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksTerm1Col = reportBLL.viewMarksByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksPTCol = reportBLL.viewMarksByStudentId(studentId, ptId); Collection <MarksEntryCL> markNSsCol = reportBLL.viewMarksByStudentId(studentId, nsId); Collection <MarksEntryCL> marksSEACol = reportBLL.viewMarksByStudentId(studentId, seaId); Collection <GradeEntryCL> gradeCol = reportBLL.viewGradesByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksTerm2Col = reportBLL.viewMarksByStudentId(studentId, term2ExamId); Collection <MarksEntryCL> marksPT2Col = reportBLL.viewMarksByStudentId(studentId, pt2Id); Collection <MarksEntryCL> marksNS2Col = reportBLL.viewMarksByStudentId(studentId, ns2Id); Collection <MarksEntryCL> marksSEA2Col = reportBLL.viewMarksByStudentId(studentId, sea2Id); Collection <GradeEntryCL> grade2Col = reportBLL.viewGradesByStudentId(studentId, term2ExamId); lblEnglishPT.Text = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishPT2.Text = marksPT2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishNS.Text = markNSsCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishNS2.Text = marksNS2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishSEA.Text = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishSEA2.Text = marksSEA2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTerm2.Text = marksTerm2Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTotalTerm1.Text = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishNS.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishTerm1.Text)).ToString(); lblEnglishTotalTerm2.Text = (Convert.ToDouble(lblEnglishPT2.Text) + Convert.ToDouble(lblEnglishNS2.Text) + Convert.ToDouble(lblEnglishSEA2.Text) + Convert.ToDouble(lblEnglishTerm2.Text)).ToString(); lblEnglishTotal.Text = Math.Ceiling((Convert.ToDouble(lblEnglishTotalTerm1.Text) / 2) + (Convert.ToDouble(lblEnglishTotalTerm2.Text) / 2)).ToString(); lblEnglishGrade.Text = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text)); lblHindiPT.Text = Convert.ToDouble(marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks).ToString(); lblHindiPT2.Text = marksPT2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiNS.Text = markNSsCol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiNS2.Text = marksNS2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiSEA.Text = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiSEA2.Text = marksSEA2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTerm2.Text = marksTerm2Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTotalTerm1.Text = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiNS.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiTerm1.Text)).ToString(); lblHindiTotalTerm2.Text = (Convert.ToDouble(lblHindiPT2.Text) + Convert.ToDouble(lblHindiNS2.Text) + Convert.ToDouble(lblHindiSEA2.Text) + Convert.ToDouble(lblHindiTerm2.Text)).ToString(); lblHindiTotal.Text = Math.Ceiling((Convert.ToDouble(lblHindiTotalTerm1.Text) / 2) + (Convert.ToDouble(lblHindiTotalTerm2.Text) / 2)).ToString(); lblHindiGrade.Text = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text)); lblEVSPT.Text = marksPTCol.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSPT2.Text = marksPT2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSNS.Text = markNSsCol.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSNS2.Text = marksNS2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSSEA.Text = marksSEACol.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSSEA2.Text = marksSEA2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSTerm2.Text = marksTerm2Col.Where(x => x.subjectId == 117).FirstOrDefault().marks; lblEVSTotalTerm1.Text = (Convert.ToDouble(lblEVSPT.Text) + Convert.ToDouble(lblEVSNS.Text) + Convert.ToDouble(lblEVSSEA.Text) + Convert.ToDouble(lblEVSTerm1.Text)).ToString(); lblEVSTotalTerm2.Text = (Convert.ToDouble(lblEVSPT2.Text) + Convert.ToDouble(lblEVSNS2.Text) + Convert.ToDouble(lblEVSSEA2.Text) + Convert.ToDouble(lblEVSTerm2.Text)).ToString(); lblEVSTotal.Text = Math.Ceiling((Convert.ToDouble(lblEVSTotalTerm1.Text) / 2) + (Convert.ToDouble(lblEVSTotalTerm2.Text) / 2)).ToString(); lblEVSGrade.Text = ConvertToGrade(Convert.ToDouble(lblEVSTotal.Text)); lblMathematicsPT.Text = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsPT2.Text = marksPT2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsNS.Text = markNSsCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsNS2.Text = marksNS2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsSEA.Text = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsSEA2.Text = marksSEA2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTerm2.Text = marksTerm2Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTotalTerm1.Text = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsNS.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsTerm1.Text)).ToString(); lblMathematicsTotalTerm2.Text = (Convert.ToDouble(lblMathematicsPT2.Text) + Convert.ToDouble(lblMathematicsNS2.Text) + Convert.ToDouble(lblMathematicsSEA2.Text) + Convert.ToDouble(lblMathematicsTerm2.Text)).ToString(); lblMathematicsTotal.Text = Math.Ceiling((Convert.ToDouble(lblMathematicsTotalTerm1.Text) / 2) + (Convert.ToDouble(lblMathematicsTotalTerm2.Text) / 2)).ToString(); lblMathematicsGrade.Text = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text)); lblGKPT.Text = marksPTCol.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKPT2.Text = marksPT2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKNS.Text = markNSsCol.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKNS2.Text = marksNS2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKSEA.Text = marksSEACol.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKSEA2.Text = marksSEA2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKTerm2.Text = marksTerm2Col.Where(x => x.subjectId == 104).FirstOrDefault().marks; lblGKTotalTerm1.Text = (Convert.ToDouble(lblGKPT.Text) + Convert.ToDouble(lblGKNS.Text) + Convert.ToDouble(lblGKSEA.Text) + Convert.ToDouble(lblGKTerm1.Text)).ToString(); lblGKTotalTerm2.Text = (Convert.ToDouble(lblGKPT2.Text) + Convert.ToDouble(lblGKNS2.Text) + Convert.ToDouble(lblGKSEA2.Text) + Convert.ToDouble(lblGKTerm2.Text)).ToString(); lblGKTotal.Text = Math.Ceiling((Convert.ToDouble(lblGKTotalTerm1.Text) / 2) + (Convert.ToDouble(lblGKTotalTerm2.Text) / 2)).ToString(); lblGKGrade.Text = ConvertToGrade(Convert.ToDouble(lblGKTotal.Text)); lblArtEduTerm1.Text = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade; lblArtEduTerm2.Text = grade2Col.Where(x => x.subjectId == 52).FirstOrDefault().grade; lblWorkEduTerm1.Text = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade; lblWorkEduTerm2.Text = grade2Col.Where(x => x.subjectId == 51).FirstOrDefault().grade; lblPhysicalEduTerm1.Text = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade; lblPhysicalEduTerm2.Text = grade2Col.Where(x => x.subjectId == 53).FirstOrDefault().grade; lblRegularityTerm1.Text = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade; lblRegularityTerm2.Text = grade2Col.Where(x => x.subjectId == 67).FirstOrDefault().grade; lblSincerityTerm1.Text = gradeCol.Where(x => x.subjectId == 119).FirstOrDefault().grade; lblSincerityTerm2.Text = grade2Col.Where(x => x.subjectId == 119).FirstOrDefault().grade; lblBehaviourTerm1.Text = gradeCol.Where(x => x.subjectId == 120).FirstOrDefault().grade; lblBehaviourTerm2.Text = grade2Col.Where(x => x.subjectId == 120).FirstOrDefault().grade; lblAttitudeTeachersTerm1.Text = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade; lblAttitudeTeachersTerm2.Text = grade2Col.Where(x => x.subjectId == 70).FirstOrDefault().grade; lblAttitudeStudentsTerm1.Text = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade; lblAttitudeStudentsTerm2.Text = grade2Col.Where(x => x.subjectId == 69).FirstOrDefault().grade; lblGrade.Text = ConvertToGrade((Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblEVSTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblGKTotal.Text)) / 5); lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } //imgLogo.ImageUrl = "logo.jpg"; //lblStudentName.Text = studentCL.studentName; //lblFatherName.Text = studentCL.fatherName; //lblMotherName.Text = studentCL.motherName; //lblAdmissionNo.Text = studentCL.admissionNo.ToString(); //lblClassSec.Text = studentCL.classSection; int ut1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 1"); int ut2ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 2"); int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1"); int term2ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "ANNUAL(100)"); Collection <SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksColUT1 = reportBLL.viewMarksByStudentId(studentId, ut1ExamId); Collection <MarksEntryCL> marksColUT2 = reportBLL.viewMarksByStudentId(studentId, ut2ExamId); Collection <MarksEntryCL> marksColTERM1 = reportBLL.viewMarksByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksColTERM2 = reportBLL.viewMarksByStudentId(studentId, term2ExamId); Collection <GradeEntryCL> gradesColTERM2 = reportBLL.viewGradesByStudentId(studentId, term2ExamId); int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL"); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId); for (int i = 54; i <= 71; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 116); var subjectColl = subjectCol.OrderBy(x => x.name); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("Subjects", typeof(string))); dt.Columns.Add(new DataColumn("Max. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Min. Marks", typeof(int))); dt.Columns.Add(new DataColumn("UT-1", typeof(string))); dt.Columns.Add(new DataColumn("Term-1 Practical", typeof(string))); dt.Columns.Add(new DataColumn("Term-1 Theory", typeof(string))); dt.Columns.Add(new DataColumn("UT-2", typeof(string))); dt.Columns.Add(new DataColumn("Annual Practical", typeof(string))); dt.Columns.Add(new DataColumn("Annual Theory", typeof(string))); dt.Columns.Add(new DataColumn("Obtained Marks Practical", typeof(string))); dt.Columns.Add(new DataColumn("Obtained Marks Theory", typeof(string))); IDictionary <int, string> marksSubjectDictUT1 = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictUT2 = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM1 = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalSubjectDictTERM1 = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM2 = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalSubjectDictTERM2 = new Dictionary <int, string>(); foreach (MarksEntryCL item in marksColUT1) { if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14) { marksSubjectDictUT1.Add(item.subjectId, item.marks); } else { marksSubjectDictUT1.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColUT2) { if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14) { marksSubjectDictUT2.Add(item.subjectId, item.marks); } else { marksSubjectDictUT2.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColTERM1) { if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, string.Empty); } if (item.subjectId == 14) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 66)); } if (item.subjectId == 2) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 55)); } if (item.subjectId == 3) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 56)); } if (item.subjectId == 4) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 57)); } if (item.subjectId == 5) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 58)); } if (item.subjectId == 6) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 59)); } if (item.subjectId == 15) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 60)); } if (item.subjectId == 7) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 61)); } if (item.subjectId == 11) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 62)); } if (item.subjectId == 9) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 63)); } if (item.subjectId == 8) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 64)); } if (item.subjectId == 10) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 65)); } if (item.subjectId == 115) { marksSubjectDictTERM1.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM1.Add(item.subjectId, CheckSubjectInCol(marksColTERM1, 116)); } } foreach (MarksEntryCL item in marksColTERM2) { if (item.subjectId != 2 && item.subjectId != 3 && item.subjectId != 4 && item.subjectId != 5 && item.subjectId != 6 && item.subjectId != 15 && item.subjectId != 7 && item.subjectId != 11 && item.subjectId != 9 && item.subjectId != 8 && item.subjectId != 10 && item.subjectId != 14 && item.subjectId != 115) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, string.Empty); } if (item.subjectId == 14) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 66)); } if (item.subjectId == 2) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 55)); } if (item.subjectId == 3) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 56)); } if (item.subjectId == 4) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 57)); } if (item.subjectId == 5) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 58)); } if (item.subjectId == 6) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 59)); } if (item.subjectId == 15) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 60)); } if (item.subjectId == 7) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 61)); } if (item.subjectId == 11) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 62)); } if (item.subjectId == 9) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 63)); } if (item.subjectId == 8) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 64)); } if (item.subjectId == 10) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 65)); } if (item.subjectId == 115) { marksSubjectDictTERM2.Add(item.subjectId, item.marks); marksPracticalSubjectDictTERM2.Add(item.subjectId, CheckSubjectInCol(marksColTERM2, 116)); } } double grandTotal = 0; foreach (SubjectCL item in subjectCol) { dr = dt.NewRow(); dr["Subjects"] = item.name; dr["Max. Marks"] = 240; dr["Min. Marks"] = 96; if ((marksSubjectDictUT1.ContainsKey(item.id) && marksSubjectDictTERM1.ContainsKey(item.id) && marksSubjectDictUT2.ContainsKey(item.id) && marksSubjectDictTERM2.ContainsKey(item.id))) { double grandTotalTheory = 0; double grandTotalPractical = 0; if (marksSubjectDictUT1.ContainsKey(item.id)) { //dr["UT-1"] = marksSubjectDictUT1[item.id]; //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictUT1[item.id]); } else { dr["UT-1"] = string.Empty; } if (marksSubjectDictTERM1.ContainsKey(item.id)) { if (marksPracticalSubjectDictTERM1[item.id] == string.Empty) { //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictTERM1[item.id]); } else { //dr["Term-1 Practical"] = marksPracticalSubjectDictTERM1[item.id]; //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictTERM1[item.id]); //grandTotalPractical = grandTotalPractical + Convert.ToDouble(marksPracticalSubjectDictTERM1[item.id]); } dr["Term-1 Theory"] = marksSubjectDictTERM1[item.id]; } else { dr["Term-1 Practical"] = string.Empty; dr["Term-1 Theory"] = string.Empty; } if (marksSubjectDictUT2.ContainsKey(item.id)) { //dr["UT-2"] = marksSubjectDictUT2[item.id]; //grandTotalTheory = grandTotalTheory + Convert.ToDouble(marksSubjectDictUT2[item.id]); } else { dr["UT-2"] = string.Empty; } if (marksSubjectDictTERM2.ContainsKey(item.id)) { if (marksPracticalSubjectDictTERM2[item.id] == string.Empty) { //grandTotalTheory = grandTotalTheory + (Convert.ToDouble(marksSubjectDictTERM2[item.id])); } else { //dr["Annual Practical"] = marksPracticalSubjectDictTERM2[item.id]; //grandTotalTheory = grandTotalTheory + (Convert.ToDouble(marksSubjectDictTERM2[item.id])); //grandTotalPractical = grandTotalPractical + (Convert.ToDouble(marksPracticalSubjectDictTERM2[item.id])); } //dr["Annual Theory"] = marksSubjectDictTERM2[item.id]; } else { dr["Annual Practical"] = string.Empty; dr["Annual Theory"] = string.Empty; } //if (grandTotalPractical != 0) // dr["Obtained Marks Practical"] = grandTotalPractical; //dr["Obtained Marks Theory"] = grandTotalTheory; //grandTotal = grandTotal + grandTotalTheory + grandTotalPractical; } else { dr["UT-1"] = string.Empty; dr["Term-1 Practical"] = string.Empty; dr["Term-1 Theory"] = string.Empty; dr["UT-2"] = string.Empty; dr["Annual Practical"] = string.Empty; dr["Annual Theory"] = string.Empty; dr["Obtained Marks Practical"] = string.Empty; dr["Obtained Marks Theory"] = string.Empty; } dt.Rows.Add(dr); } grdMarksReport.DataSource = dt; grdMarksReport.DataBind(); //lblGrandTotal.Text = grandTotal.ToString(); //lblPercentage.Text = (grandTotal / 12).ToString() + "%"; //lblDiscipline.Text = gradesColTERM2.Where(x => x.subjectId == 71).FirstOrDefault().grade; //lblPunctuality.Text = gradesColTERM2.Where(x => x.subjectId == 67).FirstOrDefault().grade; //lblRespectToGender.Text = gradesColTERM2.Where(x => x.subjectId == 68).FirstOrDefault().grade; //lblAttitudeClassmates.Text = gradesColTERM2.Where(x => x.subjectId == 69).FirstOrDefault().grade; //lblAttitudeTeachers.Text = gradesColTERM2.Where(x => x.subjectId == 70).FirstOrDefault().grade; //lblAttendance.Text = remarksAttendance.attendance; //lblRemarks.Text = remarksAttendance.remarks; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } imgLogo.ImageUrl = "logo.jpg"; lblStudentName.Text = studentCL.studentName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1"); int ptId = reportBLL.viewExamIdByClass(studentCL.classId, "PT(10)"); int nsId = reportBLL.viewExamIdByClass(studentCL.classId, "NS(5)"); int seaId = reportBLL.viewExamIdByClass(studentCL.classId, "SEA(5)"); //int examinationId = Convert.ToInt32(Request.QueryString["examId"]); //Collection<SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksTerm1Col = reportBLL.viewMarksByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksPTCol = reportBLL.viewMarksByStudentId(studentId, ptId); Collection <MarksEntryCL> markNSsCol = reportBLL.viewMarksByStudentId(studentId, nsId); Collection <MarksEntryCL> marksSEACol = reportBLL.viewMarksByStudentId(studentId, seaId); Collection <GradeEntryCL> gradeCol = reportBLL.viewGradesByStudentId(studentId, term1ExamId); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term1ExamId); try { lblEnglishPT.Text = marksPTCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishNS.Text = markNSsCol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishSEA.Text = marksSEACol.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 0).FirstOrDefault().marks; lblEnglishTotal.Text = (Convert.ToDouble(lblEnglishPT.Text) + Convert.ToDouble(lblEnglishNS.Text) + Convert.ToDouble(lblEnglishSEA.Text) + Convert.ToDouble(lblEnglishTerm1.Text)).ToString(); lblEnglishGrade.Text = ConvertToGrade(Convert.ToDouble(lblEnglishTotal.Text)); lblHindiPT.Text = marksPTCol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiNS.Text = markNSsCol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiSEA.Text = marksSEACol.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 13).FirstOrDefault().marks; lblHindiTotal.Text = (Convert.ToDouble(lblHindiPT.Text) + Convert.ToDouble(lblHindiNS.Text) + Convert.ToDouble(lblHindiSEA.Text) + Convert.ToDouble(lblHindiTerm1.Text)).ToString(); lblHindiGrade.Text = ConvertToGrade(Convert.ToDouble(lblHindiTotal.Text)); lblSanskritPT.Text = marksPTCol.Where(x => x.subjectId == 46).FirstOrDefault().marks; lblSanskritNS.Text = markNSsCol.Where(x => x.subjectId == 46).FirstOrDefault().marks; lblSanskritSEA.Text = marksSEACol.Where(x => x.subjectId == 46).FirstOrDefault().marks; lblSanskritTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 46).FirstOrDefault().marks; lblSanskritTotal.Text = (Convert.ToDouble(lblSanskritPT.Text) + Convert.ToDouble(lblSanskritNS.Text) + Convert.ToDouble(lblSanskritSEA.Text) + Convert.ToDouble(lblSanskritTerm1.Text)).ToString(); lblSanskritGrade.Text = ConvertToGrade(Convert.ToDouble(lblSanskritTotal.Text)); lblSciencePT.Text = marksPTCol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceNS.Text = markNSsCol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceSEA.Text = marksSEACol.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 29).FirstOrDefault().marks; lblScienceTotal.Text = (Convert.ToDouble(lblSciencePT.Text) + Convert.ToDouble(lblScienceNS.Text) + Convert.ToDouble(lblScienceSEA.Text) + Convert.ToDouble(lblScienceTerm1.Text)).ToString(); lblScienceGrade.Text = ConvertToGrade(Convert.ToDouble(lblScienceTotal.Text)); lblSocialSciencePT.Text = marksPTCol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceNS.Text = markNSsCol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceSEA.Text = marksSEACol.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 35).FirstOrDefault().marks; lblSocialScienceTotal.Text = (Convert.ToDouble(lblSocialSciencePT.Text) + Convert.ToDouble(lblSocialScienceNS.Text) + Convert.ToDouble(lblSocialScienceSEA.Text) + Convert.ToDouble(lblSocialScienceTerm1.Text)).ToString(); lblSocialScienceGrade.Text = ConvertToGrade(Convert.ToDouble(lblSocialScienceTotal.Text)); lblMathematicsPT.Text = marksPTCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsNS.Text = markNSsCol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsSEA.Text = marksSEACol.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 1).FirstOrDefault().marks; lblMathematicsTotal.Text = (Convert.ToDouble(lblMathematicsPT.Text) + Convert.ToDouble(lblMathematicsNS.Text) + Convert.ToDouble(lblMathematicsSEA.Text) + Convert.ToDouble(lblMathematicsTerm1.Text)).ToString(); lblMathematicsGrade.Text = ConvertToGrade(Convert.ToDouble(lblMathematicsTotal.Text)); lblCSPT.Text = marksPTCol.Where(x => x.subjectId == 6).FirstOrDefault().marks; lblCSNS.Text = markNSsCol.Where(x => x.subjectId == 6).FirstOrDefault().marks; lblCSSEA.Text = marksSEACol.Where(x => x.subjectId == 6).FirstOrDefault().marks; lblCSTerm1.Text = marksTerm1Col.Where(x => x.subjectId == 6).FirstOrDefault().marks; lblCSTotal.Text = (Convert.ToDouble(lblCSPT.Text) + Convert.ToDouble(lblCSNS.Text) + Convert.ToDouble(lblCSSEA.Text) + Convert.ToDouble(lblCSTerm1.Text)).ToString(); lblCSGrade.Text = ConvertToGrade(Convert.ToDouble(lblCSTotal.Text)); lblArtEdu.Text = gradeCol.Where(x => x.subjectId == 52).FirstOrDefault().grade; lblWorkEdu.Text = gradeCol.Where(x => x.subjectId == 51).FirstOrDefault().grade; lblPhysicalEdu.Text = gradeCol.Where(x => x.subjectId == 53).FirstOrDefault().grade; lblRegularity.Text = gradeCol.Where(x => x.subjectId == 67).FirstOrDefault().grade; lblSincerity.Text = gradeCol.Where(x => x.subjectId == 119).FirstOrDefault().grade; lblBehaviour.Text = gradeCol.Where(x => x.subjectId == 120).FirstOrDefault().grade; lblAttitudeTeachers.Text = gradeCol.Where(x => x.subjectId == 70).FirstOrDefault().grade; lblAttitudeStudents.Text = gradeCol.Where(x => x.subjectId == 69).FirstOrDefault().grade; lblGrade.Text = ConvertToGrade((Convert.ToDouble(lblScienceTotal.Text) + Convert.ToDouble(lblSocialScienceTotal.Text) + Convert.ToDouble(lblEnglishTotal.Text) + Convert.ToDouble(lblHindiTotal.Text) + Convert.ToDouble(lblSanskritTotal.Text) + Convert.ToDouble(lblMathematicsTotal.Text) + Convert.ToDouble(lblCSTotal.Text)) / 7); lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; } catch (Exception) { throw; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("../index.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } lblStudentName.Text = studentCL.studentName; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; int utExamId = reportBLL.viewExamIdByClass(studentCL.classId, "UT(40)"); int utNewExamId = reportBLL.viewExamIdByClass(studentCL.classId, "UT(5)"); int term1ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(Original)"); int term1NewExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 1(Reduced)"); int term2ExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(Original)"); int term2NewExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2(Reduced)"); int term2GenExamId = reportBLL.viewExamIdByClass(studentCL.classId, "TERM 2 - GENERAL"); Collection <SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksColUT = reportBLL.viewMarksByStudentId(studentId, utExamId); Collection <MarksEntryCL> marksColTERM1 = reportBLL.viewMarksByStudentId(studentId, term1ExamId); Collection <MarksEntryCL> marksColTERM2 = reportBLL.viewMarksByStudentId(studentId, term2ExamId); Collection <MarksEntryCL> marksColUTNew = reportBLL.viewMarksByStudentId(studentId, utNewExamId); Collection <MarksEntryCL> marksColTERM1New = reportBLL.viewMarksByStudentId(studentId, term1NewExamId); Collection <MarksEntryCL> marksColTERM1Copy = marksColTERM1New; Collection <MarksEntryCL> marksColTERM2New = reportBLL.viewMarksByStudentId(studentId, term2NewExamId); Collection <MarksEntryCL> marksColTERM2Copy = marksColTERM2New; Collection <GradeEntryCL> gradesColTERM2 = reportBLL.viewGradesByStudentId(studentId, term2GenExamId); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, term2GenExamId); for (int i = 55; i <= 66; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 121); DeletePractical(subjectCol, 122); for (int i = 145; i <= 149; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 122); for (int i = 67; i <= 71; i++) { DeletePractical(subjectCol, i); } var subjectColl = subjectCol.OrderBy(x => x.name); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("Subjects", typeof(string))); dt.Columns.Add(new DataColumn("UT(40)\nUT1+UT2", typeof(string))); dt.Columns.Add(new DataColumn("Term 1\n[Theory]\n(60/70/80)", typeof(string))); dt.Columns.Add(new DataColumn("Term 2\n[Theory]\n(60/70/80)", typeof(string))); dt.Columns.Add(new DataColumn("UT(5)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Term 1\n[Theory]\n(10/15/20)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Term 2\n[Theory]\n(45/50/55)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Total Weightage\n(60/70/80)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Practical\n[Term 1]\n(5/10/15)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Practical\n[Term 2]\n(15/25/30)\n*", typeof(string))); dt.Columns.Add(new DataColumn("Total\n(Th+Pr)\n*", typeof(string))); IDictionary <int, string> marksSubjectDictUTOld = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictUTNew = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM1Old = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM2Old = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictNew = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM1New = new Dictionary <int, string>(); IDictionary <int, string> marksSubjectDictTERM2New = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalTERM1SubjectDictNew = new Dictionary <int, string>(); IDictionary <int, string> marksPracticalTERM2SubjectDictNew = new Dictionary <int, string>(); int count = 0; foreach (MarksEntryCL item in marksColUT) { if (item.subjectName == "Physics(042)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Biology(044)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Economics(030)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "History(027)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "English(301)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } else { marksSubjectDictUTOld.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColUTNew) { if (item.subjectName == "Physics(042)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Biology(044)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Economics(030)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "History(027)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "English(301)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictUTNew.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColTERM1) { if (item.subjectName == "Physics(042)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Biology(044)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Economics(030)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "History(027)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "English(301)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } else { marksSubjectDictTERM1Old.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColTERM1New) { if (item.subjectName == "Physics(042)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 55)); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 56)); } else if (item.subjectName == "Biology(044)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 57)); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 58)); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 59)); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 60)); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 61)); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 62)); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 63)); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 64)); } else if (item.subjectName == "Economics(030)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 65)); } else if (item.subjectName == "History(027)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 66)); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 121)); } else if (item.subjectName == "English(301)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 145)); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 146)); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 147)); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM1Copy, 148)); } else { marksSubjectDictTERM1New.Add(item.subjectId, item.marks); marksPracticalTERM1SubjectDictNew.Add(item.subjectId, string.Empty); } } foreach (MarksEntryCL item in marksColTERM2) { if (item.subjectName == "Physics(042)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Biology(044)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Economics(030)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "History(027)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "English(301)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } else { marksSubjectDictTERM2Old.Add(item.subjectId, item.marks); } } foreach (MarksEntryCL item in marksColTERM2New) { if (item.subjectName == "Physics(042)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 55)); } else if (item.subjectName == "Chemistry(043)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 56)); } else if (item.subjectName == "Biology(044)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 57)); } else if (item.subjectName == "Engineering Graphics(046)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 58)); } else if (item.subjectName == "Computer Science(083)" || item.subjectName == "Computer Science(283)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 59)); } else if (item.subjectName == "Physical Education(048)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 60)); } else if (item.subjectName == "Psychology(037)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 61)); } else if (item.subjectName == "Marketing(783)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 62)); } else if (item.subjectName == "Business Studies(054)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 63)); } else if (item.subjectName == "Accountancy(055)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 64)); } else if (item.subjectName == "Economics(030)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 65)); } else if (item.subjectName == "History(027)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 66)); } else if (item.subjectName == "Hindi(302)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 121)); } else if (item.subjectName == "English(301)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 145)); } else if (item.subjectName == "Political Science(028)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 146)); } else if (item.subjectName == "Mathematics(041)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 147)); } else if (item.subjectName == "Information Practices(065)" || item.subjectName == "Information Practices(265)") { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, CheckSubjectInCol(marksColTERM2Copy, 148)); } else { marksSubjectDictTERM2New.Add(item.subjectId, item.marks); marksPracticalTERM2SubjectDictNew.Add(item.subjectId, string.Empty); } } double grandTotal = 0; foreach (SubjectCL item in subjectCol) { double theory = 0; double total = 0; dr = dt.NewRow(); dr["Subjects"] = item.name; if (marksSubjectDictUTOld.ContainsKey(item.id) || marksSubjectDictUTNew.ContainsKey(item.id) || marksSubjectDictTERM1Old.ContainsKey(item.id) || marksSubjectDictTERM1New.ContainsKey(item.id) || marksSubjectDictTERM2Old.ContainsKey(item.id) || marksSubjectDictTERM2New.ContainsKey(item.id)) { if (marksSubjectDictUTOld.ContainsKey(item.id)) { count++; dr["UT(40)\nUT1+UT2"] = Convert.ToDouble(marksSubjectDictUTOld[item.id]); } if (marksSubjectDictTERM1Old.ContainsKey(item.id)) { count++; dr["Term 1\n[Theory]\n(60/70/80)"] = marksSubjectDictTERM1Old[item.id]; } if (marksSubjectDictUTNew.ContainsKey(item.id)) { count++; dr["UT(5)\n*"] = marksSubjectDictUTNew[item.id]; theory = theory + Convert.ToDouble(marksSubjectDictUTNew[item.id]); } if (marksSubjectDictTERM1New.ContainsKey(item.id)) { count++; dr["Term 1\n[Theory]\n(10/15/20)\n*"] = marksSubjectDictTERM1New[item.id]; theory = theory + Convert.ToDouble(marksSubjectDictTERM1New[item.id]); dr["Practical\n[Term 1]\n(5/10/15)\n*"] = marksPracticalTERM1SubjectDictNew[item.id]; total = total + Convert.ToDouble(marksPracticalTERM1SubjectDictNew[item.id]); } if (marksSubjectDictTERM2Old.ContainsKey(item.id)) { count++; dr["Term 2\n[Theory]\n(60/70/80)"] = marksSubjectDictTERM2Old[item.id]; } if (marksSubjectDictTERM2New.ContainsKey(item.id)) { count++; dr["Term 2\n[Theory]\n(45/50/55)\n*"] = marksSubjectDictTERM2New[item.id]; theory = theory + Convert.ToDouble(marksSubjectDictTERM2New[item.id]); dr["Practical\n[Term 2]\n(15/25/30)\n*"] = marksPracticalTERM2SubjectDictNew[item.id]; total = total + Convert.ToDouble(marksPracticalTERM2SubjectDictNew[item.id]); } dr["Total Weightage\n(60/70/80)\n*"] = theory; total = total + theory; grandTotal = grandTotal + total; dr["Total\n(Th+Pr)\n*"] = total; } else { dr["UT(40)\nUT1+UT2"] = string.Empty; dr["Term 1\n[Theory]\n(60/70/80)"] = string.Empty; dr["Term 2\n[Theory]\n(60/70/80)"] = string.Empty; dr["UT(5)\n*"] = string.Empty; dr["Term 1\n[Theory]\n(10/15/20)\n*"] = string.Empty; dr["Term 2\n[Theory]\n(45/50/55)\n*"] = string.Empty; dr["Total Weightage\n(60/70/80)\n*"] = string.Empty; dr["Practical\n[Term 1]\n(5/10/15)\n*"] = string.Empty; dr["Practical\n[Term 2]\n(15/25/30)\n*"] = string.Empty; dr["Total\n(Th+Pr)\n*"] = string.Empty; } dt.Rows.Add(dr); } grdMarksReport.DataSource = dt; grdMarksReport.DataBind(); lblGrandTotal.Text = grandTotal.ToString(); lblPercentage.Text = Math.Round(grandTotal / 5, 2) + "%"; try { lblPunctuality.Text = gradesColTERM2.Where(x => x.subjectId == 67).FirstOrDefault().grade; lblValueSystem.Text = gradesColTERM2.Where(x => x.subjectId == 70).FirstOrDefault().grade; lblDiscipline.Text = gradesColTERM2.Where(x => x.subjectId == 71).FirstOrDefault().grade; } catch (Exception ex) { throw(ex); } lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("index.aspx"); } else { if (Session["sessionId"] == null) { SessionCL sessionCL = sessionBLL.addorCheckSession(); Session["sessionId"] = sessionCL.id; } else { sessionId = Convert.ToInt32(Session["sessionId"]); int studentId = 0; StudentCL studentCL = new StudentCL(); studentId = Convert.ToInt32(Request.QueryString["studentId"]); if (studentId != 0) { studentId = Convert.ToInt32(Request.QueryString["studentId"]); studentCL = studentBLL.viewStudentById(studentId, sessionId); } else { studentId = Convert.ToInt32(Request.QueryString["admNo"]); studentCL = studentBLL.viewStudentByAdmissionNo(studentId, sessionId); studentId = studentCL.id; } lblStudentName.Text = studentCL.studentName; lblFatherName.Text = studentCL.fatherName; lblMotherName.Text = studentCL.motherName; lblAdmissionNo.Text = studentCL.admissionNo.ToString(); lblClassSec.Text = studentCL.classSection; int examinationId = reportBLL.viewExamIdByClass(studentCL.classId, "UNIT 2"); Collection <SubjectCL> subjectCol = subjectBLL.viewSubjectByClassId(studentCL.classId); Collection <MarksEntryCL> marksCol = reportBLL.viewMarksByStudentId(studentId, examinationId); MiscEntryCL remarksAttendance = reportBLL.viewMiscByStudentId(studentId, examinationId); lblAttendance.Text = remarksAttendance.attendance; lblRemarks.Text = remarksAttendance.remarks; var subjectColl = subjectCol.OrderBy(x => x.name); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("Subjects", typeof(string))); dt.Columns.Add(new DataColumn("Max. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Min. Marks", typeof(int))); dt.Columns.Add(new DataColumn("Obtained Marks", typeof(string))); IDictionary <int, string> marksSubjectDict = new Dictionary <int, string>(); foreach (MarksEntryCL item in marksCol) { marksSubjectDict.Add(item.subjectId, item.marks); } double grandTotal = 0; for (int i = 54; i <= 71; i++) { DeletePractical(subjectCol, i); } DeletePractical(subjectCol, 116); DeletePractical(subjectCol, 121); DeletePractical(subjectCol, 122); for (int i = 143; i <= 150; i++) { DeletePractical(subjectCol, i); } foreach (SubjectCL item in subjectCol) { dr = dt.NewRow(); dr["Subjects"] = item.name; dr["Max. Marks"] = 20; dr["Min. Marks"] = 8; if (marksSubjectDict.ContainsKey(item.id)) { dr["Obtained Marks"] = marksSubjectDict[item.id]; grandTotal = grandTotal + Convert.ToDouble(marksSubjectDict[item.id]); } else { dr["Obtained Marks"] = string.Empty; } dt.Rows.Add(dr); } grdMarksReport.DataSource = dt; grdMarksReport.DataBind(); lblGrandTotal.Text = grandTotal.ToString(); lblPercentage.Text = grandTotal + "%"; } } } } }