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)); }
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"); }