Ejemplo n.º 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            String strSQL;
            String myConnectString;

            // Put user code to initialize the page here
            Global.AuthenticateUser();

            Session["LoggedIn"] = "No";

            lnkSignIn.Text = Global.SetLnkSignIn();
            lnkSignUp.Text = Global.SetLnkSignUp();

            if (!Page.IsPostBack)
            {
                // Put user code to initialize the page here
                ErrorLog.ErrorRoutine(false, "Registered EmailId: " + Session["EmailId"].ToString());

                //Get DB connect string
                myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

                //***TODO: E-mail verfication & activation
                //***see contact us page

                strSQL = "Select * FROM tblUser WHERE txtEmail = '" + Session["EmailId"].ToString() + "'";
                SqlConnection myConnection = new SqlConnection(myConnectString);

                string usersId = "unknown";

                try
                {
                    myConnection.Open();
                    SqlCommand objCommand = new SqlCommand(strSQL, myConnection);

                    SqlDataReader objReader = null;
                    objReader = objCommand.ExecuteReader();

                    if (objReader.Read())
                    {
                        usersId = objReader["iD"].ToString();
                        //ErrorLog.ErrorRoutine(false, "userId:" + usersId);

                        //Create dirs
                        if (CreateUserDir(usersId))
                        {
                            //set userID
                            //Session["userId"] = usersId;
                            //Session["LoggedIn"] = "Yes";
                            //Session["BlogFlg"] = "N";
                            //Session["LoggedIn"] = "No";

                            lblMessage.Text = "Your account has been created.  An e-mail confirmation has been sent.";
                            SendCongratEmail();
                            NotifyBHEmail(usersId);

                            if (Session["ServiceId"] != null)
                            {
                                if (Session["ServiceId"].ToString() == "6" || Session["ServiceId"].ToString() == "7") //upgrade
                                {
                                    classes.Login clsLogin = new classes.Login();
                                    if (clsLogin.DoLogin(Session["EmailId"].ToString(), string.Empty, true, true))
                                    {
                                        Session["LoggedIn"] = "Yes";
                                        Response.Redirect("Pay/OrderForm.aspx", false);
                                    }
                                }
                            }
                            else
                            {
                                Session["LoggedIn"] = "No";
                                Session["EmailId"]  = null;
                                Session["acctType"] = null;
                                Session["pw"]       = null;
                            }
                        }
                        else
                        {
                            Session["LoggedIn"] = "No";
                            Session["EmailId"]  = null;
                            Session["acctType"] = null;
                            Session["pw"]       = null;
                            ErrorLog.ErrorRoutine(false, "Error creating user dirs");
                            lblMessage.Text = "Registration Failed.  Please close this browser and try again.";
                        }
                    }
                    else
                    {
                        ErrorLog.ErrorRoutine(false, "RegisterFinish:PageLoad:Couldn't locate user.");
                        classes.Email.SendErrorEmail("RegisterFinish:PageLoad:Couldn't locate user.");
                    }
                }

                catch (Exception ex)
                {
                    ErrorLog.ErrorRoutine(false, "RegisterFinish:PageLoad: " + ex.Message);
                    lblMessage.Text     = "Registration Failed.  Please close this browser and try again.";
                    Session["LoggedIn"] = "No";
                    Session["EmailId"]  = null;
                    Session["pw"]       = null;
                    Session["acctType"] = null;
                }

                finally
                {
                    myConnection.Close();
                }
            }
        }
Ejemplo n.º 2
0
/**
 */
        private void lnkSignUp_Click(object sender, System.EventArgs e)
        {
            Global.NavigatePage(lnkSignUp.Text);
        }