コード例 #1
0
        public static void NewUserNotification(string MemberId)
        {
            RentALanguageTeacher.user Admin = UserService.GetUserById(Convert.ToInt32(AppConfiguration.AdminID));

            MembershipUser MyUser = MemberShipService.GetUserById(MemberId);

            int MemberIdInt = Convert.ToInt32(MemberId);

            RentALanguageTeacher.user MyRALTUser = UserService.GetUserByMemberId(MemberIdInt);

            DateTime LocalTime = App_Code.TimeService.GetUserLocalTime(MyRALTUser);

            location MyLocation = LocationService.GetUserById(MyRALTUser.user_id);

            quickregistration MyQuickReg = QuickRegService.GetObjectByUserId(MyRALTUser.user_id);

            double TimeDifference = App_Code.TimeService.GetTimeZoneDifference(MyRALTUser, Admin);

            DateTime GTStartDate = TimeService.ConvertToMyTime(Convert.ToDateTime(MyQuickReg.start_date), Admin);

            DateTime UserStartDate = TimeService.ConvertToMyTime(Convert.ToDateTime(MyQuickReg.start_date), MyRALTUser);

            TimeSpan span = new TimeSpan(0, 3, 0, 0, 0);

            string GTBlockTime   = GTStartDate.ToString() + " - " + GTStartDate.Add(span).ToString();
            string UserBlockTime = UserStartDate.ToString() + " - " + UserStartDate.Add(span).ToString();

            string fileName = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/NewUserReg.txt");
            string mailBody = File.ReadAllText(fileName);

            mailBody = mailBody.Replace("##FirstName##", MyRALTUser.first_name);
            mailBody = mailBody.Replace("##LastName##", MyRALTUser.last_name);
            mailBody = mailBody.Replace("##Age##", MyRALTUser.age.ToString());
            mailBody = mailBody.Replace("##UserName##", MyUser.UserName);

            mailBody = mailBody.Replace("##Nationality##", MyRALTUser.nationality);
            mailBody = mailBody.Replace("##Email##", MyRALTUser.email);
            mailBody = mailBody.Replace("##Country##", MyLocation.country.short_name);
            mailBody = mailBody.Replace("##LocalTime##", LocalTime.ToString());
            mailBody = mailBody.Replace("##TZDiff##", TimeDifference.ToString());

            mailBody = mailBody.Replace("##Classes##", MyQuickReg.classes.ToString());
            mailBody = mailBody.Replace("##Period##", MyQuickReg.period);
            mailBody = mailBody.Replace("##Duration##", MyQuickReg.class_duration.ToString());
            mailBody = mailBody.Replace("##StartDate##", GTBlockTime);
            mailBody = mailBody.Replace("##StartDateUser##", UserBlockTime);
            mailBody = mailBody.Replace("##Level##", MyQuickReg.languagel_evel.ToString());
            mailBody = mailBody.Replace("##SpecialRequests##", MyQuickReg.specialrequests);

            MailMessage myMessage = new MailMessage();

            myMessage.Subject = "New Registration";
            myMessage.Body    = mailBody;
            myMessage.From    = new MailAddress(InfoAddress, InfoName);
            myMessage.To.Add(new MailAddress(InfoAddress, InfoName));
            SmtpClient mySmtpClient = new SmtpClient();

            mySmtpClient.Send(myMessage);
        }
コード例 #2
0
        public static int SaveObject(quickregistration MyObject)
        {
            //get method name
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            //initialize entities
            var ctx = new rentalanguageteacherEntities();
            {
                try
                {
                    log.Debug(MethodName + "**********************************************************************************************************");
                    log.Debug(MethodName + "() - Start");

                    //Check object state, add or update

                    if (MyObject.quick_registration_id == 0)
                    {
                        //Add new object
                        ctx.quickregistrations.Add(MyObject);
                        log.Debug(MethodName + "() - New object added");
                    }

                    else
                    {
                        //Update object
                        ctx.Entry(MyObject).State = System.Data.EntityState.Detached;
                        ctx.Entry(MyObject).State = System.Data.EntityState.Modified;
                        // log.Debug(MethodName + "() - The object for ID " + MyObject.quick_registration_id + " was updated");
                    }

                    //save context changes
                    int num = ctx.SaveChanges();

                    //return?
                    return(num);
                }

                catch (Exception e)
                {
                    log.Error(MethodName + "() - " + e.Message);
                    log.Debug(MethodName + "() - " + e.StackTrace);
                    throw (e);
                }

                finally
                {
                    log.Debug(MethodName + "() - Finish");
                    log.Debug(MethodName + "**********************************************************************************************************");
                }
            }
        }
