//SAVE SURVEYOR DATA private void UserDataSave() { try { if (//CHECK TEXBOXES NOT NULL OR EMPTY String.IsNullOrWhiteSpace(txtEmpRegNo.Text) || String.IsNullOrWhiteSpace(txtName.Text) || String.IsNullOrWhiteSpace(cbxSurveyorType.Text) || String.IsNullOrWhiteSpace(txtMobile.Text) || String.IsNullOrWhiteSpace(txtEmail.Text) ) { MessageBox.Show("You must be filling all field!.", "Surveyor Registration", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (objClassBLL.ExistSurveyor(_division, txtEmpRegNo.Text) == false) { //PROPERTIES FOR DATA ADD objClassBLL = new SurveyorClassBLL() { date = DateTime.Today, emp_reg_no = txtEmpRegNo.Text, initail_name = txtName.Text, surveyor_type = cbxSurveyorType.Text.ToString(), mobile = txtMobile.Text, email = txtEmail.Text, division = _division, username = _username }; //INSERT DATA TO DATABASE objClassBLL.AddNewSurveyor(); MessageBox.Show("Surveyor registration successfully!", "Surveyor Registration", MessageBoxButtons.OK, MessageBoxIcon.Information); //CLEAR ALL TEXBOX AND COMBOBOX ClearTextBoxces(); //LOAD USER DATA LoadDataDgv(); //SET TO BUTTON TEXT Add btnAdd.Text = "Add"; txtEmpRegNo.Enabled = true; } else { MessageBox.Show("Already exist this surveyor!", "Surveyor Registration", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "USER ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }