protected void btnSave_Click(object sender, EventArgs e) { TblProgramFee obj = new TblProgramFee(); obj.IsNew = true; if (!string.IsNullOrEmpty(hdnScholarshipID.Value)) { obj = new TblProgramFee(hdnScholarshipID.Value); obj.IsNew = false; } obj.Program = DDProgName.SelectedValue; obj.TotalFee = Convert.ToInt32(txtTotalFee.Text); obj.TuitionFee = Convert.ToInt32(txtTuitionFee.Text); obj.Mise = Convert.ToInt32(txtMisc.Text); obj.AdmissionFee = Convert.ToInt32(txtAdmissionFee.Text); obj.Save(); hdnScholarshipID.Value = null; helper.ClearInputs(this.Page.Controls); }
public void Search(string AdmissionNO) { bool ESchchecked = false; string E_scholarShip = null; DataTable dt = SPs.SpSearchStudentForclgFeeEnrollment(AdmissionNO, Convert.ToInt32(Session["BranchID"]), 2).GetDataSet().Tables[0]; if (dt.Rows.Count > 0) { if (!String.IsNullOrEmpty(dt.Rows[0]["Enrollement"].ToString())) { BasciInfo.Visible = true; lblStudentName.Text = dt.Rows[0]["StudentName"].ToString(); lblProgram.Text = dt.Rows[0]["Program"].ToString(); DataTable dtClgFee = helper.ExecutePlainQuery("select * from tbl_ClgFeeStructure where StudentID=" + dt.Rows[0]["StudentID"]); if (dtClgFee.Rows.Count > 0) { totalFee = Convert.ToInt32(dtClgFee.Rows[0]["PreviousTotalFee"]); AdmissionFee = Convert.ToInt32(dtClgFee.Rows[0]["AdmissionFee"]); Misc = Convert.ToInt32(dtClgFee.Rows[0]["Misc"]); TutionFee = Convert.ToInt32(dtClgFee.Rows[0]["TutionFee"]); txtAdvance.Text = dtClgFee.Rows[0]["Advance"].ToString(); txtDiscount.Text = dtClgFee.Rows[0]["Discount"].ToString(); btnSave.Text = "Update"; hfclgFeeID.Value = dtClgFee.Rows[0]["FeeID"].ToString(); GetScholarShip(ref ESchchecked, ref E_scholarShip, dtClgFee); } else { TblProgramFee obj = new TblProgramFee(TblProgramFee.Columns.Program, lblProgram.Text); if (!String.IsNullOrEmpty(obj.Program)) { totalFee = Convert.ToInt32(obj.TotalFee); AdmissionFee = Convert.ToInt32(obj.AdmissionFee); Misc = Convert.ToInt32(obj.Mise); TutionFee = Convert.ToInt32(obj.TuitionFee); } } lblTotalFee.Text = totalFee.ToString("#,##"); lblAdmissionFee.Text = AdmissionFee.ToString("#,##"); lblMisc.Text = Misc.ToString("#,##"); lblTutionFee.Text = TutionFee.ToString("#,##"); DataTable dtAc = helper.ExecutePlainQuery("SELECT * from TblStudentAcademicRecord where StudentID='" + dt.Rows[0]["StudentID"].ToString() + "' and ARecordID=(Select MAX(ARecordID) from TblStudentAcademicRecord where StudentID='" + dt.Rows[0]["StudentID"].ToString() + "')"); TotalMarks = Convert.ToInt32(dtAc.Rows[0]["totalmarks"]); ObtainedMarks = Convert.ToInt32(dtAc.Rows[0]["ObtainedMarks"]); lblAdmissionPlusMisc.Text = (AdmissionFee + Misc).ToString("#,##"); CalculateFee(); Percentage = Convert.ToInt32((ObtainedMarks / TotalMarks) * 100); lblpercentage.Text = Convert.ToString((ObtainedMarks / TotalMarks) * 100); if (lblpercentage.Text.Length > 4) { lblpercentage.Text = lblpercentage.Text.Substring(0, 4); } if (Percentage >= 85) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = "Free"; } Highlight(trFree); } else if (Percentage >= 80 && Percentage <= 84) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = Misc.ToString(); } Highlight(trMiscOnly); } else if (Percentage >= 75 && Percentage <= 79) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = AdmissionFee.ToString(); } Highlight(trAdmssion); } else if (Percentage >= 70 && Percentage <= 74) { SectionScholarShips.Visible = false; SectionScholarShipsHeading.Visible = false; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc).ToString(); } Highlight(trAdmissionMisc); } else if (Percentage >= 65 && Percentage <= 69) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 80 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr80); } else if (Percentage >= 60 && Percentage <= 64) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 60 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr60); } else if (Percentage >= 55 && Percentage <= 59) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 40 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr40); } else if (Percentage >= 50 && Percentage <= 54) { SectionScholarShips.Visible = true; SectionScholarShipsHeading.Visible = true; CalculateTutionFee = TutionFee * 20 / 100; TutionFee = TutionFee - CalculateTutionFee; if (String.IsNullOrEmpty(hfclgFeeID.Value)) { txtTotal.Text = (AdmissionFee + Misc + TutionFee).ToString(); } Highlight(tr20); } tempTutionFee = TutionFee; } else { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, dt.Rows[0]["StudentName"] + " is not enrolled yet!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } } else { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, "No record found!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-close-circle-o"); } }