protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.StudentMenu("studentpicture");
            if (!Utils.User.UserRoleByName("Student - Pictures").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

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

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Student Pictures";
            bsGrid.securityPage = "Student - Pictures";
            bsGrid.GridTable = new BestStudentPicture();
            bsGrid.allowAdd = false;
            bsGrid.allowEdit = false;
            bsGrid.allowDelete = false;

            bsGrid.extraRowHTML = "<a href=\"UploadPhoto.aspx?cid=[paramCID]&sid=[paramSID]\" target=\"_blank\"><img src=\"images\\user_edit.png\" alt=\"upload\" /></a>";
            ltrGrid.Text = bsGrid.ToHTML();
        }
Exemple #2
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.UtilityMenu("changelog");
            string ms = Request.QueryString["ms"];
            ltrMScript.Text = Utils.MenuSelectScript(ms);

            if (!Utils.User.UserRoleByName("Change Log").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Change Log";
            bsGrid.securityPage = "Change Log";
            bsGrid.GridTable = new LogChanges();
            bsGrid.allowAdd = false;
            bsGrid.allowDelete = false;
            bsGrid.allowEdit = false;
            ltrGrid.Text = bsGrid.ToHTML();
        }
Exemple #3
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }

            if (! Utils.User.UserRoleByName("Setup - Users").allowView)
            {
                Response.Write("You do not have view rights for this page.");
                return;
            }
            ltrSubMenu.Text = UtilMenu.SetupSubMenu("userinfo");

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

            ltrState.Text = Utils.StateOptions();

            if (IsPostBack)
            {
                BestUser bs = new BestUser();
                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)
                {
                    if (!string.IsNullOrEmpty(isnew))
                    {
                        bs.userName = Request.Form["g_userName"];
                        bs.emailId = Request.Form["g_emailId"];
                    }
                    if (string.IsNullOrEmpty(bs.userName))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("User Name is Required.");
                        cansave = false;
                    }
                    if (string.IsNullOrEmpty(bs.emailId))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("EMail Address is Required.");
                        cansave = false;
                    }

                    if (cansave)
                    {
                        bs.firstName = Request.Form["g_firstName"];
                        bs.lastName = Request.Form["g_lastName"];
                        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.gender = Request.Form["g_gender"];
                        bs.Centers = Request.Form["g_Centers"];
                        bs.userType = Request.Form["g_userType"];
                        string randPwd = RandomString(8);
                        bs.password = Utils.GetMD5Hash(randPwd);
                        bs.passwordExpiration = DateTime.Today.AddDays(3);

                        if (bs.CurrentRow.Save())
                        {
                            Utils.User.emailUtil.Send(bs.emailId, "BLC Login Information", @"<h2>Welcome to Bali Learning Center!</h2><br><h3>Your login information is enclosed.</h3>

            <b>Accessing Your Account</b><br>
            Step 1:<br>
            Click the link below or enter the URL below into your web browser<br>
            Address:	<a href=""http://best.vasbal.com"">Bali Learning Center Login</a><br><br>

            Step 2:<br>
            Enter the following user name and temporary password.<br>
            User Name: <b>" + bs.userName + @"</b><br>
            Password:   <b>" + randPwd + @"</b><br><br>

            <h3>This temporary password expires in 24 hours.</h3><br><br>

            You will be prompted to change your user name and password during your initial log in as well as answer a few security related questions. <br>
            <br>

            <br>
            <br>
            Thank you,<br>
            Bali Learning Center", bs.firstName + " " + bs.lastName);
                        }
                        else
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }

                    }
                }

            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "User Information";
            bsGrid.GridTable = new BestUser();
            bsGrid.whereClause = "usertype not in ('Student', 'Tutor')";
            bsGrid.securityPage = "Setup - Users";
            bsGrid.AfterAddHTML="<input type=\"button\" id=\"btnReserPwd\" onclick=\"resetPassword();\" value=\"Reset Password\" />";
            ltrGrid.Text = bsGrid.ToHTML();
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.PaymentMenu("paymentdetails");
            if (!Utils.User.UserRoleByName("Payment - Details").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"))
            {
                PaymentDetails bs = new PaymentDetails();
                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)
                {
                    string stdguid = Request.Form["g_studentGuid"];
                    string payguid = Request.Form["g_paymentTypeGuid"];
                    string amt = Request.Form["g_amount"];
                    string paydate = Request.Form["g_paymentDate"];
                    string hours = Request.Form["g_hours"];
                    if (string.IsNullOrEmpty(payguid))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Payment Type is Required.");
                        cansave = false;
                    }
                    if (string.IsNullOrEmpty(stdguid))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Student is Required.");
                        cansave = false;
                    }
                    if (string.IsNullOrEmpty(paydate))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Payment Date is Required.");
                        cansave = false;
                    }
                    if (cansave)
                    {
                        bs.studentGuid = new Guid(stdguid);
                        bs.paymentTypeGuid = new Guid(payguid);
                        bs.amount = amt;
                        Decimal dhours;
                        Decimal.TryParse(hours, out dhours);
                        bs.hours = dhours;
                        bs.paymentDate = Convert.ToDateTime(paydate);
                        bs.CenterId = Utils.User.CenterId;

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

            PaymentTypes bpayTypes = new PaymentTypes();
            bpayTypes.LoadRows();
            StringBuilder sbc = new StringBuilder();
            sbc.Append("<option value=\"\"></option>");
            for (int rnum = 0; rnum < bpayTypes.TableRows.Count; rnum++)
            {
                string paytype = bpayTypes.TableRows[rnum].Fields["paymentType"].fieldValue;
                string guid = bpayTypes.TableRows[rnum].Fields["guidfield"].fieldValue;
                sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(guid) + "\">" + HttpUtility.HtmlEncode(paytype) + "</option>");
            }
            ltrPayTypes.Text = sbc.ToString();

            /* Auto Student */
            string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}";
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("autoStudents = [");
            BestStudents bstd = new BestStudents();
            bstd.LoadRows("CenterId=?", Utils.User.CIdParam);
            for (int s = 0; s < bstd.TableRows.Count; s++)
            {
                string result = autoSample;
                result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue);
                result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " +
                    (bstd.TableRows[s].Fields["lastName"].fieldValue ?? "")));
                sb.Append(result);
                if (s < bstd.TableRows.Count - 1) sb.AppendLine(",");
            }
            sb.AppendLine("];");
            ltrScript.Text = @"<script type=""text/javascript"">
            $(document).ready(function(){ " + sb.ToString() + @"
            $('#studentTag1').autocomplete( { source:autoStudents, delay: 0, select : function( event, ui){
            $('#studentGuid').val( ui.item.value );
            $( this ).val( ui.item.label );
            return false;
            } } ); }); </script>";

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Payment Details";
            bsGrid.GridTable = new PaymentDetails();
            bsGrid.securityPage = "Payment - Details";
            ltrGrid.Text = bsGrid.ToHTML();
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.UtilityMenu("exportexcel");

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

            if (!Utils.User.UserRoleByName("Export To Excel").allowView)
            {
                ltrValidateMsg.Text = "You do not have rights to view.";
                return;
            }

            if (IsPostBack)
            {
                BestExports bs = new BestExports();
                string isnew = Request.Form["isnew"];
                bool cansave = true;
                Guid exportGuid = Guid.NewGuid();
                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 (Utils.IsGuid(guid.fieldValue))
                    {
                        exportGuid = new Guid(guid.fieldValue);
                    }

                    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;
                    }
                }
                else
                {
                    bs.guidfield = exportGuid;
                }

                if (cansave)
                {
                    if (!string.IsNullOrEmpty(isnew)) { bs.exportName = Request.Form["g_exportName"]; }
                    if (string.IsNullOrEmpty(bs.exportName))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Export Name is Required.");
                        cansave = false;
                    }
                    if (cansave)
                    {
                        bs.exportType = Request.Form["g_exportType"];
                        bs.exportTitle = Request.Form["g_exportTitle"];
                        if (!bs.CurrentRow.Save())
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }
                        else
                        {
                            /* Insert or Update Export Fields */
                            string FieldData = Request.Form["hidExportData"] ?? "";
                            if (!string.IsNullOrEmpty(FieldData))
                            {
                                string[] lines = FieldData.Split('\n');
                                int i = 0;
                                foreach (string line in lines)
                                {
                                    if (!string.IsNullOrEmpty(line))
                                    {
                                        string[] fields = line.Replace("\r","").Split('\t');
                                        //0.guidfield 1.exportguid 2.fieldname 3.displayname 4.isnew 5.isdeleted
                                        if (fields[4].Equals("1"))
                                        {
                                            if (fields[5].Equals("0") && (!string.IsNullOrEmpty(fields[2])))
                                            {
                                                /* Add New */
                                                BestExportFields bexpfld = new BestExportFields();
                                                bexpfld.exportguid = exportGuid;
                                                bexpfld.fieldName = fields[2];
                                                bexpfld.displayName = fields[3];
                                                int idx;
                                                int.TryParse(fields[6], out idx);
                                                bexpfld.Ordinal = idx;
                                                if (!bexpfld.CurrentRow.Save())
                                                {
                                                    ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            /* Update */
                                            List<BestField> bparam = new List<BestField>();
                                            BestField fguid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false };
                                            fguid.fieldValue = fields[0];
                                            bparam.Add(fguid);
                                            BestExportFields bsFields = new BestExportFields();
                                            bsFields.LoadRows("guidfield=?", bparam);
                                            bsFields.fieldName = fields[2];
                                            bsFields.displayName = fields[3];
                                            int idx;
                                            int.TryParse(fields[6], out idx);
                                            bsFields.Ordinal = idx;
                                            bsFields.CurrentRow.IsDelete = fields[5].Equals("1");
                                            if (!bsFields.CurrentRow.Save())
                                            {
                                                ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if ((Request.Form["SaveAndExport"] ?? "").Equals("1"))
                {
                    ltrExportScript.Text = @"<script type=""text/javascript"">$(document).ready(function(){
                            $('#addiframe').html('<iframe src = ""DownloadExport.aspx?exportguid=" + exportGuid + @""" /></iframe>');
                    });</script>";
                }
            }

            ltrPageScript.Text = "<script type=\"text/javascript\">" + ExportFieldJS() +"\n" + ExportMastTableJs() + "</script>";

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Export Information";
            bsGrid.securityPage = "Export To Excel";
            bsGrid.GridTable = new BestExports();
            bsGrid.extraRowHTML = "<a href=\"DownloadExport.aspx?exportguid=[paramGuid]\" ><img src=\"images\\xls.gif\" alt=\"runexport\" /></a>";
            ltrGrid.Text = bsGrid.ToHTML();
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.SetupSubMenu("services");
            if (!Utils.User.UserRoleByName("Setup - Services").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

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

            string saveClicked = Request.Form["SaveClicked"] ?? "";
            if (IsPostBack && saveClicked.Equals("1"))
            {
                BestServices bs = new BestServices();
                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.Service = Request.Form["g_Service"];
                    bs.CenterId = Request.Form["g_CenterId"];
                    if (string.IsNullOrEmpty(bs.Service))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("Service is Required.");
                        cansave = false;
                    }
                    if (cansave)
                    {
                        if (!bs.CurrentRow.Save())
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }
                    }
                }
            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Services Information";
            bsGrid.GridTable = new BestServices();
            bsGrid.securityPage = "Setup - Services";
            bsGrid.orderby = "service";
            ltrGrid.Text = bsGrid.ToHTML();
        }
Exemple #7
0
        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();
        }
        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();
        }
        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();
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.StudentMenu("studentdocument");
            if (!Utils.User.UserRoleByName("Student - Documents").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

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

            string saveClicked = Request.Form["SaveClicked"] ?? "";
            if (IsPostBack && saveClicked.Equals("1"))
            {
                BestDocuments bs = new BestDocuments();
                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)
                {
                    if (!string.IsNullOrEmpty(isnew))
                    {
                        string guid = Request.Form["g_studentGuid"];
                        if (string.IsNullOrEmpty(guid))
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage("Student Name is Required.");
                            cansave = false;
                        }
                        bs.studentGuid = new Guid(guid);
                    }
                    if (cansave)
                    {
                        bool showToStudent = (Request.Form["g_showToStudent"] ?? "").ToLower().Equals("true");
                        bs.showToStudent = showToStudent;
                        string docdate = Request.Form["g_documentDate"];
                        if (!string.IsNullOrEmpty(docdate))
                        {
                            bs.documentDate = Convert.ToDateTime(docdate);
                        }
                        bs.documentTitle = Request.Form["g_documentTitle"];
                        string expdate = Request.Form["g_documentExpiry"];
                        if (!string.IsNullOrEmpty(expdate))
                        {
                            bs.documentExpiry = Convert.ToDateTime(expdate);
                        }
                        bs.CenterId = Utils.User.CenterId;
                        BestStudents bestStd = new BestStudents();
                        bestStd.LoadRows("guidfield=?", "studentguid", bs.studentGuid, "");
                        bs.StudentId = bestStd.StudentId;

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

            /* Auto Student */
            string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}";
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("autoStudents = [");
            BestStudents bstd = new BestStudents();
            bstd.LoadRows("CenterId=?", Utils.User.CIdParam);
            for (int s = 0; s < bstd.TableRows.Count; s++)
            {
                string result = autoSample;
                result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue);
                result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " +
                    (bstd.TableRows[s].Fields["lastName"].fieldValue ?? "")));
                sb.Append(result);
                if (s < bstd.TableRows.Count - 1) sb.AppendLine(",");
            }
            sb.AppendLine("];");
            ltrScript.Text = @"<script type=""text/javascript"">
            $(document).ready(function(){ " + sb.ToString() + @"
            $('#studentTag1').autocomplete( { source:autoStudents, delay: 0, select : function( event, ui){
            $('#studentGuid').val( ui.item.value );
            $( this ).val( ui.item.label );
            return false;
            } } ); }); </script>";

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Student Documents";
            bsGrid.securityPage = "Student - Documents";
            bsGrid.GridTable = new BestDocuments();
            bsGrid.extraRowHTML = "<span><a href=\"javascript:void(0);\" onclick=\"showUploadDocument('[paramCID]','[paramSID]','[paramGuid]', [paramRowNum]);\" title=\"Upload Document\" ><img src=\"images\\folder_page.png\" alt=\"upload\" /></a></span><span><a href=\"javascript:void(0);\" onclick=\"DownloadDocument('[paramGuid]','[paramCID]','[paramSID]');\" title=\"Download Document\"><img src=\"images\\page_white_put.png\" alt=\"upload\" /></a></span>";
            bsGrid.whereClause = "";
            ltrGrid.Text = bsGrid.ToHTML();
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.StudentMenu("studentusers");
            if (!Utils.User.UserRoleByName("Student - Users").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

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

            string saveClicked = Request.Form["SaveClicked"] ?? "";
            if (IsPostBack && saveClicked.Equals("1"))
            {
                BestField fld = new BestField() { fieldName = "guidfield", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldType = "System.Guid" };
                List<BestField> bparam = new List<BestField>();
                string delguid = Request.Form["deleteguid"];
                if (!string.IsNullOrEmpty(delguid))
                {
                    BestUser bsduser = new BestUser();
                    fld.fieldValue = delguid;
                    bparam.Add(fld);
                    bsduser.LoadRows("guidfield=?", bparam);
                    bsduser.CurrentRow.IsDelete = true;
                    if (!bsduser.CurrentRow.Save())
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage(bsduser.CurrentRow.lastError);
                    }
                }
                else
                {
                    string stdGud = Request.Form["studentTag10"];
                    if (!string.IsNullOrEmpty(stdGud))
                    {
                        fld.fieldValue = stdGud;
                        bparam.Add(fld);
                        BestStudents bstud = new BestStudents();
                        bstud.LoadRows("guidfield=?", bparam);
                        if (!bstud.CurrentRow.IsNew)
                        {
                            if (string.IsNullOrEmpty(bstud.emailId))
                            {
                                ltrValidateMsg.Text = Utils.WarningMessage("Student E-Mail Address is Required.");
                            }
                            else
                            {
                                BestUser bstuser = new BestUser();
                                bstuser.userName = bstud.emailId;
                                bstuser.firstName = bstud.firstName;
                                bstuser.lastName = bstud.lastName;
                                bstuser.address1 = bstud.address1;
                                bstuser.address2 = bstud.address2;
                                bstuser.city = bstud.city;
                                bstuser.state = bstud.state;
                                bstuser.zip = bstud.zip;
                                bstuser.cellPhone = bstud.cellPhone;
                                bstuser.workPhone = bstud.workPhone;
                                bstuser.homePhone = bstud.homePhone;
                                bstuser.studentGuid = bstud.guidfield;
                                bstuser.Centers = bstud.CenterId;

                                bstuser.emailId = bstud.emailId;
                                bstuser.userType = "Student";
                                string randPwd = RandomString(8);
                                bstuser.password = Utils.GetMD5Hash(randPwd);
                                bstuser.passwordExpiration = DateTime.Today.AddDays(3);
                                if (bstuser.CurrentRow.Save())
                                {
                                    Utils.User.emailUtil.Send(bstuser.emailId, "BLC Login Information", @"<h2>Welcome to Bali Learning Center!</h2><br><h3>Your login information is enclosed.</h3>

            <b>Accessing Your Account</b><br>
            Step 1:<br>
            Click the link below or enter the URL below into your web browser<br>
            Address:	<a href=""http://best.vasbal.com"">Bali Learning Center Login</a><br><br>

            Step 2:<br>
            Enter the following user name and temporary password.<br>
            User Name: <b>" + bstuser.userName + @"</b><br>
            Password:   <b>" + randPwd + @"</b><br><br>

            <h3>This temporary password expires in 24 hours.</h3><br><br>

            You will be prompted to change your user name and password during your initial log in as well as answer a few security related questions. <br>
            <br>

            <br>
            <br>
            Thank you,<br>
            Bali Learning Center", bstuser.firstName + " " + bstuser.lastName);

                                    /* Create Studet - Personal Role  */
                                    List<BestField> bparams = new List<BestField>();
                                    BestField paramUName = new BestField() { fieldName = "username", fieldSize = 80, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false };
                                    paramUName.fieldValue = bstuser.userName;
                                    BestField service = new BestField() { fieldName = "service", fieldSize = 80, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false };
                                    bparams.Add(paramUName);
                                    bparams.Add(service);

                                    string[] aryRoles = { "2.Students", "Student - Personal", "Student - Planner" };
                                    for (int i = 0; i < aryRoles.Length; i++)
                                    {
                                        UserRoles urole = new UserRoles();
                                        bparams[1].fieldValue = aryRoles[i];
                                        urole.LoadRows("username = ? and service=?", bparams);
                                        if (urole.TableRows.Count == 0)
                                        {
                                            urole.Service = aryRoles[i];
                                            urole.UserName = bstuser.userName;
                                            urole.allowView = "1";
                                            urole.CurrentRow.Save();
                                        }
                                    }
                                }
                                else
                                {
                                    ltrValidateMsg.Text = Utils.WarningMessage( bstuser.CurrentRow.lastError);
                                }

                            }
                        }
                    }
                }
            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Student Users";
            bsGrid.securityPage = "Student - Users";
            BestUser bsuser = new BestUser();
            bsuser.overrideAdd = Utils.User.UserRoleByName("Student - Users").allowAdd;
            bsuser.overrideDelete = Utils.User.UserRoleByName("Student - Users").allowDelete;
            bsuser.overrideEdit = false;

            bsuser.TableFields["address1"].displayField = false;
            bsuser.TableFields["address2"].displayField = false;
            bsuser.TableFields["city"].displayField = false;
            bsuser.TableFields["zip"].displayField = false;
            bsuser.TableFields["state"].displayField = false;
            bsuser.TableFields["Centers"].displayField = false;
            bsGrid.GridTable = bsuser;
            bsGrid.whereClause = "usertype in ('Student')";
            ltrGrid.Text = bsGrid.ToHTML();

            /* Auto Student */
            StringBuilder sb = new StringBuilder();
            string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}";
            sb.AppendLine("<script type=\"text/javascript\">");
            sb.AppendLine("autoStudents = [");
            BestStudents bstd = new BestStudents();
            bstd.LoadRows();
            for (int s = 0; s < bstd.TableRows.Count; s++)
            {
                string result = autoSample;
                result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue);
                result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " +
                    (bstd.TableRows[s].Fields["lastName"].fieldValue ?? "")));
                sb.Append(result);
                if (s < bstd.TableRows.Count - 1) sb.AppendLine(",");
            }
            sb.AppendLine("];");
            sb.AppendLine("</script>");
            this.ltrScript.Text = sb.ToString();
        }
