public override bool Validate() { // Validate the default validation first bool retVal = base.Validate(); if (retVal) { DataAccess.DataObjects.tbl_payment_type objTblPaymentType = new DataAccess.DataObjects.tbl_payment_type(ref settings); string paymentTypeCode = string.Empty; string ticketingPaymentType = string.Empty; string currentTicketingPaymentType = string.Empty; bool CheckValid = true; string ValidationMessage = string.Empty; ModuleConfiguration objMConfig = null; if (settings.Mode == "create") { // Validate that the payment type does not exist on the ebusiness tables paymentTypeCode = System.Convert.ToString(MConfigs.Find(x => x.ConfigurationItem.DefaultName == "PAYMENT_TYPE_CODE").ConfigurationItem.UpdatedValue); CheckValid = System.Convert.ToBoolean(objTblPaymentType.IsPaymentTypeUnique(paymentTypeCode)); if (!CheckValid) { ValidationMessage = "Payment type code already exists."; objMConfig = MConfigs.Find(x => x.ConfigurationItem.DefaultName == "PAYMENT_TYPE_CODE"); objMConfig.ErrorMessage = ValidationMessage; retVal = false; } } // Has the ticketing payment type changed? if (IsCustomPaymentTypeCode) { ticketingPaymentType = System.Convert.ToString(MConfigs.Find(x => x.ConfigID == VALU51).ConfigurationItem.UpdatedValue); currentTicketingPaymentType = System.Convert.ToString(MConfigs.Find(x => x.ConfigID == VALU51).ConfigurationItem.CurrentValue); if (!(string.IsNullOrWhiteSpace(ticketingPaymentType)) && (ticketingPaymentType != currentTicketingPaymentType)) { // Ticketing payment type must also be unique MD501 md501Obj = new MD501(ref settings); CheckValid = md501Obj.IsPaymentTypeUnique(ticketingPaymentType); if (!CheckValid) { ValidationMessage = "Ticketing code already exists."; objMConfig = MConfigs.Find(x => x.ConfigID == VALU51); objMConfig.ErrorMessage = ValidationMessage; retVal = false; } } } } return(retVal); }