protected void rptBreakdown_ItemDataBound(object sender, RepeaterItemEventArgs e) { int clsId = ((BCClassSchedule)(e.Item.DataItem)).Id; string temp; BCRegular objRegular = new BCRegular(); objRegular.Id = clsId; try { objRegular.LoadData(); } catch (WebServiceException ex) { bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy"); if (rethrow) throw; return; } //class description label //S4 P Chem Sun 1300 - 1430 (sample) Label lblClassDescription = (Label)(e.Item.FindControl("lblClassDescription")); temp = "{0} {1} {2} {3} - {4}"; lblClassDescription.Text = String.Format(temp, objRegular.GetSubject().name, objRegular.getLevel().Name, objRegular.Day, objRegular.TimeStart.ToString("hh:mm tt"), objRegular.TimeEnd.ToString("hh:mm tt") ); GridView grdPaymentHistory = (GridView)(e.Item.FindControl("grdPaymentHistory")); grdPaymentHistory.RowDataBound += new GridViewRowEventHandler(grdPaymentHistory_RowDataBound); grdPaymentHistory.RowCreated += new GridViewRowEventHandler(grdPaymentHistory_RowCreated); BCPayment[] aryBCPayment = BCPayment.getPaymentByStudentClass( Convert.ToInt32(hdnStudentId.Value), clsId); grdPaymentHistory.DataSource = aryBCPayment; grdPaymentHistory.DataBind(); Label lblEmptyPH = (Label)(e.Item.FindControl("lblEmptyPaymentHistory")); lblEmptyPH.Visible = (aryBCPayment == null || aryBCPayment.Length == 0); GridView grdAttendanceHistory = (GridView)(e.Item.FindControl("grdAttendanceHistory")); grdAttendanceHistory.RowDataBound += new GridViewRowEventHandler(grdAttendanceHistory_RowDataBound); grdAttendanceHistory.RowCreated += new GridViewRowEventHandler(grdAttendanceHistory_RowCreated); wsvAttendanceLn.AttendanceLn dbAttln = new wsvAttendanceLn.AttendanceLn(); wsvAttendanceLn.CAttendanceLn[] aryAttln = dbAttln.GetAttendanceByStudentClass( Convert.ToInt32(hdnStudentId.Value), clsId); grdAttendanceHistory.DataSource = aryAttln; grdAttendanceHistory.DataBind(); Label lblEmptyAH = (Label)(e.Item.FindControl("lblEmptyAttendanceHistory")); lblEmptyAH.Visible = (aryAttln == null || aryAttln.Length == 0); GridView grdAbsenceSummary = (GridView)(e.Item.FindControl("grdAbsenceSummary")); grdAbsenceSummary.RowDataBound += new GridViewRowEventHandler(grdAbsenceSummary_RowDataBound); grdAbsenceSummary.RowCreated += new GridViewRowEventHandler(grdAbsenceSummary_RowCreated); BCStudent objStud = new BCStudent(); objStud.Id = Convert.ToInt32(hdnStudentId.Value); DataSet dsReport = objStud.GenerateAttendanceSummaryReport(clsId, 2); grdAbsenceSummary.DataSource = dsReport; grdAbsenceSummary.DataBind(); Label lblEmptyAS = (Label)(e.Item.FindControl("lblEmptyAbsenceSummary")); lblEmptyAS.Visible = (dsReport == null || dsReport.Tables.Count == 0 || dsReport.Tables[0].Rows.Count == 0); }
protected void grdSummary_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //0 1 2 3 4 5 //Id class classDetails Amt paid paid credits transferin //6 7 8 9 10 //classes conducted transferOut forfeits prorate adjustments //11 //credits left int clsId = Convert.ToInt32(grdSummary.DataKeys[e.Row.RowIndex].Value); string tmpStr; BCRegular objRegular = new BCRegular(); objRegular.Id = clsId; try { objRegular.LoadData(); } catch (WebServiceException ex) { bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy"); if (rethrow) throw; return; } //class e.Row.Cells[1].Text = objRegular.getLevel().Name + " " + objRegular.GetSubject().name; //class details tmpStr = "{0} {1} - {2}"; e.Row.Cells[2].Text = String.Format(tmpStr, objRegular.Day, objRegular.TimeStart.ToShortTimeString(), objRegular.TimeEnd.ToShortTimeString()); //amt paid and paid credits decimal amtPaid = 0; int paidCredits = 0; BCPayment[] aryPayments = BCPayment.getPaymentByStudentClass( Convert.ToInt32(hdnStudentId.Value), clsId ); if (aryPayments != null) { foreach (BCPayment objPayment in aryPayments) { amtPaid += objPayment.Amount; paidCredits += objPayment.Credit; } } e.Row.Cells[3].Text = Convert.ToString(amtPaid); e.Row.Cells[4].Text = Convert.ToString(paidCredits); amtPaidT += amtPaid; paidCreditsT += paidCredits; //transferIn, transferOut int transferIn = 0; int transferOut = 0; wsvLog_TransferCredit.DBLog_TransferCredit dbTC = new wsvLog_TransferCredit.DBLog_TransferCredit(); wsvLog_TransferCredit.CLog_TransferCredit[] aryTCIn = dbTC.getLog_TransferCreditsByTransferInClassId(Convert.ToInt32(hdnStudentId.Value), clsId); wsvLog_TransferCredit.CLog_TransferCredit[] aryTCOut = dbTC.getLog_TransferCreditsByTransferOutClassId(Convert.ToInt32(hdnStudentId.Value), clsId); if (aryTCIn != null) { foreach (wsvLog_TransferCredit.CLog_TransferCredit objTC in aryTCIn) { transferIn += objTC.Amount; } } if (aryTCOut != null) { foreach (wsvLog_TransferCredit.CLog_TransferCredit objTC in aryTCOut) { transferOut += objTC.Amount; } } e.Row.Cells[5].Text = Convert.ToString(transferIn); e.Row.Cells[7].Text = Convert.ToString(transferOut); TransferInT += transferIn; transferOutT += transferOut; //classes conducted, pro-rate int proRate = 0; wsvAttendanceLn.AttendanceLn dbAttln = new wsvAttendanceLn.AttendanceLn(); wsvAttendanceLn.CAttendanceLn[] aryAttln = dbAttln.GetAttendanceByStudentClass(Convert.ToInt32(hdnStudentId.Value), clsId); if (aryAttln == null) { //classes conducted e.Row.Cells[6].Text = "0"; } else { e.Row.Cells[6].Text = Convert.ToString(aryAttln.Length); classConductedT += aryAttln.Length; foreach (wsvAttendanceLn.CAttendanceLn objAttln in aryAttln) { //isPresent 0: absent, 1: present, 2: proRate proRate += (objAttln.isPresent == 2) ? 1 : 0; } } e.Row.Cells[9].Text = Convert.ToString(proRate); proRateT += proRate; //forfeits int forfeits; wsvForfeitLog.ForfeitLog dbForfeit = new wsvForfeitLog.ForfeitLog(); forfeits = dbForfeit.GetTotalForfeitedCredits(Convert.ToInt32(hdnStudentId.Value), clsId); e.Row.Cells[8].Text = Convert.ToString(forfeits); forfeitsT += forfeits; //adjustments int adjustments = 0; wsvCreditOverwriteLog.CreditOverwriteLog dbCOL = new wsvCreditOverwriteLog.CreditOverwriteLog(); wsvCreditOverwriteLog.CCreditOverwriteLog[] aryCOL = dbCOL.getOverwriteLogsByStudentClass(Convert.ToInt32(hdnStudentId.Value), clsId); if (aryCOL != null) { foreach (wsvCreditOverwriteLog.CCreditOverwriteLog objCOL in aryCOL) { adjustments += objCOL.CreditTo - objCOL.CreditFrom; } } e.Row.Cells[10].Text = Convert.ToString(adjustments); adjustT += adjustments; //credits left BCStudentClassSchedule objSCS = new BCStudentClassSchedule(); try { objSCS.load(Convert.ToInt32(hdnStudentId.Value), clsId); e.Row.Cells[11].Text = Convert.ToString(objSCS.Credit); creditsLeftT += objSCS.Credit; } catch (WebServiceException ex) { bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy"); if (rethrow) throw; e.Row.Cells[11].Text = "???"; } }// if (e.Row.RowType == DataControlRowType.DataRow) else if(e.Row.RowType == DataControlRowType.Footer) { //0 1 2 3 4 5 //Id class classDetails Amt paid paid credits transferin //6 7 8 9 10 //classes conducted transferOut forfeits prorate adjustments //11 //credits left e.Row.Cells[2].Text = "Total:"; e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Row.Cells[3].Text = Convert.ToString(amtPaidT); e.Row.Cells[4].Text = Convert.ToString(paidCreditsT); e.Row.Cells[5].Text = Convert.ToString(TransferInT); e.Row.Cells[6].Text = Convert.ToString(classConductedT); e.Row.Cells[7].Text = Convert.ToString(transferOutT); e.Row.Cells[8].Text = Convert.ToString(forfeitsT); e.Row.Cells[9].Text = Convert.ToString(proRateT); e.Row.Cells[10].Text = Convert.ToString(adjustT); e.Row.Cells[11].Text = Convert.ToString(creditsLeftT); } }