コード例 #3
0
        protected void UpDateStudent_Click(object sender, EventArgs e)
        {
            //Validate Page
            Page.Validate("AdministerStudent");

            if (Page.IsValid)
            {
                try
                {
                    MembershipUser = (MembershipUser)Session["MembershipUser"];
                    UserData       = (user)Session["UserData"];

                    //user MyUser = UserService.GetUserById(UserData.user_id);

                    quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id);

                    if (!object.ReferenceEquals(MyReg, null))
                    {
                        MyReg.admin_comments = txtAdminComments.Text;

                        if (!object.ReferenceEquals(FirstClass.Value, ""))
                        {
                            MyReg.first_class = App_Code.TimeService.ConvertToUTC(Convert.ToDateTime(FirstClass.Value), UserData);
                        }


                        MyReg.teacher         = Teacher.Text;
                        MyReg.teacher_skypeid = TeacherSkype.Text;

                        QuickRegService.SaveObject(MyReg);

                        UserData.account_status = ddlStatus.SelectedItem.ToString();
                        UserService.SaveNewUser(UserData);

                        App_Code.NotificationService.SendNotification("AdministerStudentSuccess", "Sucessfully Updated", "success", "4000");
                    }
                }
                catch (Exception ex)
                {
                    App_Code.NotificationService.SendNotification("AdministerStudentError", ex.Message, "error", "4000");
                }
            }
            else
            {
                App_Code.NotificationService.SendNotification("AdministerStudentValidation", "Please complete the required fields", "error", "4000");
            }
        }
