Beispiel #1
0
        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) + "\" />";
        }
Beispiel #2
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.StudentMenu("studentinfo");
            if (!Utils.User.UserRoleByName("Student - Information").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

            string ms = Request.QueryString["ms"];
            ltrMScript.Text = Utils.MenuSelectScript(ms);

            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;
                sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(cid) + "\">" + HttpUtility.HtmlEncode(cid) + "</option>");
            }
            this.ltrCenters.Text = sbc.ToString();

            StringBuilder jsbp = new StringBuilder();
            jsbp.Append("jsProg=[");
            StringBuilder sbp = new StringBuilder();
            sbp.Append("<option value=\"\"></option>");
            BestPrograms bps = new BestPrograms();
            bps.LoadRows();
            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(",");

            }
            jsbp.Append("]");
            this.ltrProgScript.Text = "<script type=\"text/javascript\">" + jsbp.ToString() + "</script>";
            this.ltrPrograms.Text = sbp.ToString();

            this.ltrStateOpts.Text = Utils.StateOptions();

            if (IsPostBack)
            {
                BestStudents bs = new BestStudents();
                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.StudentId = Request.Form["g_StudentId"];
                    bs.CenterId = Request.Form["g_CenterId"];
                    bs.firstName = Request.Form["g_firstName"];
                    bs.lastName = Request.Form["g_lastName"];
                    if (string.IsNullOrEmpty(bs.StudentId))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Student Id is Required.");
                        cansave = false;
                    }
                    if (string.IsNullOrEmpty(bs.CenterId))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Center 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.parentName = Request.Form["g_parentName"];
                        if(!string.IsNullOrEmpty(Request.Form["g_programGuid"]))
                            bs.programGuid = new Guid(Request.Form["g_programGuid"]);
                        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.Hours = Request.Form["g_Hours"];
                        bs.hourType = Request.Form["g_hourType"];
                        bs.amountType = Request.Form["g_amountType"];
                        bs.Amount = Request.Form["g_Amount"];
                        string joinDate = Request.Form["g_joinDate"];
                        if (!string.IsNullOrEmpty(joinDate))
                        {
                            bs.joinDate = Convert.ToDateTime(joinDate);
                        }
                        string birthDate = Request.Form["g_birthDate"];
                        if (!string.IsNullOrEmpty(birthDate))
                        {
                            bs.joinDate = Convert.ToDateTime(birthDate);
                        }

                        if (!bs.CurrentRow.Save())
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }
                    }
                }
            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Students Information";
            bsGrid.GridTable = new BestStudents();
            bsGrid.securityPage = "Student - Information";
            ltrGrid.Text = bsGrid.ToHTML();
        }
Beispiel #3
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.ProgramMenu("programinfo");
            if (!Utils.User.UserRoleByName("Program - Information").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

            string ms = Request.QueryString["ms"];
            ltrMScript.Text = Utils.MenuSelectScript(ms);

            string saveClicked = Request.Form["SaveClicked"] ?? "";
            if (IsPostBack && saveClicked.Equals("1"))
            {
                BestPrograms bs = new BestPrograms();
                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.programName = Request.Form["g_programName"];
                    bs.programType = Request.Form["g_programType"];

                    if (string.IsNullOrEmpty(bs.programType))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Program Type is Required.");
                        cansave = false;
                    }
                    if (cansave)
                    {
                        bs.amount = Request.Form["g_amount"];
                        bs.amountType = Request.Form["g_amountType"];
                        if (!bs.CurrentRow.Save())
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }
                    }
                }
            }

            StringBuilder sb = new StringBuilder();
            ProgramTypes bprgTypes = new ProgramTypes();
            bprgTypes.LoadRows();
            sb.Append("<option value=\"\"></option>");
            for(int rowNum = 0; rowNum < bprgTypes.TableRows.Count; rowNum++)
            {
                sb.Append("<option value=\"" + HttpUtility.HtmlEncode(bprgTypes.TableRows[rowNum].Fields["programType"].fieldValue) + "\">" + HttpUtility.HtmlEncode(bprgTypes.TableRows[rowNum].Fields["programType"].fieldValue) + "</option>");
            }
            ltrprgTypeOptions.Text = sb.ToString();

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Programs Information";
            bsGrid.GridTable = new BestPrograms();
            bsGrid.securityPage = "Program - Information";
            ltrGrid.Text = bsGrid.ToHTML();
        }
Beispiel #4
0
        private string StudentPrograms()
        {
            StringBuilder sbprog = new StringBuilder();
            BestStudentPrograms bstdProg = new BestStudentPrograms();
            bstdProg.LoadRows("CenterId=? and programguid in (select guidfield from bestprograms where amountType not in ('OneTime', 'Year'))", Utils.User.CIdParam, "studentguid");
            sbprog.AppendLine("StudentProgs = [");
            string firstguid = "";
            int sequence = 0;
            for (int i = 0; i < bstdProg.TableRows.Count; i++)
            {
                bstdProg.currentRowId = i;
                if (!firstguid.Equals(bstdProg.studentGuid.ToString()))
                {
                    sequence = 0;
                    firstguid = bstdProg.studentGuid.ToString();
                }
                sequence++;
                sbprog.Append("{guidfield:\"" + bstdProg.guidfield.ToString() + "\",studentguid:\"" + bstdProg.studentGuid.ToString() + "\", progGuid:\"" + bstdProg.programguid.ToString() + "\", Amount:" + bstdProg.Amount.ToString("0.00") + ", Index:" + sequence.ToString() + "}");
                if (i < bstdProg.TableRows.Count - 1) sbprog.Append(",");
            }
            sbprog.AppendLine("]");

            sbprog.AppendLine("jsProg=[");
            BestPrograms bps = new BestPrograms();
            bps.LoadRows();
            for (int rnum = 0; rnum < bps.TableRows.Count; rnum++)
            {
                bps.currentRowId = rnum;
                sbprog.Append("{guid:\"" + bps.guidfield.ToString() + "\",amount:\"" + bps.amount + "\",amountType:\"" + bps.amountType + "\",progName:\"" + bps.programName + "\",progType:\"" + bps.programType + "\"}");
                if (rnum < bps.TableRows.Count - 1) sbprog.Append(",");
            }
            sbprog.Append("]");

            return sbprog.ToString();
        }