private void btnSubmit_Click(object sender, RoutedEventArgs e) { UsersValidations userObj = new UsersValidations(); User newUser = new User(); BuyerValidations buval = new BuyerValidations(); Buyer buyer = new Buyer(); buyer.UserName = txtName.Text; buyer.FirstName = txtFName.Text; buyer.LastName = txtLName.Text; buyer.DateOfBirth = dob.SelectedDate.Value; buyer.PhoneNo = txtNumber.Text; buyer.EmailId = txtEmail.Text; string x = txtPassword.Password; newUser.Password = x; newUser.UserName = buyer.UserName; newUser.UserType = "Buyer"; buval.AddBuyer(buyer); userObj.AddUser(newUser); MessageBox.Show("Buyer added successfully"); NavigationService nav = NavigationService.GetNavigationService(this); nav.Navigate(new Uri("Login.xaml", UriKind.RelativeOrAbsolute)); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { try { User login = new User(); UsersValidations userObj = new UsersValidations(); SellerValidations sellerObj = new SellerValidations(); BuyerValidations buyerObj = new BuyerValidations(); login.UserName = txtUserName.Text; login.Password = txtPass.Password; login = userObj.LoginUser(login); if (login != null) { if (login.UserType.ToLower() == "admin") { Admin sp = new Admin(); this.NavigationService.Navigate(sp); } else if (login.UserType.ToLower() == "seller") { int sellerId = sellerObj.SellerId(login.UserName); SellerPage sp = new SellerPage(sellerId); this.NavigationService.Navigate(sp); } else if (login.UserType.ToLower() == "buyer") { int buyerId = buyerObj.BuyerId(login.UserName); ShowAllProperties_Buyer sp = new ShowAllProperties_Buyer(buyerId); this.NavigationService.Navigate(sp); } MessageBox.Show("Login Successful!!"); } else { txtUserName.Text = ""; txtPass.Password = ""; throw new UserException("UserName/Password is required"); } } catch (UserException ex) { MessageBox.Show(ex.Message, "Alert"); } }
protected void btnLogin_Click(object sender, EventArgs e) { User login = new User(); UsersValidations userObj = new UsersValidations(); SellerValidations sellerObj = new SellerValidations(); BuyerValidations buyerObj = new BuyerValidations(); login.UserName = txtUserName.Text; login.Password = txtPassword.Text; login = userObj.LoginUser(login); if (login != null) { if (login.UserType.ToLower() == "admin") { Session["userName"] = login.UserName; Response.Redirect("Admin.aspx"); } else if (login.UserType.ToLower() == "seller") { int sellerId = sellerObj.GetSellerId(login.UserName); Session["userId"] = sellerId; Session["userName"] = login.UserName; Response.Redirect("SellerHome.aspx"); } else if (login.UserType.ToLower() == "buyer") { int buyerId = buyerObj.BuyerId(login.UserName); Session["userId"] = buyerId; Session["userName"] = login.UserName; Response.Redirect("DisplayResults.aspx"); } Response.Write("<script type='text/javascript'>alert( '" + login.UserName + "');</script>"); } //else //{ // throw new UserException("UserName/Password is invalid"); //} }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { UsersValidations userObj = new UsersValidations(); Seller seller = new Seller(); User newUser = new User(); seller.Address = txtAddress.Text; City city = (City)cmbCity.SelectedItem; seller.CityId = city.CityId; State state = (State)cmbState.SelectedItem; seller.StateId = state.StateId; seller.DateofBirth = DateTime.Now; seller.EmailId = txtEmail.Text; seller.FirstName = txtFirstName.Text; seller.LastName = txtLastName.Text; // seller.Password = txtPass.Text; seller.PhoneNo = txtPhoneNo.Text; seller.UserName = txtUserName.Text; newUser.Password = txtPass.Text; newUser.UserName = seller.UserName; newUser.UserType = "Seller"; sellerObj.AddSeller(seller); userObj.AddUser(newUser); NavigationService nav = NavigationService.GetNavigationService(this); nav.Navigate(new Uri("Login.xaml", UriKind.RelativeOrAbsolute)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid Details"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { UsersValidations userObj = new UsersValidations(); User newUser = new User(); BuyerValidations buval = new BuyerValidations(); Buyer buyer = new Buyer(); buyer.UserName = txtUserName.Text; buyer.FirstName = txtFirstName.Text; buyer.LastName = txtLastName.Text; buyer.DateOfBirth = DateTime.Parse(txtDOB.Text); buyer.PhoneNo = txtPhoneNo.Text; buyer.EmailId = txtEmail.Text; newUser.Password = txtPassword.Text; newUser.UserName = buyer.UserName; newUser.UserType = "Buyer"; buval.AddBuyer(buyer); userObj.AddUser(newUser); Response.Redirect("Default.aspx"); }
protected void btnSubmit_Click(object sender, EventArgs e) { { UsersValidations userObj = new UsersValidations(); Seller seller = new Seller(); User newUser = new User(); seller.Address = txtAddress.Text; City city = cities[ddlCity.SelectedIndex]; seller.CityId = city.CityId; State state = states[ddlState.SelectedIndex]; seller.StateId = state.StateId; seller.DateofBirth = DateTime.Parse(txtDOB.Text); seller.EmailId = txtEmail.Text; seller.FirstName = txtFirstName.Text; seller.LastName = txtLastName.Text; // seller.Password = txtPass.Text; seller.PhoneNo = txtPhoneNo.Text; seller.UserName = txtUserName.Text; newUser.Password = txtPassword.Text; newUser.UserName = seller.UserName; newUser.UserType = "Seller"; sellerObj.AddSeller(seller); userObj.AddUser(newUser); Response.Redirect("Default.aspx"); } }