//ADD THE USER DETAILS INTO USER TABEL =>PL private void btnAdd_Click(object sender, EventArgs e) { if (tbUName.Text != string.Empty && tbUAdNo.Text != string.Empty && tbUEmail.Text != string.Empty && tbUPass.Text != string.Empty) { try { UserBL userBL = new UserBL(); string isDone = userBL.AddUserBL(tbUName.Text, int.Parse(tbUAdNo.Text), tbUEmail.Text, tbUPass.Text); if (isDone == "true") { MessageBox.Show("User added successfuly.."); } else { MessageBox.Show(isDone + "Try again.."); } } catch (Exception) { MessageBox.Show("Enter the fields properly.."); } } else { MessageBox.Show("Enter the fields properly.."); } }
//ADD THE USERS DETAILS INTO USERS TABEL =>PL private void BtnSubmit_Click(object sender, RoutedEventArgs e) { if (tbUName.Text != string.Empty && tbUAdNo.Text != string.Empty && tbUEmail.Text != string.Empty && tbUPass.Text != string.Empty) { try { UserBL userBL = new UserBL(); string isDone = userBL.AddUserBL(tbUName.Text, int.Parse(tbUAdNo.Text), tbUEmail.Text, tbUPass.Text); if (isDone == "true") { MessageBox.Show("User added successfuly.."); this.Close(); } else { MessageBox.Show(isDone + "Try again.."); } } catch (FormatException) { MessageBox.Show("Invalid Admission number!!!,\nIt should not be a string, Try again.."); } catch (Exception) { MessageBox.Show("Some unknown exception is occured!!!, Try again.."); } } else { MessageBox.Show("Enter the fields properly!!!, Every field is required.."); } }
public ActionResult Create(UserViewModel vmodel) { UserBL ubl = new UserBL(); var ReturnCBL = ubl.AddUserBL(vmodel); if (ReturnCBL) { return(RedirectToAction("GetList")); } else { return(View()); } }
private void Button_Click(object sender, RoutedEventArgs e) { StringBuilder sb = new StringBuilder(); try { Users newUser = new Users(); newUser.UserName = txtUsername.Text; newUser.Password = pbPassword.Password.ToString(); newUser.UserType = cbUsertype.Text; if (newUser.UserType == "Buyer") { Application.Current.Properties["username"] = newUser.UserType; try { userBL.AddUserBL(newUser); } catch (EasyHousingSolutionException ex) { sb.Append(ex.Message.ToString()); } Buyer buyer = new Buyer(); buyer.UserName = txtUsername.Text; buyer.FirstName = txtFirstname.Text; buyer.LastName = txtLastname.Text; if (dpDob.Text.ToString() != string.Empty) { buyer.DateOfBirth = DateTime.Parse(dpDob.Text.ToString()); } else { buyer.DateOfBirth = DateTime.Parse("01-01-1000"); } if (txtPhone.Text.ToString() != string.Empty) { buyer.PhoneNo = long.Parse(txtPhone.Text); } else { buyer.PhoneNo = 0; } buyer.EmailId = txtUsername.Text; buyer.Address = txtAddress.Text; if (buyersBL.AddBuyerBL(buyer)) { MessageBox.Show("Registered successfully...."); Login obj = new Login(); this.Hide(); obj.Show(); } else { MessageBox.Show("Something went wrong..."); } } else if (newUser.UserType == "Seller") { Application.Current.Properties["username"] = newUser.UserType; try { userBL.AddUserBL(newUser); } catch (EasyHousingSolutionException ex) { sb.Append(ex.Message.ToString()); } Seller seller = new Seller(); seller.UserName = txtUsername.Text; seller.FirstName = txtFirstname.Text; seller.LastName = txtLastname.Text; if (dpDob.Text.ToString() != string.Empty) { seller.DateofBirth = DateTime.Parse(dpDob.Text.ToString()); } else { seller.DateofBirth = DateTime.Parse("01-01-1000"); } if (txtPhone.Text.ToString() != string.Empty) { seller.PhoneNo = long.Parse(txtPhone.Text); } else { seller.PhoneNo = 0; } seller.Address = txtAddress.Text; seller.StateName = cbStates.Text; seller.CityName = cbCities.Text; seller.EmailId = txtUsername.Text; if (sellersBLL.AddSellerBL(seller)) { MessageBox.Show("Registered successfully...."); Login obj = new Login(); this.Hide(); obj.Show(); } else { MessageBox.Show("Something went wrong..."); } } else { MessageBox.Show("Please select user type"); } } catch (EasyHousingSolutionException ex) { MessageBox.Show("Error: " + sb.ToString() + ex.Message); } }