コード例 #4
0
        protected void Save_Click(object sender, EventArgs e)
        {
            if (UserComments.Text != "")
            {
                try
                {
                    //Get the logged in User if any
                    MembershipUser LoggedInMembershipUser;
                    LoggedInMembershipUser = Membership.GetUser();

                    //Check if there is a logged in User
                    if (LoggedInMembershipUser != null)
                    {
                        // ToInt32 can throw FormatException or OverflowException.
                        int UserId = -1;

                        //Get the RALT data from membership accountID
                        UserId = Convert.ToInt32(LoggedInMembershipUser.ProviderUserKey.ToString());
                        user UserData = UserService.GetUserByMemberId(UserId);

                        //Bind data
                        if (!object.ReferenceEquals(UserData, null))
                        {
                            quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id);

                            if (!object.ReferenceEquals(MyReg, null))
                            {
                                MyReg.student_comments = UserComments.Text;

                                QuickRegService.SaveObject(MyReg);

                                App_Code.NotificationService.SendNotification("AdministerStudentSuccess", "Sucessfully Updated", "success", "4000");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    App_Code.NotificationService.SendNotification("AdministerStudentError", ex.Message, "error", "4000");
                }
            }
        }
コード例 #5
0
        public static int DeleteObject(quickregistration MyObject)
        {
            //get method name
            string MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            //initialize entities
            var ctx = new rentalanguageteacherEntities();
            {
                try
                {
                    log.Debug(MethodName + "**********************************************************************************************************");
                    log.Debug(MethodName + "() - Start");

                    ctx.Entry(MyObject).State = System.Data.EntityState.Deleted;

                    //Delete user
                    ctx.quickregistrations.Remove(MyObject);

                    //save context changes
                    int num = ctx.SaveChanges();

                    //return?
                    return(num);
                }

                catch (Exception e)
                {
                    log.Error(MethodName + "() - " + e.Message);
                    log.Debug(MethodName + "() - " + e.StackTrace);
                    throw (e);
                }

                finally
                {
                    log.Debug(MethodName + "() - Finish");
                    log.Debug(MethodName + "**********************************************************************************************************");
                }
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //Bind DDLs
                // BindStatus();

                //Load Data
                try
                {
                    //Get the logged in User if any
                    MembershipUser LoggedInMembershipUser;
                    LoggedInMembershipUser = Membership.GetUser();

                    //Check if there is a logged in User
                    if (LoggedInMembershipUser != null)
                    {
                        //Membership Data
                        UserName.Text = LoggedInMembershipUser.UserName.ToString();
                        Email.Text    = LoggedInMembershipUser.Email.ToString();


                        //Disable controls
                        UserName.Enabled = false;
                        Email.Enabled    = false;

                        // ToInt32 can throw FormatException or OverflowException.
                        int UserId = -1;

                        try
                        {
                            //Get the RALT data from membership accountID
                            UserId = Convert.ToInt32(LoggedInMembershipUser.ProviderUserKey.ToString());
                            user UserData = UserService.GetUserByMemberId(UserId);

                            //Bind data
                            if (!object.ReferenceEquals(UserData, null))

                            {
                                if (UserData.account_status == "Request Made")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '0' + ");", true);
                                    PleasePayPanel.Visible = true;
                                    lblStatus.Visible      = false;
                                }
                                else if (UserData.account_status == "Verified")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '1' + ");", true);
                                    PleasePayPanel.Visible = true;
                                    lblStatus.Visible      = false;
                                }
                                else if (UserData.account_status == "Email Sent")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '2' + ");", true);
                                    PleasePayPanel.Visible = true;
                                    lblStatus.Visible      = false;
                                }
                                else if (UserData.account_status == "Paid")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '3' + ");", true);
                                    PleasePayPanel.Visible = false;
                                }
                                else if (UserData.account_status == "First Class")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '4' + ");", true);
                                    PleasePayPanel.Visible = false;
                                    lblStatus.Visible      = true;
                                    lblStatus.ForeColor    = System.Drawing.ColorTranslator.FromHtml("#edac1c");
                                    lblStatus.Text         = "Rent a Language Teacher appreciates your business! Please purchase another package on our <a href='/Prices' Title='Prices'>Prices</a> page.";

                                    //
                                }

                                BindPayments();

                                //Check for location data
                                location MyLocation = LocationService.GetUserById(UserData.user_id);

                                if (!object.ReferenceEquals(MyLocation, null))
                                {
                                }

                                //Check for location data
                                quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id);

                                if (!object.ReferenceEquals(MyReg, null))
                                {
                                    Teacher.Text       = MyReg.teacher;
                                    TeacherSkype.Text  = MyReg.teacher_skypeid;
                                    txtFirstClass.Text = App_Code.TimeService.ConvertToMyTime(Convert.ToDateTime(MyReg.first_class), UserData).ToString();
                                    RentALanguageTeacher.user Admin = UserService.GetUserById(Convert.ToInt32(AppConfiguration.AdminID));

                                    txtTeacherTime.Text = App_Code.TimeService.ConvertToMyTime(Convert.ToDateTime(MyReg.first_class), Admin).ToString();
                                    //ddlStatus.SelectedValue = UserData.account_status;
                                    UserComments.Text = MyReg.student_comments;
                                }
                            }
                        }

                        catch (FormatException)
                        {
                            //Console.WriteLine("Input string is not a sequence of digits.");
                            throw;
                        }
                        catch (OverflowException)
                        {
                            //Console.WriteLine("The number cannot fit in an Int32.");
                            throw;
                        }
                    }
                }



                catch (Exception)
                {
                    App_Code.NotificationService.SendNotification("StudentstatusErrorLoadError", "There was an error loading your account", "error", "4000");
                }
                LockControls();
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string StudentUN = Page.RouteData.Values["Student"] as string;

            if (!Page.IsPostBack)
            {
                //Bind DDLs
                BindCountry();
                BindNationality();
                BindStatus();


                //Load Data
                try
                {
                    //Get the logged in User if any

                    MembershipUser            = Membership.GetUser(StudentUN);
                    Session["MembershipUser"] = MembershipUser;


                    //Check if there is a logged in User
                    if (MembershipUser != null)
                    {
                        //Membership Data
                        UserName.Text = MembershipUser.UserName.ToString();
                        Email.Text    = MembershipUser.Email.ToString();


                        ////Disable controls
                        //UserName.Enabled = false;
                        //Email.Enabled = false;
                        //Password.Enabled = false;
                        //Confirm.Enabled = false;
                        //Password.Visible = false;
                        //lblPassword.Visible = false;
                        //Confirm.Visible = false;
                        //lblConfirm.Visible = false;

                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "AccountSetUpLogginIn", "GreyAccountInfo(" + '1' + ");", true);

                        //$(".first").addClass("second");

                        //RALT Data

                        // ToInt32 can throw FormatException or OverflowException.
                        int UserId = -1;

                        try
                        {
                            //Get the RALT data from membership accountID
                            UserId   = Convert.ToInt32(MembershipUser.ProviderUserKey.ToString());
                            UserData = (user)UserService.GetUserByMemberId(UserId);


                            Session["UserData"] = (user)UserData;

                            //Bind data
                            if (!object.ReferenceEquals(UserData, null))
                            {
                                FirstName.Text            = UserData.first_name;
                                Age.SelectedIndex         = (int)UserData.age;
                                LastName.Text             = UserData.last_name;
                                Nationality.SelectedValue = UserData.nationality;
                                ddlStatus.SelectedValue   = UserData.account_status;
                                SkypeID.Text = UserData.skype_id;

                                BindPayments();


                                //Check for location data
                                location MyLocation = LocationService.GetUserById(UserData.user_id);

                                if (!object.ReferenceEquals(MyLocation, null))
                                {
                                    //Address1.Text = MyLocation.line_1;
                                    //Address2.Text = MyLocation.line_2;
                                    //City.Text = MyLocation.city;
                                    //State.Text = MyLocation.state;
                                    //PostalCode.Text = MyLocation.postal_code;
                                    Country.SelectedValue = MyLocation.country_code_iso2;

                                    BindTimeZone(Country.SelectedValue);

                                    string ZoneId = Convert.ToString(MyLocation.zone_id);

                                    TimeZone.SelectedValue = ZoneId;
                                }

                                //Check for location data
                                quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id);

                                if (!object.ReferenceEquals(MyReg, null))
                                {
                                    SpecialRequests.Text = MyReg.specialrequests;
                                    txtFrequency.Text    = MyReg.classes.ToString();
                                    txtLevel.Text        = MyReg.languagel_evel.ToString();
                                    txtPeriod.Text       = MyReg.period;

                                    DateTime StartDate = (DateTime)MyReg.start_date;

                                    RentALanguageTeacher.user Admin = UserService.GetUserById(Convert.ToInt32(AppConfiguration.AdminID));

                                    DateTime LocalStartDate = App_Code.TimeService.ConvertToMyTime(StartDate, Admin);


                                    txtStartDate.Text = LocalStartDate.Date.ToString("d");
                                    TimeSpan span = new TimeSpan(0, 3, 0, 0, 0);
                                    txtBlockTime.Text = LocalStartDate.TimeOfDay.ToString() + " - " + LocalStartDate.TimeOfDay.Add(span).ToString();

                                    Duration.Text = MyReg.class_duration.ToString();

                                    Teacher.Text          = MyReg.teacher;
                                    TeacherSkype.Text     = MyReg.teacher_skypeid;
                                    FirstClass.Value      = MyReg.first_class.ToString();
                                    txtAdminComments.Text = MyReg.admin_comments;
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SetFirstClass", "SetFirstClass();", true);
                                }
                            }
                        }

                        catch (FormatException)
                        {
                            //Console.WriteLine("Input string is not a sequence of digits.");
                            throw;
                        }
                        catch (OverflowException)
                        {
                            //Console.WriteLine("The number cannot fit in an Int32.");
                            throw;
                        }
                    }
                }

                catch (Exception ex)
                {
                    App_Code.NotificationService.SendNotification("AccountSetupLoadError", ex.Message, "error", "4000");
                }

                LockControls();
            }
        }
