protected void Button1_Click(object sender, EventArgs e) { IUserComponent us = new UserComponent(); IBookingComponent bookingservice = new BookingComponent(); User myuser = new User(); // Booking booking = new Booking(); myuser.LoginID = txtloginid.Text; myuser.Password = txtpassword.Text; try { if (us.Login(myuser)) { Session["UserSession"] = myuser; Response.Redirect("InsertBooking.aspx"); } else { lblstatus.Text = "Login fail."; } } catch (Exception ex) { lblstatus.Text = ex.Message; } }
public User Login(User user) { IUserComponent component = new UserComponent(); bool result = false; try { result = component.Login(user); } catch (Exception e) { throw new FaultException(e.Message); } if (result) { return component.GetRecord(user.LoginID); } else { return null; } }