private void btnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtuser.Text)) { Box.warnBox("Please input username."); txtuser.Focus(); return; } if (String.IsNullOrEmpty(txtpwd.Text)) { Box.warnBox("Please input password."); txtpwd.Focus(); return; } if (txtpwd.Text != txtRPwd.Text) { Box.warnBox("Password not match."); txtpwd.Focus(); return; } if (String.IsNullOrEmpty(cmbPosition.Text)) { Box.warnBox("Please select position."); cmbPosition.Focus(); return; } if (String.IsNullOrEmpty(txtLname.Text)) { Box.warnBox("Please input lastname."); txtLname.Focus(); return; } if (String.IsNullOrEmpty(txtFname.Text)) { Box.warnBox("Please input firstname."); txtFname.Focus(); return; } if (String.IsNullOrEmpty(cmbSex.Text)) { Box.warnBox("Please select sex."); cmbSex.Focus(); return; } if (String.IsNullOrEmpty(txtPIN.Text)) { Box.warnBox("Please input PIN."); txtPIN.Focus(); return; } if (!txtContactNo.MaskFull) { Box.warnBox("Please input contact no."); return; } if (id == 0) { if (isExist()) { Box.warnBox("Username already taken."); return; } if (isExistMobileNo()) { Box.warnBox("Mobile Number already taken."); return; } if (isExistPIN()) { Box.warnBox("PIN already in used. Please input another PIN."); txtPIN.Text = ""; txtPIN.Focus(); return; } } if (id > 0) { if (temp != txtuser.Text) { if (isExist()) { Box.warnBox("Username already taken."); return; } } if (tempMobileNo != txtContactNo.Text) { if (isExistMobileNo()) { Box.warnBox("Mobile Number already taken. (Ayaw pugsa!)"); return; } } if (tempPIN != txtPIN.Text) { if (isExistPIN()) { Box.warnBox("PIN already in used. Please input another PIN."); txtPIN.Text = ""; txtPIN.Focus(); return; } } } processSave(); _frm.loadData(); this.Close(); }