protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.StudentMenu("studentinfo"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string submitMode = Request["submitMode"]; if (IsPostBack) { if (!string.IsNullOrEmpty(submitMode)) { if (submitMode.Equals("add")) { if (!Utils.User.UserRoleByName("Student - Information").allowAdd) { Response.Write("You do not have rights to add."); return; } } if (submitMode.Equals("edit")) { if (!Utils.User.UserRoleByName("Student - Information").allowEdit) { Response.Write("You do not have rights to edit."); return; } } } } BestCenters bcs = new BestCenters(); bcs.LoadRows(); StringBuilder sbc = new StringBuilder(); sbc.Append("<option value=\"\"></option>"); for (int rnum = 0; rnum < bcs.TableRows.Count; rnum++) { string cid = bcs.TableRows[rnum].Fields["CenterId"].fieldValue; if (cid.Equals(Utils.User.CenterId)) { this.CenterId.Items.Add(cid); } //sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(cid) + "\">" + HttpUtility.HtmlEncode(cid) + "</option>"); } //this.ltrCenters.Text = sbc.ToString(); this.ltrState.Text = Utils.StateOptions(); StringBuilder jsbp = new StringBuilder(); jsbp.Append("jsProg=["); StringBuilder sbp = new StringBuilder(); sbp.Append("<option value=\"\"></option>"); BestPrograms bps = new BestPrograms(); bps.LoadRows(); ListItem ltItem = new ListItem("", ""); this.proposedProg.Items.Add(ltItem); for (int rnum = 0; rnum < bps.TableRows.Count; rnum++) { string optext = bps.TableRows[rnum].Fields["programName"].fieldValue + ":" + bps.TableRows[rnum].Fields["programType"].fieldValue + ": Per " + bps.TableRows[rnum].Fields["amountType"].fieldValue; string optval = bps.TableRows[rnum].Fields["guidfield"].fieldValue; sbp.Append("<option value=\"" + HttpUtility.HtmlEncode(optval) + "\">" + HttpUtility.HtmlEncode(optext) + "</option>"); jsbp.Append("{\"guid\":\"" + optval + "\",\"amount\":\"" + bps.TableRows[rnum].Fields["amount"].fieldValue + "\",\"amountType\":\"" + bps.TableRows[rnum].Fields["amountType"].fieldValue + "\"}"); if (rnum < bps.TableRows.Count - 1) jsbp.Append(","); ltItem = new ListItem(optext, optval); this.proposedProg.Items.Add(ltItem); } jsbp.Append("]"); this.ltrprog1.Text = sbp.ToString(); this.ltrRelation.Text = Utils.RelationshipOptions(); if (!string.IsNullOrEmpty(submitMode) && submitMode.Equals("add") && !IsPostBack) { /* Get New Next Student ID */ BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "Best_GetNextStudentId"; this.CenterId.SelectedIndex = 0; OleDbParameter p1 = new OleDbParameter("@xcenterid", OleDbType.VarChar, 10); p1.Value = this.CenterId.Items[0].Value; myCmd.Parameters.Add(p1); myCmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbDataReader read = myCmd.ExecuteReader(); if (read.Read()) { string studentid = read.GetValue(0).ToString(); this.StudentId.Value = studentid; } } string studentguid = Request.QueryString["studentguid"]; Guid studentGuid = Guid.NewGuid(); if (!string.IsNullOrEmpty(studentguid)) { studentGuid = new Guid(studentguid); } StringBuilder jstdProg = new StringBuilder(); StringBuilder jstdPick = new StringBuilder(); StringBuilder jstdGPA = new StringBuilder(); jstdProg.AppendLine(""); jstdProg.Append("studentProg = ["); jstdPick.AppendLine(""); jstdPick.Append("pickupInfo = ["); string jsSelState = ""; jstdGPA.AppendLine(""); jstdGPA.Append("studentGPA = ["); if (submitMode.Equals("edit")) { /* Load Student Master */ try { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = studentguid; bparams.Add(guid); bstdMast.LoadRows("guidfield=?", bparams); bstdPic.LoadRows("studentguid=?", bparams); bstdPay.LoadRows("studentguid=?", bparams); bstdRef.LoadRows("studentguid=?", bparams); bstdProg.LoadRows("studentguid=?", bparams); bstdPickup.LoadRows("studentguid=?", bparams); bstdGPA.LoadRows("studentguid=?", bparams); jsSelState = bstdMast.state; } catch (Exception ex) { Response.Write("Error:" + HttpUtility.HtmlEncode(ex.Message)); return; } if (!IsPostBack) { LoadForm(studentguid); } } if (IsPostBack) { doSave(studentGuid); } jstdProg.AppendLine(getStudentProgJS()); jstdPick.AppendLine(getStudentPickupJS()); jstdGPA.AppendLine(getStudentGPAJS()); jstdProg.Append("]"); jstdPick.Append("]"); jstdGPA.Append("]"); StringBuilder jsDateEvents = new StringBuilder(); jsDateEvents.AppendLine(""); jsDateEvents.AppendLine("$(document).ready(function(){"); jsDateEvents.AppendLine("$('#" + this.cellPhone.ClientID + ",#" + this.homePhone.ClientID + ",#" + this.workPhone.ClientID + ",#contact0').mask('(999) 999-9999')"); jsDateEvents.AppendLine("$('#" + this.joinDate.ClientID + ",#" + this.birthDate.ClientID + "').mask('99/99/9999');"); jsDateEvents.AppendLine("$('#" + this.joinDate.ClientID + ",#" + this.birthDate.ClientID + "').datepicker({ showOn: 'button', buttonImage: 'images/date.png', buttonImageOnly: true, changeYear: true, changeMonth: true });"); if (!string.IsNullOrEmpty(jsSelState)) { jsDateEvents.AppendLine("$('#selState').val('" + jsSelState + "');"); } jsDateEvents.AppendLine("$('#+" + this.firstName.ClientID + "').focus();"); jsDateEvents.AppendLine("});"); jsDateEvents.AppendLine("parentNameId = '" + this.parentName.ClientID + "';"); jsDateEvents.AppendLine("payeenameId = '" + this.paymentname1.ClientID + "';"); this.ltrProgScript.Text = "<script type=\"text/javascript\">" + jsbp.ToString() + jstdProg.ToString() + jstdPick.ToString() + jstdGPA.ToString() + jsDateEvents.ToString() + "</script>"; if (submitMode.Equals("edit")) { this.ltrPhoto.Text = "<a href=\"UploadPhoto.aspx?sid=" + HttpUtility.UrlEncode(this.StudentId.Value) + "&cid=" + HttpUtility.UrlEncode(this.CenterId.Value) + "\" target=\"_blank\">Choose Photo</a>"; } this.photoDisplay.Text = "<img id=\"empPhoto\" alt=\"Employee Photo\" src=\"getPhoto.aspx?sid=" + Server.UrlEncode(this.StudentId.Value) + "&cid=" + Server.UrlEncode(this.CenterId.Value) + "\" />"; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); StringBuilder sbPersonal = new StringBuilder(); sbPersonal.Append("<table class=\"tblpersonal\"><tr><td>Name</td><td>" + Utils.User.BestUser.firstName + " " + Utils.User.BestUser.lastName + "</td></tr>"); sbPersonal.Append("<tr><td>Address</td><td>" + Utils.User.BestUser.address1 + " " + Utils.User.BestUser.address2 + "</td></tr>"); sbPersonal.Append("<tr><td> </td><td>" + Utils.User.BestUser.city + " " + Utils.User.BestUser.state + " " + Utils.User.BestUser.zip + "</td></tr>"); sbPersonal.Append("</table>"); ltrPersonal.Text = sbPersonal.ToString(); /* StringBuilder sbLogins = new StringBuilder(); BestLogins bsLogin = new BestLogins(); BestField fld = new BestField() { fieldName = "username", fieldType = "System.String", fieldSize = 128, paramOledbType = System.Data.OleDb.OleDbType.VarChar }; fld.fieldValue = Utils.User.UserName; List<BestField> bparam = new List<BestField>(); bparam.Add(fld); bsLogin.LoadRows("username=?", bparam , "logindate desc"); int maxRows = bsLogin.TableRows.Count > 10 ? 10 : bsLogin.TableRows.Count; sbLogins.Append("<table class=\"tbllogins\"><tr><th>User Name</th><th>Login Date</th><th>Source IP</th><th>Login Valid</th><th>Server IP</th><tr>"); for (int i = 0; i < maxRows; i++) { string logvalid = bsLogin.TableRows[i].Fields["loginvalid"].fieldValue.Equals("1") ? "True" : "False"; string trclass = (i % 2 == 0) ? "" : "trordd"; sbLogins.Append("<tr class=\"" + trclass + "\"><td>" + HttpUtility.HtmlEncode(bsLogin.TableRows[i].Fields["username"].fieldValue) + "</td>"); sbLogins.Append("<td>" + HttpUtility.HtmlEncode(bsLogin.TableRows[i].Fields["logindate"].fieldValue) + "</td>"); sbLogins.Append("<td>" + HttpUtility.HtmlEncode(bsLogin.TableRows[i].Fields["sourceip"].fieldValue) + "</td>"); sbLogins.Append("<td>" + HttpUtility.HtmlEncode(logvalid) + "</td>"); sbLogins.Append("<td>" + HttpUtility.HtmlEncode(bsLogin.TableRows[i].Fields["serverip"].fieldValue) + "</td></tr>"); } sbLogins.Append("</table>"); ltrLogins.Text = sbLogins.ToString(); */ string tsql; bool showSchedules = true; if (Utils.User.BestUser.userType.Equals("Student")) { showSchedules = (Utils.User.BestUser.studentGuid != null); tsql = @"select Date, [Sunday], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday], [Saturday] from VBestSchedules where (stuGuid1='" + Utils.User.BestUser.studentGuid.ToString() + "' or stuGuid2='" + Utils.User.BestUser.studentGuid.ToString() + "' or stuGuid3='" + Utils.User.BestUser.studentGuid.ToString() + "' or stuGuid4='" + Utils.User.BestUser.studentGuid.ToString() + "' or stuGuid5='" + Utils.User.BestUser.studentGuid.ToString() + @" and convert(datetime,Date) >= cast(floor(cast(getdate() as float)) as datetime) order by Date, convert(numeric,schfrom)"; } else { showSchedules = (Utils.User.BestUser.tutorGuid != null); tsql = @"select Date, [Sunday], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday], [Saturday] from VBestSchedules where tutGuid='" + Utils.User.BestUser.tutorGuid.ToString() + @"' and convert(datetime,Date) >= cast(floor(cast(getdate() as float)) as datetime) order by convert(numeric,schfrom)"; } StringBuilder sbSchd = new StringBuilder(); if (showSchedules) { BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; OleDbDataReader tblReader = myCmd.ExecuteReader(CommandBehavior.KeyInfo); //Retrieve column schema into a DataTable. DataTable schemaTable = tblReader.GetSchemaTable(); sbSchd.Append("<table class=\"tbllogins\"><tr>"); //For each field in the table... int fieldCnt = 0; foreach (DataRow myField in schemaTable.Rows) { fieldCnt++; if (fieldCnt > 8) break; sbSchd.Append("<th>" + myField[0] + "</th>"); } sbSchd.Append("</tr>"); int cnt = 0; while (tblReader.Read()) { string trclass = (cnt % 2 == 0) ? "" : "trordd"; sbSchd.Append("<tr class=\"" + trclass + "\"><td>" + (tblReader[0].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[1].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[2].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[3].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[4].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[5].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[6].ToString()) + "</td>"); sbSchd.Append("<td>" + ToTimeFormat(tblReader[7].ToString()) + "</td></tr>"); cnt++; } tblReader.Close(); sbSchd.Append("</table>"); } else { sbSchd.Append("<table class=\"tblpersonal\"><tr><td>Schedules</td></tr></table>"); } ltrSchedule.Text = sbSchd.ToString(); ltrMessage.Text = "<table class=\"tblpersonal\"><tr><td><div id=\"divRecMessage\">" + MessagesHTML(false) + "</div></td></tr></table>"; ltrCommunication.Text = ComminicationHTML(); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.StudentMenu("studentreports"); if (!Utils.User.UserRoleByName("Student - Reports").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); StringBuilder rowshtml = new StringBuilder(); string fromdate = Request.Form["fromdate"]; if (string.IsNullOrEmpty(fromdate)) fromdate = DateTime.Today.ToString("MM/dd/yyyy"); string todate = Request.Form["todate"]; if (string.IsNullOrEmpty(todate)) todate = DateTime.Today.AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy"); string summaryby = Request.Form["summaryby"]; if (string.IsNullOrEmpty(summaryby)) summaryby = ""; bool chkStudentName = (Request.Form["chkStudentName"] ?? "").Equals("on"); bool chkParentName = (Request.Form["chkParentName"] ?? "").Equals("on"); bool chkAddress = (Request.Form["chkAddress"]??"").Equals("on"); bool chkTutorName = (Request.Form["chkTutorName"]??"").Equals("on"); bool chkTotalHours = (Request.Form["chkTotalHours"]??"").Equals("on"); bool chkTotalAmountPaid = (Request.Form["chkTotalAmountPaid"]??"").Equals("on"); bool chkTotalAmountCharged = (Request.Form["chkTotalAmountCharged"]??"").Equals("on"); bool chkAmountDue = (Request.Form["chkAmountDue"]??"").Equals("on"); bool chkPayDate = (Request.Form["chkPayDate"]??"").Equals("on"); bool chkProgramDesc = (Request.Form["chkProgramDesc"]??"").Equals("on"); bool chkNotes = (Request.Form["chkNotes"] ?? "").Equals("on"); if (!IsPostBack) { chkStudentName = true; chkTotalHours = true; chkTotalAmountPaid = true; chkTotalAmountCharged = true; chkAmountDue = true; chkPayDate = true; } if (IsPostBack) { bool canReport = true; if (!string.IsNullOrEmpty(fromdate)) { try { DateTime fromdt = Convert.ToDateTime(fromdate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("From Date is Required."); canReport = false; } if (!string.IsNullOrEmpty(todate)) { try { DateTime todt = Convert.ToDateTime(todate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("To Date is Required."); canReport = false; } if (canReport) { BestField bffromdate = new BestField() { fieldName = "fromdate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bffromdate.fieldValue = fromdate.Substring(6, 4) + fromdate.Substring(0, 2) + fromdate.Substring(3, 2); BestField bftodate = new BestField() { fieldName = "todate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bftodate.fieldValue = todate.Substring(6, 4) + todate.Substring(0, 2) + todate.Substring(3, 2); BestField GuidField = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = OleDbType.Guid, displayField = false }; string StudentGuid = Request.Form["StudentGuid"] ?? ""; GuidField.fieldValue = StudentGuid; string tsql = "select schdate, studentid, BestStudents.firstName + ' ' + BestStudents.lastName as StudentName, BestStudents.ParentName, BestStudents.address1 + ' ' + BestStudents.address2 as address, BestStudents.city + ' ' + BestStudents.state + ' ' + BestStudents.zip as csz, BestStudents.homephone as homephone, BestStudents.workphone as workphone, BestStudents.emailid, case when trantype='Scheduled' then isnull(vbest.amount,0) else 0 end as tobecharged, case when trantype!='Scheduled' then vbest.amount else 0 end as paid, vbest.hours, case trantype when 'Scheduled' then case vbest.attendance when 0 then 'Charged' when 1 then 'Informed' when 2 then 'No Charge' end else 'Payment' end transType, bprog.programName + ':' + bprog.programType programName, BestTutors.firstName + ' ' + BestTutors.lastName as TutorName, vbest.note from VBestSchedulesAndPayments vbest inner join BestStudents on beststudents.guidfield = vbest.studentguid left join BestPrograms bprog on bprog.guidfield = vbest.programguid left join BestTutors on BestTutors.guidfield = vbest.tutGuid where schdate >= ? and schdate <= ? and BestStudents.CenterId=? " ; if (!string.IsNullOrEmpty(StudentGuid)) { tsql = tsql + " and BestStudents.guidfield=? "; } tsql += " order by StudentName, schDate"; BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; myCmd.Parameters.Add(bffromdate.Param); myCmd.Parameters.Add(bftodate.Param); myCmd.Parameters.Add(Utils.User.CenterIdField.Param); if (!string.IsNullOrEmpty(StudentGuid)) { myCmd.Parameters.Add(GuidField.Param); } OleDbDataReader tblReader = myCmd.ExecuteReader(); double total = 0; double chargedTotal = 0; double totalHours = 0; int colSpan = 0; rowshtml.Append("<br /><div id=\"studentReport\"><table class=\"tblreports\" cellspacing=\"0\" cellpadding=\"0\">"); rowshtml.Append("<thead><tr><td colspan=\"9\" style=\"font-weight:bold;font-size:12px;\">" + Utils.User.CenterId + " Students Report</td></thead>"); rowshtml.Append("<tr>"); if (chkPayDate) { rowshtml.Append("<th>Date</th>"); colSpan++; } rowshtml.Append("<th>Student Id</th>"); colSpan++; if (chkStudentName) { rowshtml.Append("<th>Student Name</th>"); colSpan++; } if (chkParentName) { rowshtml.Append("<th>Parent Name</th>"); colSpan++; } if (chkAddress) { rowshtml.Append("<th>Contact Info</th>"); rowshtml.Append("<th>Home Phone</th>"); rowshtml.Append("<th>Work Phone</th>"); rowshtml.Append("<th>E-Mail Id</th>"); colSpan += 4; } if (chkProgramDesc) { rowshtml.Append("<th>Program Name</th>"); colSpan++; } if (chkTutorName) { rowshtml.Append("<th>Tutor Name</th>"); colSpan++; } if (chkNotes) { rowshtml.Append("<th>Notes</th>"); colSpan++; } rowshtml.Append("<th>Trans Type</th>"); colSpan++; rowshtml.Append("<th>Charged Amount</th>"); rowshtml.Append("<th>Amount Paid</th>"); rowshtml.Append("<th>Hours</th>"); rowshtml.Append("<th>Balance</th>"); rowshtml.Append("</tr>"); string studentid = ""; int Cnt = 0; string studName = ""; double grandTotal = 0; while (tblReader.Read()) { string stuid = tblReader[1].ToString(); if (!studentid.Equals(stuid) && (Cnt > 0)) { /* Totals for the Student */ rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"" + colSpan.ToString() + "\">" + studName + " Total </td>"); if (chkTotalAmountCharged) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + chargedTotal.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalAmountPaid) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + total.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalHours) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + totalHours.ToString("0") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkAmountDue) { rowshtml.Append("<td class=\"ra\" style=\"white-space:nowrap;background-color:#fff;padding-right:3px;\">" + (total - chargedTotal).ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } rowshtml.Append("</tr>"); chargedTotal = 0; total = 0; totalHours = 0; } studentid = stuid; Cnt++; string paydate = tblReader[0].ToString(); paydate = paydate.Substring(4, 2) + "/" + paydate.Substring(6, 2) + "/" + paydate.Substring(0, 4); studName = tblReader[2].ToString(); string parentName = tblReader[3].ToString(); string address = tblReader[4].ToString() + " " + tblReader[5].ToString(); string homephone = tblReader[6].ToString(); string workphone = tblReader[7].ToString(); string emailid = tblReader[8].ToString(); string tranType = tblReader[12].ToString(); Double chargedAmt = 0; Double.TryParse(tblReader[9].ToString(), out chargedAmt); if (tranType.Equals("Informed")) { chargedAmt = 0; } Double payAmt = 0; Double.TryParse(tblReader[10].ToString(), out payAmt); Double hours = 0; Double.TryParse(tblReader[11].ToString(), out hours); totalHours += hours; string progName = tblReader[13].ToString(); string tutorName = tblReader[14].ToString(); string notes = tblReader[15].ToString(); total += payAmt; chargedTotal += chargedAmt; grandTotal += chargedAmt; string strPayAmt = (payAmt > 0) ? payAmt.ToString("$0.00") : " "; string strChargedAmt = (chargedAmt > 0) ? chargedAmt.ToString("$0.00") : " "; rowshtml.Append("<tr>"); if (chkPayDate) { rowshtml.Append("<td>" + paydate + "</td>"); } rowshtml.Append("<td>" + HttpUtility.HtmlEncode(stuid) + "</td>"); if (chkStudentName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(studName) + "</td>"); } if (chkParentName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(parentName) + "</td>"); } if (chkAddress) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(address) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(homephone) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(workphone) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(emailid) + "</td>"); } if (chkProgramDesc) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(progName) + "</td>"); } if (chkTutorName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(tutorName) + "</td>"); } if (chkNotes) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(notes) + "</td>"); } rowshtml.Append("<td>" + HttpUtility.HtmlEncode(tranType) + "</td>"); rowshtml.Append("<td class=\"ra\" style=\"padding-right:3px;\">" + strChargedAmt + "</td>"); rowshtml.Append("<td class=\"ra\" style=\"padding-right:3px;\">" + strPayAmt + "</td>"); rowshtml.Append("<td class=\"ra\">" + HttpUtility.HtmlEncode(hours.ToString("0")) + "</td></tr>"); } rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"" + colSpan.ToString() + "\">" + studName + " Total </td>"); if (chkTotalAmountCharged) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + chargedTotal.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalAmountPaid) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + total.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalHours) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + totalHours.ToString("0") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkAmountDue) { rowshtml.Append("<td class=\"ra\" style=\"white-space:nowrap;background-color:#fff;padding-right:3px;\">" + (total - chargedTotal).ToString("0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } rowshtml.Append("</tr>"); rowshtml.Append("<tr><td style=\"font-weight:bold;\">Grand Total</td><td>" + Server.HtmlEncode(fromdate + " to " + todate) + "</td><td colspan=\"3\" style=\"text-align:right;font-weight:bold;\">" + grandTotal.ToString("$0.00") + "</td></tr>"); rowshtml.Append("</table></div><br />"); rowshtml.Append("<div><input type=\"button\" value=\"Print\" onclick=\"PrintTable('studentReport');\" /></div>"); } } StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"centered\">"); sb.Append("<table class=\"bestgrid\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); sb.Append("<tr><td style=\"text-align:center;\" colspan=\"4\">Student Reports</td></tr>"); sb.Append("<tr><td>From Date <input type=\"text\" id=\"fromdate\" name=\"fromdate\" size=\"9\" maxlength=\"10\" value=\"" + Server.HtmlEncode(fromdate) + "\" /></td><td>To Date <input type=\"text\" id=\"todate\" name=\"todate\" size=\"9\" maxlength=\"10\" value=\"" + Server.HtmlEncode(todate) + "\" /></td>"); sb.Append("<td>Summary By <select id=\"summaryby\" name=\"summaryby\"><option value=\"\"></option>"); sb.Append("<option value=\"paydate\" " + (summaryby.Equals("paydate") ? " selected " : "") + ">Payment Date</option>"); sb.Append("<option value=\"payweek\" " + (summaryby.Equals("payweek") ? " selected " : "") + ">Week</option>"); sb.Append("<option value=\"paymonth\" " + (summaryby.Equals("paymonth") ? " selected " : "") + ">Month</option>"); sb.Append("<option value=\"payyear\" " + (summaryby.Equals("payyear") ? " selected " : "") + ">Year</option>"); sb.Append("</select></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkStudentName\" name=\"chkStudentName\" " + (chkStudentName ? "checked=\"checked\"" : "") + " /><label for=\"chkStudentName\">Student Name</lable></td><td><input type=\"checkbox\" id=\"chkParentName\" name=\"chkParentName\" " + (chkParentName ? "checked=\"checked\"" : "") + " /><label for=\"chkParentName\">Parent Name</label></td><td><input type=\"checkbox\" id=\"chkAddress\" name=\"chkAddress\" " + (chkAddress ? "checked=\"checked\"" : "") + " /><label for=\"chkAddress\">Contact Info</label></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" name=\"chkTutorName\" id=\"chkTutorName\" " + (chkTutorName ? "checked=\"checked\"" : "") + " /><label for=\"chkTutorName\">Tutor name</label></td><td><input type=\"checkbox\" id=\"chkTotalHours\" name=\"chkTotalHours\" " + (chkTotalHours ? "checked=\"checked\"" : "") + " /><lable for=\"chkTotalHours\">Total Hours</label></td><td><input type=\"checkbox\" id=\"chkTotalAmountPaid\" name=\"chkTotalAmountPaid\" " + (chkTotalAmountPaid ? "checked=\"checked\"" : "") + " /><label for=\"chkTotalAmountPaid\">Total Amount Paid</lable></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkTotalAmountCharged\" name=\"chkTotalAmountCharged\" " + (chkTotalAmountCharged ? "checked=\"checked\"" : "") + " /><label for=\"chkTotalAmountCharged\">Total Amount Charged</label></td><td><input type=\"checkbox\" id=\"chkAmountDue\" name=\"chkAmountDue\" " + (chkAmountDue ? "checked=\"checked\"" : "") + " /><label for=\"chkAmountDue\">Amount Due</label></td><td><input type=\"checkbox\" id=\"chkPayDate\" name=\"chkPayDate\" " + (chkPayDate ? "checked=\"checked\"" : "") + " /><label for=\"chkPayDate\">Payment Date</label></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkProgramDesc\" name=\"chkProgramDesc\" " + (chkProgramDesc ? "checked=\"checked\"" : "") + " /><label for=\"chkProgramDesc\">Program Description</label></td><td><input type=\"checkbox\" id=\"chkNotes\" name=\"chkNotes\" " + (chkNotes ? "checked=\"checked\"" : "") + " /><label for=\"chkNotes\">Additional notes</label></td>"); sb.Append("<td>Student <select id=\"StudentGuid\" name=\"StudentGuid\">" + StudentOptions() + "</select></td></tr>"); sb.Append("<tr><td colspan=\"3\" style=\"text-align:center;\" ><input type=\"button\" value=\"Submit\" onclick=\"submit();\" /></td></tr>"); sb.Append("</table>"); ltrGrid.Text = sb.ToString() + rowshtml.ToString() + "</div>"; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.StudentMenu("studentschedule"); if (!Utils.User.UserRoleByName("Student - Schedule").allowView) { ltrValidateMsg.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; this.ltrMScript.Text = Utils.MenuSelectScript(ms); BestStudents bstd = new BestStudents(); bstd.LoadRows("CenterId=?", Utils.User.CIdParam,"firstname"); string selstudent = Request.Form["selStudent"]; StringBuilder sb = new StringBuilder(); sb.Append(""); string selName = ""; string emailaddress = ""; for (int i = 0; i < bstd.TableRows.Count; i++) { string sname = bstd.TableRows[i].Fields["firstname"].fieldValue + " " + bstd.TableRows[i].Fields["lastname"].fieldValue; string sguid = bstd.TableRows[i].Fields["guidfield"].fieldValue; sb.Append("<option value=\"" + HttpUtility.HtmlEncode(sguid) + "\""); if (string.IsNullOrEmpty(selstudent)) { selstudent = sguid; } if (sguid.Equals(selstudent)) { selName = sname; emailaddress = bstd.TableRows[i].Fields["emailId"].fieldValue; sb.Append(" selected "); } sb.Append(">" + HttpUtility.HtmlEncode(sname) + "</option>"); } ltrStudentOpts.Text = sb.ToString(); string fromdate = Request.Form["fromdate"] ?? ""; string todate = Request.Form["todate"] ?? ""; DateTime today = DateTime.Today; int curweek = ((int)today.DayOfWeek) * -1; if (string.IsNullOrEmpty(fromdate)) { fromdate = today.AddDays(curweek).ToString("MM/dd/yyyy"); } if (string.IsNullOrEmpty(todate)) { todate = today.AddDays(curweek).AddDays(7).ToString("MM/dd/yyyy"); } ltrLoadScript.Text = "<script type=\"text/javascript\">$(document).ready(function(){$('#fromdate').val('" + fromdate + "'); $('#todate').val('" + todate + @"'); }); </script>"; if (!string.IsNullOrEmpty(selstudent)) { string tsql = "select Date, [Sunday], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday], [Saturday] from VBestSchedules where "; tsql += "(stuGuid1='" + selstudent + "' or stuGuid2='" + selstudent + "' or stuGuid3='" + selstudent + "' or stuGuid4='" + selstudent + "' or stuGuid5='" + selstudent + "') and convert(datetime,date) between '" + fromdate + @"' and '" + todate + @"' order by convert(datetime, date), convert(numeric, schfrom)"; StringBuilder sbSchd = new StringBuilder(); BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; OleDbDataReader tblReader = myCmd.ExecuteReader(CommandBehavior.KeyInfo); //Retrieve column schema into a DataTable. DataTable schemaTable = tblReader.GetSchemaTable(); sbSchd.Append("<table cellpadding=\"0\" style=\"padding:1px;font-family:Tahoma;font-size:12px;border:1px solid #999;background-color:#A11117\"><tr>"); //For each field in the table... int fieldCnt = 0; foreach (DataRow myField in schemaTable.Rows) { fieldCnt++; if (fieldCnt > 8) break; sbSchd.Append("<th style=\"color:#000;background-color:#E9BA15;padding:2px;\">" + myField[0] + "</th>"); } sbSchd.Append("</tr>"); int cnt = 0; while (tblReader.Read()) { string trclass = (cnt % 2 == 0) ? "" : "trordd"; sbSchd.Append("<tr style=\"font-family:Tahoma;color:#FFF;font-size:12px;\"><td>" + (tblReader[0].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[1].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[2].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[3].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[4].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[5].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[6].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[7].ToString()) + "</td></tr>"); cnt++; } tblReader.Close(); sbSchd.Append("</table>"); ltrSchdules.Text = sbSchd.ToString(); /* Sending EMail */ string sendEClick = Request.Form["sendEMailClick"] ?? ""; if (!string.IsNullOrEmpty(sendEClick) && sendEClick.Equals("1") && emailaddress.Length > 0) { string emailbody = "Dear " + selName + "<br />Following is your Schedule from " + fromdate + " to " + todate + ":<br />" + sbSchd.ToString() + "<br />Thank you<br />Bali Learning"; if (Utils.User.emailUtil.Send(emailaddress, "Schedule Info", emailbody, selName)) { ltrEMessage.Text = "EMail Sent To: " + Server.HtmlEncode(emailaddress); } } } }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.TutorMenu("tutorreports"); if (!Utils.User.UserRoleByName("Tutor - Reports").allowView) { ltrValidateMsg.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string fromdate = Request.Form["fromdate"]; if (string.IsNullOrEmpty(fromdate)) fromdate = DateTime.Today.ToString("MM/dd/yyyy"); string todate = Request.Form["todate"]; if (string.IsNullOrEmpty(todate)) todate = DateTime.Today.AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy"); StringBuilder rowshtml = new StringBuilder(); if (IsPostBack) { bool canReport = true; if (!string.IsNullOrEmpty(fromdate)) { try { DateTime fromdt = Convert.ToDateTime(fromdate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("From Date is Required."); canReport = false; } if (!string.IsNullOrEmpty(todate)) { try { DateTime todt = Convert.ToDateTime(todate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("To Date is Required."); canReport = false; } if (canReport) { BestField bffromdate = new BestField() { fieldName = "fromdate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bffromdate.fieldValue = fromdate.Substring(6, 4) + fromdate.Substring(0, 2) + fromdate.Substring(3, 2); BestField bftodate = new BestField() { fieldName = "todate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bftodate.fieldValue = todate.Substring(6, 4) + todate.Substring(0, 2) + todate.Substring(3, 2); BestField GuidField = new BestField(){ fieldName="guidfield", fieldSize=40, fieldType="System.Guid", paramOledbType= OleDbType.Guid, displayField=false}; string tutorGuid = Request.Form["TutorGuid"]??""; GuidField.fieldValue = tutorGuid; string tsql = @"Select schdate, tutorid, BestTutors.firstName + ' ' + BestTutors.lastName as tutorName, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid1) as name1, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid2) as name2, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid3) as name3, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid4) as name4, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid5) as name5, case BestSchedules.tutorattend when 0 then 1 when 1 then 1 when 2 then 0 end as tutorattend, BestTutors.perHour, BestTutors.salary From BestSchedules Inner Join BestTutors on BestTutors.guidfield = BestSchedules.tutGuid where BestSchedules.schdate >= ? and BestSchedules.schdate <= ? and BestTutors.CenterId = ?"; if(! string.IsNullOrEmpty(tutorGuid)) { tsql += " and BestTutors.guidfield = ? "; } tsql += " order by tutorname, schdate"; BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; myCmd.Parameters.Add(bffromdate.Param); myCmd.Parameters.Add(bftodate.Param); myCmd.Parameters.Add(Utils.User.CenterIdField.Param); if (!string.IsNullOrEmpty(tutorGuid)) { myCmd.Parameters.Add(GuidField.Param); } OleDbDataReader tblReader = myCmd.ExecuteReader(); int Cnt = 0; string tutorName = ""; string tutorid = ""; rowshtml.Append("<br /><div id=\"tutorReport\"><table class=\"tblreports\" cellspacing=\"0\" cellpadding=\"0\">"); rowshtml.Append("<thead><tr><td colspan=\"9\" style=\"font-weight:bold;font-size:12px;\">" + Utils.User.CenterId + " Tutors Report</td></thead>"); rowshtml.Append("<tr>"); rowshtml.Append("<th>Date</th>"); rowshtml.Append("<th>Tutor Id</th>"); rowshtml.Append("<th>Tutor Name</th>"); rowshtml.Append("<th>Students</th>"); rowshtml.Append("<th>Hours</th>"); rowshtml.Append("<th>Per Hour</th>"); rowshtml.Append("<th>Amount</th>"); rowshtml.Append("<th>Salary</th>"); rowshtml.Append("</tr>"); Decimal totalHrs = 0; Decimal totalAmount = 0; bool showSalary = true; Decimal grandTotal = 0; Decimal salaryTotal = 0; while (tblReader.Read()) { string tutid = tblReader[1].ToString(); if (!tutorid.Equals(tutid) && (Cnt > 0)) { rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"4\">" + tutorName + " Totals</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalHrs.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalAmount.ToString("$0.00") + "</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"2\"> </td></tr>"); totalHrs = 0; totalAmount = 0; showSalary = true; } tutorid = tutid; Cnt++; string schdate = tblReader[0].ToString(); schdate = schdate.Substring(4, 2) + "/" + schdate.Substring(6, 2) + "/" + schdate.Substring(0, 4); tutorName = tblReader[2].ToString(); string name1 = tblReader[3].ToString(); string name2 = tblReader[4].ToString(); string name3 = tblReader[5].ToString(); string name4 = tblReader[6].ToString(); string name5 = tblReader[7].ToString(); string studentNames = name1; if(!string.IsNullOrEmpty(name2)) studentNames += ", " + name2 ; if(!string.IsNullOrEmpty(name3)) studentNames += ", " + name3 ; if(!string.IsNullOrEmpty(name4)) studentNames += ", " + name4 ; if(!string.IsNullOrEmpty(name5)) studentNames += ", " + name5 ; string tutAttend = tblReader[8].ToString(); string perhour = tblReader[9].ToString(); string salary = tblReader[10].ToString(); Decimal perHour; Decimal.TryParse(perhour, out perHour); Decimal Salary; Decimal.TryParse(salary, out Salary); Decimal attendHour; Decimal.TryParse(tutAttend, out attendHour); totalHrs += attendHour; totalAmount += (perHour * attendHour); grandTotal += (perHour * attendHour); rowshtml.Append("<tr><td>" + schdate + "</td>"); rowshtml.Append("<td>" + tutorid + "</td>"); rowshtml.Append("<td>" + tutorName + "</td>"); rowshtml.Append("<td>" + studentNames + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + attendHour.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + perHour.ToString("$0.00") + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + (attendHour * perHour).ToString("$0.00") + "</td>"); if (showSalary) { salaryTotal += Salary; rowshtml.Append("<td style=\"text-align:right;\">" + ((Salary > 0) ? Salary.ToString("$0.00") : "") + "</td>"); } else { rowshtml.Append("<td> </td>"); } showSalary = false; } rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"4\">" + tutorName + " Totals</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalHrs.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalAmount.ToString("$0.00") + "</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"2\"> </td></tr>"); rowshtml.Append("<tr><td style=\"font-weight:bold;\">Grand Total</td><td>" + Server.HtmlEncode(fromdate + " to " + todate) + "</td><td colspan=\"5\" style=\"text-align:right;font-weight:bold;\">" + grandTotal.ToString("$0.00") + "</td><td style=\"text-align:right;font-weight:bold;\">" + salaryTotal.ToString("$0.00") + "</td></tr>"); rowshtml.Append("</table></div><br />"); rowshtml.Append("<div><input type=\"button\" value=\"Print\" onclick=\"PrintTable('tutorReport');\" /></div>"); } } StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"centered\">"); sb.Append("<table class=\"bestgrid\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); sb.Append("<tr><td style=\"text-align:center;\" colspan=\"2\">Tutor Reports</td></tr>"); sb.Append("<tr><td>From Date <input type=\"text\" id=\"fromdate\" name=\"fromdate\" size=\"9\" maxlength=\"10\" value=\"" + fromdate + "\" /></td><td>To Date <input type=\"text\" id=\"todate\" name=\"todate\" size=\"9\" maxlength=\"10\" value=\"" + todate + "\" /></td></tr>"); sb.Append("<tr><td colspan=\"2\">Tutor <select id=\"TutorGuid\" name=\"TutorGuid\">" + TutorOptions() + "</select></td></tr>"); sb.Append("<tr><td colspan=\"2\" style=\"text-align:center;\" ><input type=\"button\" value=\"Submit\" onclick=\"submit();\" /></td></tr>"); sb.Append("</table>"); ltrGrid.Text = sb.ToString() + rowshtml.ToString() + "</div>"; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.TutorMenu("tutorinfo"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); if (!Utils.User.UserRoleByName("Tutor - Information").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } this.ltrStateOpts.Text = Utils.StateOptions(); BestCenters bcs = new BestCenters(); bcs.LoadRows(); for (int rnum = 0; rnum < bcs.TableRows.Count; rnum++) { string cid = bcs.TableRows[rnum].Fields["CenterId"].fieldValue; if (cid.Equals(Utils.User.CenterId)) { this.CenterId.Items.Add(cid); } } string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestTutors bs = new BestTutors(); string isnew = Request.Form["isnew"]; bool cansave = true; if (string.IsNullOrEmpty(isnew)) { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = Request.Form["guidfield"]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bs.LoadRows("guidfield=?", bparams); } else { string delguid = Request.Form["deleteguid"]; if (!string.IsNullOrEmpty(delguid)) { bparams[0].fieldValue = delguid; bs.LoadRows("guidfield=?", bparams); bs.CurrentRow.IsDelete = true; bs.CurrentRow.Save(); } cansave = false; } } if (cansave) { bs.TutorId = Request.Form["g_TutorId"]; bs.firstName = Request.Form["g_firstName"]; bs.lastName = Request.Form["g_lastName"]; bs.CenterId = this.CenterId.Value; if (string.IsNullOrEmpty(bs.TutorId)) { ltrValidateMsg.Text = Utils.WarningMessage("Tutor Id is Required."); cansave = false; } if (string.IsNullOrEmpty(bs.firstName) && string.IsNullOrEmpty(bs.lastName)) { ltrValidateMsg.Text = Utils.WarningMessage("First Name or Last Name is required"); cansave = false; } if (cansave) { bs.middleName = Request.Form["g_middleName"]; bs.address1 = Request.Form["g_address1"]; bs.address2 = Request.Form["g_address2"]; bs.city = Request.Form["g_city"]; bs.state = Request.Form["g_state"]; bs.zip = Request.Form["g_zip"]; bs.cellPhone = Request.Form["g_cellPhone"]; bs.workPhone = Request.Form["g_workPhone"]; bs.homePhone = Request.Form["g_homePhone"]; bs.emailId = Request.Form["g_emailId"]; bs.gender = Request.Form["g_gender"]; bs.School = Request.Form["g_school"]; bs.yearGraduated = Request.Form["g_yearGraduated"]; bs.GPA = Request.Form["g_GPA"]; bs.Major = Request.Form["g_Major"]; bs.Expertise = Request.Form["g_Expertise"]; bs.learningStyle = Request.Form["g_learningStyle"]; bs.Matchup = Request.Form["g_Matchup"]; bs.gradeLevels = Request.Form["g_gradeLevels"]; bs.otherSkill = Request.Form["g_otherSkill"]; bs.programStyle = Request.Form["g_programStyle"]; string salary = Request.Form["g_salary"]; string perhour = Request.Form["g_perhour"]; if (!string.IsNullOrEmpty(salary)) { bs.Salary = Convert.ToDecimal(salary); } if (!string.IsNullOrEmpty(perhour)) { bs.PerHour = Convert.ToDecimal(perhour); } if (!string.IsNullOrEmpty(Request.Form["g_joinDate"])) { bs.joinDate = Convert.ToDateTime(Request.Form["g_joinDate"]); } if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "Best_GetNextTutorId"; OleDbParameter p1 = new OleDbParameter("@makehigherthan", OleDbType.VarChar, 10); p1.Value = "T0"; myCmd.Parameters.Add(p1); myCmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbDataReader read = myCmd.ExecuteReader(); string tutorid = ""; if (read.Read()) { tutorid = read.GetValue(0).ToString(); } ltrLoadScript.Text = "<script type=\"text/javascript\">\n newtutorid='" + tutorid + "'\n</script>\n"; BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Tutuor Information"; bsGrid.GridTable = new BestTutors(); bsGrid.securityPage = "Tutor - Information"; ltrGrid.Text = bsGrid.ToHTML(); }
private string ReplaceParams(BestTable bsrow, string emailbody) { string result = emailbody; string name = bsrow.CurrentRow.Fields["firstName"].fieldValue + " " + bsrow.CurrentRow.Fields["lastName"].fieldValue; //{tutor} //{student} result = result.Replace("{tutor}", name); result = result.Replace("{student}", name); string fromdate = Request.Form["fromdate"] ?? ""; string todate = Request.Form["todate"] ?? ""; if (!string.IsNullOrEmpty(fromdate)) { //{WeekStartDate} result = result.Replace("{WeekStartDate}", fromdate); } if (!string.IsNullOrEmpty(todate)) { //{WeekEndDate} result = result.Replace("{WeekEndDate}", todate); } //{WeeklySchedule} if (emailbody.IndexOf("{WeeklySchedule}") > 0) { string tsql = "select Date, [Sunday], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday], [Saturday], stud1name, stud2name, stud3name, stud4name, stud5name from VBestSchedules where "; string guidstr = bsrow.CurrentRow.Fields["guidfield"].fieldValue; if (bsrow is BestStudents) { tsql += "(stuGuid1='" + guidstr + "' or stuGuid2='" + guidstr + "' or stuGuid3='" + guidstr + "' or stuGuid4='" + guidstr + "' or stuGuid5='" + guidstr + "')"; } else if (bsrow is BestTutors) { tsql += " tutGuid='" + guidstr + "'"; } tsql += @" and convert(datetime,date) between '" + fromdate + @"' and '" + todate + @"' order by convert(datetime, date), convert(numeric, schfrom)"; StringBuilder sbSchd = new StringBuilder(); BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; OleDbDataReader tblReader = myCmd.ExecuteReader(CommandBehavior.KeyInfo); //Retrieve column schema into a DataTable. DataTable schemaTable = tblReader.GetSchemaTable(); sbSchd.Append("<table cellpadding=\"0\" style=\"padding:1px;font-family:Tahoma;font-size:12px;border:1px solid #999;background-color:#A11117\"><tr>"); //For each field in the table... int fieldCnt = 0; foreach (DataRow myField in schemaTable.Rows) { fieldCnt++; if (fieldCnt > 8) break; sbSchd.Append("<th style=\"color:#000;background-color:#E9BA15;padding:2px;\">" + myField[0] + "</th>"); } sbSchd.Append("</tr>"); int cnt = 0; while (tblReader.Read()) { if (bsrow is BestStudents) { name = ""; } else { name = " " + tblReader[8].ToString(); name += !string.IsNullOrEmpty(tblReader[9].ToString()) ? ", " + tblReader[9].ToString() : ""; name += !string.IsNullOrEmpty(tblReader[10].ToString()) ? ", " + tblReader[10].ToString() : ""; name += !string.IsNullOrEmpty(tblReader[11].ToString()) ? ", " + tblReader[11].ToString() : ""; name += !string.IsNullOrEmpty(tblReader[12].ToString()) ? ", " + tblReader[12].ToString() : ""; } string trclass = (cnt % 2 == 0) ? "" : "trordd"; sbSchd.Append("<tr style=\"font-family:Tahoma;color:#FFF;font-size:12px;\"><td>" + (tblReader[0].ToString()) + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[1].ToString()) + (!string.IsNullOrEmpty(tblReader[1].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[2].ToString()) + (!string.IsNullOrEmpty(tblReader[2].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[3].ToString()) + (!string.IsNullOrEmpty(tblReader[3].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[4].ToString()) + (!string.IsNullOrEmpty(tblReader[4].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[5].ToString()) + (!string.IsNullOrEmpty(tblReader[5].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[6].ToString()) + (!string.IsNullOrEmpty(tblReader[6].ToString()) ? name : "") + "</td>"); sbSchd.Append("<td>" + Utils.ToTimeFormat(tblReader[7].ToString()) + (!string.IsNullOrEmpty(tblReader[7].ToString()) ? name : "") + "</td></tr>"); cnt++; } tblReader.Close(); sbSchd.Append("</table>"); result = result.Replace("{WeeklySchedule}", sbSchd.ToString()); } result = result.Replace("\n\r", "<br />"); return result; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.PaymentMenu("paymentreports"); if (!Utils.User.UserRoleByName("Payment - Reports").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); StringBuilder rowshtml = new StringBuilder(); string fromdate = Request.Form["fromdate"]; if (string.IsNullOrEmpty(fromdate)) fromdate = DateTime.Today.ToString("MM/dd/yyyy"); string todate = Request.Form["todate"]; if (string.IsNullOrEmpty(todate)) todate = DateTime.Today.AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy"); string summaryby = Request.Form["summaryby"]; string incstd = Request.Form["incstudent"]; if (string.IsNullOrEmpty(summaryby)) summaryby = ""; if (string.IsNullOrEmpty(incstd)) incstd = ""; if (IsPostBack) { bool canReport = true; if (!string.IsNullOrEmpty(fromdate)) { try { DateTime fromdt = Convert.ToDateTime(fromdate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("From Date is Required."); canReport = false; } if (!string.IsNullOrEmpty(todate)) { try { DateTime todt = Convert.ToDateTime(todate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("To Date is Required."); canReport = false; } if (canReport) { BestField bffromdate = new BestField() { fieldName = "fromdate", fieldSize = 40, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTimeStamp, displayField = false }; bffromdate.fieldValue = fromdate; BestField bftodate = new BestField() { fieldName = "todate", fieldSize = 40, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTimeStamp, displayField = false }; bftodate.fieldValue = todate; string tsql = "select paymentDate, bpd.amount, (firstname + ' ' + lastname) from BestPaymentDetails bpd inner join BestStudents bstd on bstd.guidfield = bpd.studentGuid where paymentdate >= ? and paymentdate <= ? AND BSTD.CENTERID=?"; if (!string.IsNullOrEmpty(summaryby)) { tsql = "select [paramGroupBy], sum(bpd.amount) as payAmount [paramStudents] from BestPaymentDetails bpd inner join BestStudents bstd on bstd.guidfield = bpd.studentGuid where paymentdate >= ? and paymentdate <= ? AND BSTD.CENTERID=? group by [paramGroupBy] [paramStudents]"; if (summaryby.Equals("paymonth")) { tsql = tsql.Replace("[paramGroupBy]", "datename(MONTH, paymentDate)"); } else if (summaryby.Equals("payweek")) { } else if (summaryby.Equals("payyear")) { tsql = tsql.Replace("[paramGroupBy]", "year(paymentdate)"); } else { tsql = tsql.Replace("[paramGroupBy]", "paymentdate"); } if (incstd.Equals("on")) { tsql = tsql.Replace("[paramStudents]", ",(firstname + ' ' + lastname)"); } else { tsql = tsql.Replace("[paramStudents]", ""); } } BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; myCmd.Parameters.Add(bffromdate.Param); myCmd.Parameters.Add(bftodate.Param); myCmd.Parameters.Add(Utils.User.CenterIdField.Param); OleDbDataReader tblReader = myCmd.ExecuteReader(); double total = 0; rowshtml.Append("<br /><div id=\"paymentReport\"><table class=\"tblreports\" cellspacing=\"0\" cellpadding=\"0\">"); rowshtml.Append("<thead><tr><td colspan=\"9\" style=\"font-weight:bold;font-size:12px;\">" + Utils.User.CenterId + " Payments Report</td></thead>"); rowshtml.Append("<tr><th style=\"text-align:center;\">Payment By</th>"); if (incstd.Equals("on")) { rowshtml.Append("<th style=\"text-align:center;\">Student Name</th>"); } rowshtml.Append("<th style=\"text-align:center;\">Amount</th></tr>"); while (tblReader.Read()) { string paydate = tblReader[0].ToString(); double payAmt = Convert.ToDouble(tblReader[1].ToString()); total += payAmt; rowshtml.Append("<tr><td>" + paydate.Replace("12:00:00 AM","") + "</td>"); if (incstd.Equals("on")) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(tblReader[2].ToString()) + "</td>"); } rowshtml.Append("<td class=\"ra\" style=\"padding-right:3px;\">" + payAmt.ToString("0.00") + "</td></tr>"); } rowshtml.Append("<tr><th>Total</th>"); if (incstd.Equals("on")) rowshtml.Append("<th> </th>"); rowshtml.Append("<th class=\"ra\" style=\"padding-right:3px;\">" + total.ToString("0.00") + "</th></tr>"); rowshtml.Append("</table></div><br />"); rowshtml.Append("<div><input type=\"button\" value=\"Print\" onclick=\"PrintTable('paymentReport');\" /></div>"); } } StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"centered\">"); sb.Append("<table class=\"bestgrid\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); sb.Append("<tr><td style=\"text-align:center;\" colspan=\"4\">Payment Reports</td></tr>"); sb.Append("<tr><td>From Date <input type=\"text\" id=\"fromdate\" name=\"fromdate\" size=\"9\" maxlength=\"10\" value=\"" + fromdate + "\" /></td><td>To Date <input type=\"text\" id=\"todate\" name=\"todate\" size=\"9\" maxlength=\"10\" value=\"" + todate + "\" /></td></tr>"); sb.Append("<tr><td>Summary By <select id=\"summaryby\" name=\"summaryby\"><option value=\"\"></option>"); sb.Append("<option value=\"paydate\" " + (summaryby.Equals("paydate") ? " selected " : "") + ">Payment Date</option>"); sb.Append("<option value=\"payweek\" " + (summaryby.Equals("payweek") ? " selected " : "") + ">Week</option>"); sb.Append("<option value=\"paymonth\" " + (summaryby.Equals("paymonth") ? " selected " : "") + ">Month</option>"); sb.Append("<option value=\"payyear\" " + (summaryby.Equals("payyear") ? " selected " : "") + ">Year</option>"); sb.Append("</select></td>"); sb.Append("<td><input type=\"checkbox\" id=\"incstudent\" name=\"incstudent\" " + (incstd.Equals("on") ? " checked " : "") + " /><label for=\"incstudent\">Include Student</label></td></tr>"); sb.Append("<tr><td colspan=\"2\"><input type=\"button\" value=\"Report\" onclick=\"submit();\" /></td></tr>"); sb.Append("</table>"); ltrGrid.Text = sb.ToString() + rowshtml.ToString() + "</div>"; }
private void doCopySchedule(string copyType) { if (copyType.Equals("Week")) { string weekFrom = Request.Form["CopyFromWeekDate"] ?? ""; string weekTo = Request.Form["CopyToWeekDate"] ?? ""; if (!string.IsNullOrEmpty(weekFrom) && !string.IsNullOrEmpty(weekTo)) { BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "CopySchedules"; myCmd.CommandType = CommandType.StoredProcedure; myCmd.Parameters.Add(new OleDbParameter("BeginDate", weekFrom)); myCmd.Parameters.Add(new OleDbParameter("ToDate", weekTo)); myCmd.Parameters.Add(new OleDbParameter("CopyType", copyType)); try { myCmd.ExecuteNonQuery(); ltrMsg.Text = Utils.InfoMessage("Schedules Copied From" + weekFrom + " to " + weekTo); } catch (Exception ex) { ltrMsg.Text = Utils.WarningMessage(ex.Message); } } } else if(copyType.Equals("Day")) { string dayFrom = Request.Form["CopyFromDate"] ?? ""; string dayTo = Request.Form["CopyToDate"] ?? ""; if (!string.IsNullOrEmpty(dayFrom) && !string.IsNullOrEmpty(dayTo)) { BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "CopySchedules"; myCmd.CommandType = CommandType.StoredProcedure; myCmd.Parameters.Add(new OleDbParameter("BeginDate", dayFrom)); myCmd.Parameters.Add(new OleDbParameter("ToDate", dayTo)); myCmd.Parameters.Add(new OleDbParameter("CopyType", copyType)); try { myCmd.ExecuteNonQuery(); ltrMsg.Text = Utils.InfoMessage("Schedules Copied From" + dayFrom + " to " + dayTo); } catch (Exception ex) { ltrMsg.Text = Utils.WarningMessage(ex.Message); } } } }
public CurrentUserRole UserRoleByName(string rolename) { CurrentUserRole result = new CurrentUserRole(); if (curuserRoles == null) { curuserRoles = new List<CurrentUserRole>(); OleDbCommand myCmd = new BestDatabase().dbCmd; myCmd.CommandText = "select service, allowadd, allowedit, allowdelete, allowview from BestUserRoles where username = ?"; OleDbParameter p1 = new OleDbParameter("username", OleDbType.VarChar, 200); p1.Value = this.UserName; myCmd.Parameters.Add(p1); OleDbDataReader reader = myCmd.ExecuteReader(); while (reader.Read()) { CurrentUserRole trole = new CurrentUserRole(); trole.service = reader.GetValue(0).ToString(); trole.allowAdd = reader.GetValue(1).ToString().Equals("True"); trole.allowEdit = reader.GetValue(2).ToString().Equals("True"); trole.allowDelete = reader.GetValue(3).ToString().Equals("True"); trole.allowView = reader.GetValue(4).ToString().Equals("True"); curuserRoles.Add(trole); } } foreach (CurrentUserRole role in curuserRoles) { if (role.service.Equals(rolename)) { result = role; } } return result; }