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; } }
protected void Button1_Click(object sender, EventArgs e) { IUserComponent userservice = new UserComponent(); IBookingComponent bookingservice = new BookingComponent(); User user = new User(); Booking booking = new Booking(); //booking.UserID = ((User)Session["UserSession"]).ID; booking.UserID = ((User)Session["UserSession"]).ID; booking.RoomID = int.Parse(DropDownList1.SelectedValue); booking.StartDate = clnstart.SelectedDate; booking.EndDate = clnEnd.SelectedDate; // booking.refNum = lblBookingID.Text; try { bookingservice.AddBooking(booking); lblBookingID.Text = "You have successfully booked room your refrence number is " + "<b>" + booking.RefNum + "</b>"; } catch (Exception ex) { throw ex; } }
public void Delete(User user) { IUserComponent component = new UserComponent(); try { component.Delete(user); } catch (Exception e) { throw new FaultException(e.Message); } }
public User Save(User user) { IUserComponent component = new UserComponent(); try { component.Save(user); } catch (Exception e) { throw new FaultException(e.Message); } return user; }
public bool IsExistingLoginID(string loginID, int userID) { IUserComponent component = new UserComponent(); bool result = false; try { result = component.IsExistingLoginID(loginID, userID); } catch (Exception e) { throw new FaultException(e.Message); } return result; }
protected void btnSave_Click(object sender, EventArgs e) { //IUserService userService = new UserService(); //User myuser = new User(); //myuser.FirstName = txtFirstName.Text; //myuser.LastName = txtLastName.Text; //myuser.Email = txtEmail.Text; //myuser.LoginID = txtLoginID.Text; //myuser.Password = txtPassword.Text; //try //{ // userService.Save(myuser); // lblstatus.Text = "Success!"; //} //catch (Exception ex) //{} using (IUserComponent userService = new UserComponent()) { User myuser = new User(); myuser.FirstName = txtFirstName.Text; myuser.LastName = txtLastName.Text; myuser.Email = txtEmail.Text; myuser.LoginID = txtLoginID.Text; myuser.Password = txtPassword.Text; myuser.IsWindowAuthenticate = chkWindowAuthenticate.Checked; try { userService.Save(myuser); lblstatus.Text = "Success!"; } catch (Exception ex) { lblstatus.Text = ex.Message; //lblstatus.Text = "The Email address is already existed!"; } }; }
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; } }
protected void Button1_Click(object sender, EventArgs e) { IUserComponent us = new UserComponent(); User user = new User(); try { user.ID = int.Parse(lblID.Text); user.FirstName = TextBox2.Text; user.LastName = TextBox3.Text; user.Email = TextBox4.Text; user.LoginID = TextBox5.Text; user.Password = TextBox6.Text; user.IsWindowAuthenticate = chkWindowAuthenticate.Checked; us.Update(user); lblstatus.Text = "Success"; } catch (Exception ex) { lblstatus.Text = ex.Message; } }
public IEnumerable<User> GetList() { IUserComponent component = new UserComponent(); var results = component.GetList(); return results; }
protected void Page_Load(object sender, EventArgs e) { IUserComponent userService = new UserComponent(); GridView1.DataSource = userService.GetList(); GridView1.DataBind(); }