Exemple #12
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.TutorMenu("tutornotes");
            if (!Utils.User.UserRoleByName("Tutor - Notes").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

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

            string saveClicked = Request.Form["SaveClicked"] ?? "";
            if (IsPostBack && saveClicked.Equals("1"))
            {
                BestTutorNotes bs = new BestTutorNotes();
                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)
                {
                    if (!string.IsNullOrEmpty(isnew))
                    {
                        string guid = Request.Form["g_tutorGuid"];
                        if (string.IsNullOrEmpty(guid))
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage("Tutor Name is Required.");
                            cansave = false;
                        }
                        bs.tutorGuid = new Guid(guid);
                    }
                    if (cansave)
                    {
                        string notedate = Request.Form["g_noteDate"];
                        if (!string.IsNullOrEmpty(notedate))
                        {
                            bs.noteDate = Convert.ToDateTime(notedate);
                        }
                        bs.notes = Request.Form["g_notes"];
                        bs.CenterId = Utils.User.CenterId;

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

            /* Auto Student */
            string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}";
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("autoTutors = [");
            BestTutors bstd = new BestTutors();
            bstd.LoadRows("CenterId=?", Utils.User.CIdParam);
            for (int s = 0; s < bstd.TableRows.Count; s++)
            {
                string result = autoSample;
                result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue);
                result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " +
                    (bstd.TableRows[s].Fields["lastName"].fieldValue ?? "")));
                sb.Append(result);
                if (s < bstd.TableRows.Count - 1) sb.AppendLine(",");
            }
            sb.AppendLine("];");
            ltrScript.Text = @"<script type=""text/javascript"">
            $(document).ready(function(){ " + sb.ToString() + @"
            $('#tutorTag1').autocomplete( { source:autoTutors, delay: 0, select : function( event, ui){
            $('#tutorGuid').val( ui.item.value );
            $( this ).val( ui.item.label );
            return false;
            } } ); }); </script>";

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "Tutor Notes";
            bsGrid.GridTable = new BestTutorNotes();
            bsGrid.securityPage = "Tutor - Notes";
            ltrGrid.Text = bsGrid.ToHTML();
        }