protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UserName"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    UserServiceRef.UserService pxy = new UserServiceRef.UserService();
                    string userEmail = Session["UserName"].ToString();
                    lblUserName.InnerHtml = pxy.GetUserFullName(userEmail);
                    chatUserName.Value = Session["UserName"].ToString();
                }

                divCarDetails.Visible = false;
                divCarResults.Visible = false;
                divEventDetails.Visible = false;
                divEventResults.Visible = false;
                divHotelDetails.Visible = false;
                divCartBody.Visible = false;

                displayCartCount();
            }
        }
        protected void btnTestAddUser_Click(object sender, EventArgs e)
        {
            UserServiceRef.User user = new UserServiceRef.User();
            UserServiceRef.UserService pxy = new UserServiceRef.UserService();

            user.firstName = "Cool";
            user.lastName = "Guy";
            user.email = "*****@*****.**";
            string password = "******";
            user.password = password.GetHashCode().ToString();
            lblReserveResult.Text = "TestValidate method executed successfully: "
                + pxy.AddUser(user);
        }
Exemple #3
0
        protected void btnTestAddUser_Click(object sender, EventArgs e)
        {
            UserServiceRef.User        user = new UserServiceRef.User();
            UserServiceRef.UserService pxy  = new UserServiceRef.UserService();

            user.firstName = "Cool";
            user.lastName  = "Guy";
            user.email     = "*****@*****.**";
            string password = "******";

            user.password         = password.GetHashCode().ToString();
            lblReserveResult.Text = "TestValidate method executed successfully: "
                                    + pxy.AddUser(user);
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            UserServiceRef.User newUser = new UserServiceRef.User();
            newUser.firstName = txtFirstName.Text;
            newUser.lastName  = txtLastName.Text;
            newUser.email     = txtEmail.Text;
            newUser.password  = txtPassword1.Text;

            if (String.IsNullOrEmpty(newUser.firstName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('First name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.lastName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Last name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.email))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid email.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.password))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid password.')", true);
                return;
            }

            UserServiceRef.UserService pxy = new UserServiceRef.UserService();
            bool emailUsed = pxy.CheckForEmail(newUser.email);

            if (emailUsed)
            {
                pxy.AddUser(newUser);
                Response.Redirect("Login.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('The chosen email is already used, please login if you already have an account, or use another email id.')", true);
            }
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            UserServiceRef.User newUser = new UserServiceRef.User();
            newUser.firstName = txtFirstName.Text;
            newUser.lastName = txtLastName.Text;
            newUser.email = txtEmail.Text;
            newUser.password = txtPassword1.Text;

            if (String.IsNullOrEmpty(newUser.firstName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('First name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.lastName))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Last name must be at least 2 characters long.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.email))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid email.')", true);
                return;
            }

            if (String.IsNullOrEmpty(newUser.password))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('Please enter a valid password.')", true);
                return;
            }

            UserServiceRef.UserService pxy = new UserServiceRef.UserService();
            bool emailUsed = pxy.CheckForEmail(newUser.email);

            if (emailUsed)
            {
                pxy.AddUser(newUser);
                Response.Redirect("Login.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ValidationAlertScript", "alert('The chosen email is already used, please login if you already have an account, or use another email id.')", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["email"] != null)
            {
                UserServiceRef.UserService pxy = new UserServiceRef.UserService();
                bool emailExists = pxy.CheckForEmail(Request["email"]);
                if (emailExists)
                {
                    Response.Write("false");
                }
                else
                {
                    Response.Write("true");
                }
            }
            else if ((Request["chat_post"] != null) && (Request["chat_username"] != null))
            {
                SqlCommand objCommand = new SqlCommand();
                objCommand.CommandType = CommandType.StoredProcedure;
                objCommand.CommandText = "PostChat";
                objCommand.Parameters.AddWithValue("@email", Request["chat_username"]);
                objCommand.Parameters.AddWithValue("@chat", Request["chat_post"]);

                DBConnect objDB = new DBConnect();
                objDB.DoUpdateUsingCmdObj(objCommand);
            }
            else if (Request["get_chat_username"] != null)
            {
                SqlCommand objCommand = new SqlCommand();
                objCommand.CommandType = CommandType.StoredProcedure;
                objCommand.CommandText = "GetChat";
                objCommand.Parameters.AddWithValue("@email", Request["get_chat_username"]);

                DBConnect objDB = new DBConnect();
                DataSet   myDS  = objDB.GetDataSetUsingCmdObj(objCommand);

                string response = "";
                for (int i = 0; i < myDS.Tables[0].Rows.Count; i++)
                {
                    DataRow currRow = myDS.Tables[0].Rows[i];
                    response += "<p>" + currRow["chat"] + "</p>";
                }

                Response.Write(response);
            }
            else if (Request["get_chat_rooms"] != null)
            {
                SqlCommand objCommand = new SqlCommand();
                objCommand.CommandType = CommandType.StoredProcedure;
                objCommand.CommandText = "GetChatRooms";

                DBConnect objDB = new DBConnect();
                DataSet   myDS  = objDB.GetDataSetUsingCmdObj(objCommand);

                string response = "";
                for (int i = 0; i < myDS.Tables[0].Rows.Count; i++)
                {
                    DataRow currRow = myDS.Tables[0].Rows[i];
                    response += "<option value='" + currRow["email"] + "'>" + currRow["email"] + "</option>";
                }

                Response.Write(response);
            }
        }
Exemple #7
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string email    = txtUserName.Text;
            string password = txtPassword.Text;

            UserServiceRef.UserService pxy = new UserServiceRef.UserService();
            if (pxy.ValidateLogin(email, password))
            {
                if (chkRememberMe.Checked)
                {
                    HttpCookie emailCookie = new HttpCookie("UserEmail");
                    emailCookie.Value   = email;
                    emailCookie.Expires = new DateTime(2024, 1, 1);
                    Response.Cookies.Add(emailCookie);
                }
                else
                {
                    Response.Cookies.Remove("UserEmail");
                }

                Session.Remove("LoginCount");
                Session["UserName"] = email;

                Serialize       objSerialize = new Serialize();
                VacationPackage vacation     = (VacationPackage)objSerialize.ReadCartFromDB(email);
                if (vacation != null)
                {
                    Session["VacationPackage"] = vacation;
                }
                else
                {
                    Session["VacationPackage"] = new VacationPackage();
                }

                Response.Redirect("Home.aspx");
            }
            else
            {
                txtUserName.Text = "";
                txtPassword.Text = "";

                int loginCount = 0;
                if (Session["LoginCount"] != null)
                {
                    loginCount = (int)Session["LoginCount"];
                }
                Session["LoginCount"] = loginCount + 1;

                if (loginCount > 2)
                {
                    loginAlert.InnerHtml = "Too many tries, you are not allowed to login again for a while.";
                    txtUserName.Enabled  = false;
                    txtPassword.Enabled  = false;
                }
                else
                {
                    loginAlert.InnerHtml = "Invalid credentials, please try again!";
                }

                loginAlert.Visible = true;
            }
        }
 protected void btnTestValidateLogin_Click(object sender, EventArgs e)
 {
     UserServiceRef.UserService pxy = new UserServiceRef.UserService();
     lblReserveResult.Text = "TestValidate method executed successfully: "
         + pxy.ValidateLogin("*****@*****.**", "jwwieorhu3h59823rndjf");
 }
 protected void btnTestCheckEmail_Click(object sender, EventArgs e)
 {
     UserServiceRef.UserService pxy = new UserServiceRef.UserService();
     lblReserveResult.Text = "TestCheckEmail method executed successfully (SHOULD RETURN FALSE SINCE USER EXISTS): "
         + pxy.CheckForEmail("*****@*****.**");
 }
Exemple #10
0
 protected void btnTestCheckEmail_Click(object sender, EventArgs e)
 {
     UserServiceRef.UserService pxy = new UserServiceRef.UserService();
     lblReserveResult.Text = "TestCheckEmail method executed successfully (SHOULD RETURN FALSE SINCE USER EXISTS): "
                             + pxy.CheckForEmail("*****@*****.**");
 }
Exemple #11
0
 protected void btnTestValidateLogin_Click(object sender, EventArgs e)
 {
     UserServiceRef.UserService pxy = new UserServiceRef.UserService();
     lblReserveResult.Text = "TestValidate method executed successfully: "
                             + pxy.ValidateLogin("*****@*****.**", "jwwieorhu3h59823rndjf");
 }