Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String     username = Session["username"].ToString();
            userDetail ud       = new userDetail(username);

            lblDepartTrip.Text = Session["departureTrip"].ToString();
            lblTotal.Text      = Session["totalTripCost"].ToString();

            toDestination   = Session["toDestination"].ToString();
            fromDestination = Session["fromDestination"].ToString();
            tripType        = Session["tripType"].ToString();
            totalPassenger  = Convert.ToInt32(Session["totalPassenger"].ToString());

            departureTime = Session["departureTime"].ToString();
            departureDate = Session["departureDate"].ToString();
            returnDate    = Session["returnDate"].ToString();

            customerName         = ud.getFullname();
            lblCustomerName.Text = customerName;

            if (tripType == "Round Trip")
            {
                lblReturnTrip.Text = Session["returnTrip"].ToString();
                returnTime         = Session["returnTime"].ToString();
            }
            else
            {
                lblReturnTrip.Text = "N/A";
                tripType           = "One Way";
            }
        }
Beispiel #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            userDetail ud = new userDetail(txtUsername.Text);

            if (ud.login(txtUsername.Text, txtPassword.Text) >= 1)
            {
                Session["fullname"] = ud.getFullname();
                Session["contact"]  = ud.getContact();
                Session["email"]    = ud.getEmail();
                Session["username"] = txtUsername.Text.ToString();
                Response.Redirect("Home.aspx");
            }
            else
            {
                lblStatus.Text    = "Login Failed. Please check username and password";
                lblStatus.Visible = true;
            }



            /*String conString = ConfigurationManager.ConnectionStrings["DDACConnectionString"].ConnectionString;
             * System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection(conString);
             * System.Data.OleDb.OleDbCommand cmd = con.CreateCommand();
             *
             * cmd.CommandText = "SELECT * FROM Student WHERE [Username] = ? AND [Password] = ?";
             * cmd.Parameters.Add("User_Name", System.Data.OleDb.OleDbType.VarChar);
             * cmd.Parameters["User_Name"].Value = this.txtUsername.Text.ToString();
             * cmd.Parameters.Add("Password", System.Data.OleDb.OleDbType.VarChar);
             * cmd.Parameters["Password"].Value = this.txtPassword.Text.ToString();
             * int count = 0;
             *
             * con.Open();
             * System.Data.OleDb.OleDbDataReader dr = cmd.ExecuteReader();
             *
             * while (dr.Read())
             * {
             *
             *  count++;
             * }
             *
             * //lblStatus.Visible = true;
             * if (count >= 1)
             * {
             *  Session["username"] = txtUsername.Text.ToString();
             *  Response.Redirect("Home.aspx");
             * }
             * else
             * {
             *  lblStatus.Text = "Login Failed. Please check username and password";
             * }*/
        }