private bool ValidateData(out string strValidationFailedItem, HBS_Utility.CRUDOperation operation)
        {
            bool   ValidationStatus = true;
            string strToReturn      = string.Empty;

            if (operation == HBS_Utility.CRUDOperation.Insert || operation == HBS_Utility.CRUDOperation.Update)
            {
                strToReturn += (string.IsNullOrEmpty(txtFirstname.Text)) ? "Please enter firstname. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtFirstname.Text, "^[a-zA-Z]+$")) ? "Firstname accepts only alphabetical characters. <br />" : "");
                strToReturn += (string.IsNullOrEmpty(txtLastname.Text)) ? "Please enter lastname. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtLastname.Text, "^[a-zA-Z]+$")) ? "Lastname accepts only alphabetical characters. <br />" : "");
                strToReturn += (string.IsNullOrEmpty(txtDob.Text)) ? "Please enter date of birth. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtEmailId.Text)) ? "Please enter email id. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtEmailId.Text, "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*")) ? "Invalid email format. <br />" : "");
                strToReturn += (string.IsNullOrEmpty(txtContactNo.Text)) ? "Please enter Contact no. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtContactNo.Text, "^[0-9]+$")) ? "Contact no accepts only numeric characters. <br />" : "");
                strToReturn += (string.IsNullOrEmpty(txtAppartment.Text)) ? "Please enter appartment. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtStreet.Text)) ? "Please enter street. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtCity.Text)) ? "Please enter city. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(hidSelectedProvince.Value)) ? "Please select province. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtPostalCode.Text)) ? "Please enter postal code. <br />" : "";
            }

            ValidationStatus        = (string.IsNullOrEmpty(strToReturn.Trim())) ? true : false;
            strValidationFailedItem = strToReturn;
            showMessage("Validation Error", strValidationFailedItem, HBS_Utility.ReturnCode.Failure);

            return(ValidationStatus);
        }
Esempio n. 2
0
        private bool ValidateData(out string strValidationFailedItem, HBS_Utility.CRUDOperation operation)
        {
            bool   ValidationStatus = true;
            string strToReturn      = string.Empty;

            if (operation == HBS_Utility.CRUDOperation.Select)
            {
                strToReturn += (string.IsNullOrEmpty(txtUsername.Text)) ? "Please enter username. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtUsername.Text, "^[a-zA-Z]+$")) ? "Username accepts only alphabetical characters. <br />" : "");
                strToReturn += (string.IsNullOrEmpty(txtPassword.Text)) ? "Please enter password. <br />" : ((!System.Text.RegularExpressions.Regex.IsMatch(txtUsername.Text, "^[a-zA-Z0-9]+$")) ? "Password accepts only alphabetical & numeric characters. <br />" : "");
            }

            ValidationStatus        = (string.IsNullOrEmpty(strToReturn.Trim())) ? true : false;
            strValidationFailedItem = strToReturn;
            showMessage("Validation Error", strValidationFailedItem, HBS_Utility.ReturnCode.Failure);

            return(ValidationStatus);
        }
Esempio n. 3
0
        private bool ValidateData(out string strValidationFailedItem, HBS_Utility.CRUDOperation operation)
        {
            bool   ValidationStatus = true;
            string strToReturn      = string.Empty;

            if (operation == HBS_Utility.CRUDOperation.Insert || operation == HBS_Utility.CRUDOperation.Update)
            {
                strToReturn += (string.IsNullOrEmpty(hidSelectedPatient.Value)) ? "Please select patient. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(hidSelectedDoctor.Value)) ? "Please select doctor. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(hidSelectedProcedure.Value)) ? "Please select procedure. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtAppointmentDate.Text)) ? "Please enter appointment date. <br />" : "";
                strToReturn += (string.IsNullOrEmpty(txtAppointmentTime.Text)) ? "Please enter appointment time. <br />" : "";
            }

            ValidationStatus        = (string.IsNullOrEmpty(strToReturn.Trim())) ? true : false;
            strValidationFailedItem = strToReturn;
            showMessage("Validation Error", strValidationFailedItem, HBS_Utility.ReturnCode.Failure);

            return(ValidationStatus);
        }