private void btnCreate_Click(object sender, EventArgs e) { bool result = false; try { if (txtPasswordCreate.Text == txtConfirmCreate.Text) { if (!CheckEmpty()) { if (txtPasswordCreate.TextLength < 8) { MessageBox.Show("Password must be of atLeast 8 Characters"); return; } string input = txtPasswordCreate.Text; bool isDigitPresent = input.Any(a => char.IsDigit(a)); if (!isDigitPresent) { MessageBox.Show("Password must contain atLeast 1 digit"); return; } if (cmbUserType.Text == "Customer") { if (!correctUnit(cmbUnitRam.Text)) { MessageBox.Show("Invlalid Ram Unit"); return; } if (!correctUnit(cmbUnitStr.Text)) { MessageBox.Show("Invlalid Capacity Unit"); return; } customerObj = new CustomerDBLayer(); customerObj.cusObj.setEmail(txtEmailCreate.Text); customerObj.cusObj.setName(txtName.Text); customerObj.cusObj.setGender(cmbGender.Text); customerObj.cusObj.setPswd(txtPasswordCreate.Text); customerObj.cusObj.setCountry(cmbCountry.Text); customerObj.cusObj.device.setName(txtDevName.Text); customerObj.cusObj.device.setOS(txtOS.Text); customerObj.cusObj.device.setRam(Convert.ToDecimal(txtRAM.Text)); customerObj.cusObj.device.setCapacity(Convert.ToDecimal(txtStorage.Text)); result = customerObj.CreateCustomer(cmbUnitRam.Text, cmbUnitStr.Text); } else if (cmbUserType.Text == "Developer") { developerObj = new AppDBLayer(); developerObj.developer.setEmail(txtEmailCreate.Text); developerObj.developer.setName(txtName.Text); developerObj.developer.setGender(cmbGender.Text); developerObj.developer.setPswd(txtPasswordCreate.Text); developerObj.developer.setCountry(cmbCountry.Text); result = developerObj.CreateDeveloper(); } if (result) { MessageBox.Show("Account created successfully"); IntializeBoxes(); } else { MessageBox.Show("Account creation unsuccessful"); } } else { MessageBox.Show("Some of the fields are empty"); } } else { MessageBox.Show("Both Passwords doesn't match"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }