public void CandidateObject() { Random generator = new Random(); String r = generator.Next(0, 1000000).ToString("D6"); DataTable dt = CandidateManager.CodeExist(r); DataTable edt = CandidateManager.EmailExist(txtEmail.Value); if (edt.Rows.Count == 0) { if (dt.Rows.Count != 0) { CandidateObject(); } else { obj_Candidate.UserCode = r; obj_Candidate.UserFirstName = txtFirstName.Value; obj_Candidate.UserLastName = txtLastName.Value; obj_Candidate.UserEmail = txtEmail.Value; obj_Candidate.UserPassword = ""; obj_Candidate.UserPhoneNo = txtMobileNo.Value; obj_Candidate.role = "Candidate"; obj_Candidate.UserResume = ""; } } else { //Email Exists; } }
public void CandidateObject() { string FullName = txtName.Value; Random generator = new Random(); String r = generator.Next(0, 1000000).ToString("D6"); lblCandidateCode.Text = r; DataTable dt = CandidateManager.CodeExist(r); DataTable edt = CandidateManager.EmailExist(txtEmail.Value); var results = FullName.Split(' '); if (edt.Rows.Count == 0) { if (dt.Rows.Count != 0) { CandidateObject(); } else { obj_Candidate.UserCode = lblCandidateCode.Text; if (results.Length > 1) { obj_Candidate.UserFirstName = results[0]; obj_Candidate.UserLastName = results[1]; } else { obj_Candidate.UserFirstName = results[0]; obj_Candidate.UserLastName = ""; } obj_Candidate.UserEmail = txtEmail.Value; obj_Candidate.UserPassword = ""; obj_Candidate.UserPhoneNo = txtPhoneNumber.Value; obj_Candidate.role = "Candidate"; obj_Candidate.UserResume = lblFilePath.Text; } } else { //Email Exists; } }