コード例 #8
0
        protected void Register_Click(object sender, EventArgs e)
        {
            //Validate Page
            Page.Validate("NewAccount");

            if (Page.IsValid)
            {
                //valid Page
                try
                {
                    int MemberId = -1;

                    //Get Loggedin User
                    MembershipUser LoggedInMembershipUser;
                    MembershipUser MyMemberShipUser;
                    LoggedInMembershipUser = Membership.GetUser();

                    //Check if loggedin
                    if (LoggedInMembershipUser == null)
                    {
                        //No loggin in User

                        Page.Validate("NewMemberShip");

                        if (Page.IsValid)
                        {
                            string MyPassword;
                            if (TypedPassword != "")
                            {
                                MyPassword = TypedPassword;
                            }
                            else
                            {
                                MyPassword = Password.Text.ToString();
                            }

                            //Create User
                            MemberId = App_Code.MemberShipService.CreateUser(UserName.Text.ToString(), MyPassword, Email.Text.ToString());

                            //Approve User and notify
                            App_Code.MemberShipService.ApproveUserById(MemberId.ToString());

                            ////Set the HasLogInCookie
                            //HttpCookie MyCookie = new HttpCookie("RALTHasLogin");
                            //MyCookie.Value = "True";
                            //Response.Cookies.Add(MyCookie);

                            //Set the pageUser to the new user
                            MyMemberShipUser = App_Code.MemberShipService.GetUserById(MemberId.ToString());
                            App_Code.MemberShipService.NewUserEmail(MyMemberShipUser);
                            //App_Code.NotificationService.SendNotification("NewUserSuccess", "Your Account was created successfully, but you are not done yet. We ask that you confirm your email before we process your request. Please monitor your email for further instructions.", "success");
                        }

                        else
                        {
                            //Invalid Page, notify User
                            App_Code.NotificationService.SendNotification("NewAccountValidation", "Please complete the required fields", "error", "4000");
                            return;
                        }
                    }

                    else
                    {
                        //UserLogged in set page user to logged in user
                        MyMemberShipUser = LoggedInMembershipUser;

                        //Set MemberId
                        try
                        {
                            MemberId = Convert.ToInt32(MyMemberShipUser.ProviderUserKey.ToString());
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }

                    //Check for exsisting RALTUser
                    user RaltUser = UserService.GetUserByMemberId(MemberId);
                    user MyUser   = new user();
                    bool NewUser  = false;

                    //If there is an RALT USER link set UserID
                    if (!object.ReferenceEquals(RaltUser, null))
                    {
                        MyUser.user_id = RaltUser.user_id;
                    }

                    else
                    {
                        MyUser.account_status = "Request Made";
                        NewUser = true;
                    }



                    MyUser.first_name  = FirstName.Text.ToString();
                    MyUser.member_id   = MemberId;
                    MyUser.age         = Age.SelectedIndex;
                    MyUser.email       = MyMemberShipUser.Email;
                    MyUser.last_name   = LastName.Text.ToString();
                    MyUser.nationality = Nationality.SelectedValue;
                    MyUser.skype_id    = SkypeID.Text;


                    //Save MyUser
                    int MyUserId = UserService.SaveNewUser(MyUser);



                    location RALTLocation = LocationService.GetUserById(MyUserId);
                    location MyLocation   = new location();

                    if (!object.ReferenceEquals(RALTLocation, null))
                    {
                        MyLocation.location_id = RALTLocation.location_id;
                    }
                    else
                    {
                        RALTLocation = new location();
                    }


                    //MyLocation.city = City.Text;
                    MyLocation.country_code_iso2 = Country.SelectedValue;
                    //MyLocation.line_1 = Address1.Text;
                    //MyLocation.line_2 = Address2.Text;
                    //MyLocation.postal_code = PostalCode.Text;
                    //MyLocation.state = State.Text;
                    MyLocation.user_id = MyUserId;


                    int ZoneID = -1;
                    try
                    {
                        ZoneID = Convert.ToInt32(TimeZone.SelectedValue);
                    }
                    catch (FormatException)
                    {
                        //Console.WriteLine("Input string is not a sequence of digits.");
                    }
                    catch (OverflowException)
                    {
                        //Console.WriteLine("The number cannot fit in an Int32.");
                    }

                    MyLocation.zone_id = ZoneID;

                    LocationService.SaveObject(MyLocation);


                    quickregistration RALTQuickReg = QuickRegService.GetObjectByUserId(MyUserId);
                    quickregistration MyReg        = new quickregistration();

                    if (!object.ReferenceEquals(RALTQuickReg, null))
                    {
                        MyReg.quick_registration_id = RALTQuickReg.quick_registration_id;
                    }
                    else
                    {
                        RALTQuickReg = new quickregistration();
                    }

                    if (!(SpanishLevel.Value == "") || !(FrequencyOfClasses.Value == "") ||
                        !(PeriodOfClasses.Value == "") || !(StartDate.Value == ""))
                    {
                        MyReg.languagel_evel = Convert.ToInt32(SpanishLevel.Value);
                        MyReg.classes        = Convert.ToInt32(FrequencyOfClasses.Value);
                        MyReg.period         = PeriodOfClasses.Value;
                        // MyReg.start_date = Convert.ToDateTime(StartDate.Value);

                        MyReg.class_duration = Convert.ToInt32(Duration.Value);

                        DateTime LocalDate = Convert.ToDateTime(StartDate.Value);
                        MyReg.start_date = App_Code.TimeService.ConvertToUTC(LocalDate, MyUser);
                    }


                    MyReg.user_id         = MyUserId;
                    MyReg.specialrequests = SpecialRequests.Text;



                    QuickRegService.SaveObject(MyReg);

                    if (LoggedInMembershipUser == null)
                    {
                        if (NewUser == true)
                        {
                            UserService.AccountStatusVerified(MyUserId);

                            App_Code.EmailService.NewUserNotification(MemberId.ToString());
                        }

                        //Clear Form
                        UserName.Text = "";
                        Email.Text    = "";
                        Password.Text = "";
                        Confirm.Text  = "";

                        FirstName.Text            = "";
                        LastName.Text             = "";
                        SpecialRequests.Text      = "";
                        Age.SelectedValue         = "0";
                        Nationality.SelectedValue = "Default";
                        Country.SelectedValue     = "Default";
                        TimeZone.SelectedValue    = "0";
                        TimeZone.Enabled          = false;



                        Response.Redirect("/RALT/EN/Rent");
                    }


                    App_Code.NotificationService.SendNotification("AccountUpdateSuccess", "Your account was updated successfully", "success", "3000");
                }



                catch (NewUserException NUex)
                {
                    App_Code.NotificationService.SendNotification("NewUserExceptionError", NUex.Message, "alert", "4000");
                }

                catch (Exception ex)
                {
                    //CreateUser Error, Notify User
                    App_Code.NotificationService.SendNotification("NewUserError", ex.Message, "error", "4000");
                }
            }

            else
            {
                //Invalid Page, notify User
                App_Code.NotificationService.SendNotification("NewAccountValidation", "Please complete the required fields", "error", "4000");
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string pg = Page.RouteData.Values["AccountSetup"] as string;

            if (!Page.IsPostBack)
            {
                //Bind DDLs
                BindCountry();
                BindNationality();

                //Get Querystring Values
                if (string.IsNullOrEmpty(Request.QueryString["Level"]) ||
                    string.IsNullOrEmpty(Request.QueryString["Frequency"]) ||
                    string.IsNullOrEmpty(Request.QueryString["Period"]) ||
                    string.IsNullOrEmpty(Request.QueryString["Duration"]) ||
                    string.IsNullOrEmpty(Request.QueryString["StartDate"]))
                {
                    //QueryString null
                    //Get the logged in User if any
                    MembershipUser LoggedInMembershipUser;
                    LoggedInMembershipUser = Membership.GetUser();

                    //Check if there is a logged in User
                    if (LoggedInMembershipUser == null)
                    {
                        //App_Code.NotificationService.SendNotification("NoUser","You have been returned to out Homepage because of an error.","alert");
                        Response.Redirect("~/Home/AccountError");
                    }
                }

                else
                {
                    //Parss QS items to Hidden field controls
                    SpanishLevel.Value       = Request.QueryString["Level"];
                    FrequencyOfClasses.Value = Request.QueryString["Frequency"];
                    PeriodOfClasses.Value    = Request.QueryString["Period"];
                    StartDate.Value          = Request.QueryString["StartDate"];
                    Duration.Value           = Request.QueryString["Duration"];
                }


                //Load Data
                try
                {
                    //Get the logged in User if any
                    MembershipUser LoggedInMembershipUser;
                    LoggedInMembershipUser = Membership.GetUser();

                    //Check if there is a logged in User
                    if (LoggedInMembershipUser != null)
                    {
                        //Membership Data
                        UserName.Text = LoggedInMembershipUser.UserName.ToString();
                        Email.Text    = LoggedInMembershipUser.Email.ToString();


                        //Disable controls
                        UserName.Enabled    = false;
                        Email.Enabled       = false;
                        Password.Enabled    = false;
                        Confirm.Enabled     = false;
                        Password.Visible    = false;
                        lblPassword.Visible = false;
                        Confirm.Visible     = false;
                        lblConfirm.Visible  = false;

                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "AccountSetUpLogginIn", "GreyAccountInfo(" + '1' + ");", true);

                        //$(".first").addClass("second");

                        //RALT Data

                        // ToInt32 can throw FormatException or OverflowException.
                        int UserId = -1;

                        try
                        {
                            //Get the RALT data from membership accountID
                            UserId = Convert.ToInt32(LoggedInMembershipUser.ProviderUserKey.ToString());
                            user UserData = UserService.GetUserByMemberId(UserId);

                            //Bind data
                            if (!object.ReferenceEquals(UserData, null))
                            {
                                FirstName.Text            = UserData.first_name;
                                Age.SelectedIndex         = (int)UserData.age;
                                LastName.Text             = UserData.last_name;
                                Nationality.SelectedValue = UserData.nationality;
                                SkypeID.Text = UserData.skype_id;

                                if (UserData.account_status == "Request Made")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '0' + ");", true);
                                }
                                else if (UserData.account_status == "Verified")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '1' + ");", true);
                                }
                                else if (UserData.account_status == "Email Sent")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '2' + ");", true);
                                }
                                else if (UserData.account_status == "Paid")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '3' + ");", true);
                                }
                                else if (UserData.account_status == "First Class")
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '4' + ");", true);
                                }

                                //Check for location data
                                location MyLocation = LocationService.GetUserById(UserData.user_id);

                                if (!object.ReferenceEquals(MyLocation, null))
                                {
                                    //Address1.Text = MyLocation.line_1;
                                    //Address2.Text = MyLocation.line_2;
                                    //City.Text = MyLocation.city;
                                    //State.Text = MyLocation.state;
                                    //PostalCode.Text = MyLocation.postal_code;
                                    Country.SelectedValue = MyLocation.country_code_iso2;

                                    BindTimeZone(Country.SelectedValue);

                                    string ZoneId = Convert.ToString(MyLocation.zone_id);

                                    TimeZone.SelectedValue = ZoneId;
                                }

                                //Check for location data
                                quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id);

                                if (!object.ReferenceEquals(MyReg, null))
                                {
                                    SpecialRequests.Text = MyReg.specialrequests;
                                }
                            }
                        }

                        catch (FormatException)
                        {
                            //Console.WriteLine("Input string is not a sequence of digits.");
                            throw;
                        }
                        catch (OverflowException)
                        {
                            //Console.WriteLine("The number cannot fit in an Int32.");
                            throw;
                        }
                    }
                }

                catch (Exception)
                {
                    App_Code.NotificationService.SendNotification("AccountSetupLoadError", "There was an error loading your account", "error", "4000");
                }
            }

            else
            {
                //detect if password was changed. if filled and not equal to mask, it is new
                if (Password.Text.Trim().Length > 0 && Password.Text != PasswordMask)
                {
                    TypedPassword = Password.Text;
                    Password.Attributes.Add("value", PasswordMask);
                }
                Password.Attributes.Add("onFocus", "Clear_Password('" + Password.ClientID + "')");

                //detect if Confirm was changed. if filled and not equal to mask, it is new
                if (Confirm.Text.Trim().Length > 0 && Confirm.Text != PasswordMask)
                {
                    TypedPassword = Confirm.Text;
                    Confirm.Attributes.Add("value", PasswordMask);
                }
                Confirm.Attributes.Add("onFocus", "Clear_Password('" + Confirm.ClientID + "')");
            }
        }