protected bool DataOk() { // check date if (rddpInvoiceDate.SelectedDate == null) { lblMessage.Text = Resources.GeneralResource.DateNeeded; return(false); } // we need the professional in order to do another test if (txtProfessionalId.Text == "") { lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded; return(false); } prof = CntAriCli.GetProfessional(int.Parse(txtProfessionalId.Text), ctx); if (prof == null) { lblMessage.Text = Resources.GeneralResource.ProfessionalNeeded; return(false); } // check if there're invoices with older date if (inv == null) { if (!CntAriCli.CorrectProfessionalInvoiceDate((DateTime)rddpInvoiceDate.SelectedDate, prof)) { lblMessage.Text = Resources.GeneralResource.IncorrectInvoiceDate; return(false); } } return(true); }