protected void Page_Load(object sender, EventArgs e) { UserService us = new UserService(); int id = (int) Session["id"]; user u = new user(); u.user_id = id; u = us.getUserById(u); order orderInDb = (order) Session["paidTicket"]; if (orderInDb == null) { Server.Transfer("payment.aspx"); } this.payment.Value = orderInDb.payment.ToString(); this.plane_name.Value = orderInDb.flight.flight_name; this.city_from.Value = orderInDb.flight.air_line.city_from; this.city_to.Value = orderInDb.flight.air_line.city_to; this.departure_time.Value = orderInDb.flight.air_line.schedule_departure.ToString("c"); this.arrival_time.Value = orderInDb.flight.air_line.schedule_arrival.ToString("c"); this.flight_date.Value = orderInDb.flight.arrival_date.ToString("d"); this.user_name.Value = u.user_name; this.card_id.Value = u.id_card_NO; this.phone.Value = u.phone; }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { var response = base.Response; response.Redirect("login.aspx"); } UserService us = new UserService(); user u = new user(); u.user_id = (int)Session["id"]; u = us.getUserById(u); uInDb = u; }
protected void loginOnclick(object sender, EventArgs e) { user u = new user(); u.email = this.email.Value; u.password = this.pw.Value; UserService us = new UserService(); if ((u = us.login(u)) != null) { Session["id"] = u.user_id; Server.Transfer("index.aspx"); } else { ShowPopUpMsg("Email or password not right"); } }
protected void register_ServerClick(object sender, EventArgs e) { user u = new user(); u.email = this.email.Value; u.password = this.pw2.Value; u.phone = this.phone.Value; u.id_card_NO = this.idcard.Value; u.user_name = this.Name.Value; u.credit = 0; u.mileage = 0; u.balance = 0; u.user_level = 0; UserService us = new UserService(); u = us.register(u); if (u == null) this.Page_Load(sender,e); else { Session["id"] = u.user_id; Server.Transfer("index.aspx"); } }
protected void registerOnclick(object sender, EventArgs e) { user userRegister = new user(); userRegister.email = this.EmailBox.Text.Trim(); userRegister.password = this.PasswordBox.Text.Trim(); userRegister.phone = this.PhoneBox.Text.Trim(); userRegister.id_card_NO = this.IdCardBox.Text.Trim(); userRegister.user_name = this.NameBox.Text.Trim(); UserService uService = new UserService(); String result = ""; if(result == "exists") { this.regResult.Text = "Email already exsists!!!"; } else { user uInDB = uService.getUserByEmail(userRegister); Session["UserId"] = uInDB.user_id; this.regResult.Text = "Success!"; } }