private static bool ValidateVouchersByDateArguments(string startDate, string endDate) { try { if (!string.IsNullOrEmpty(startDate.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(startDate.Trim()))) { return(false); } } if (!string.IsNullOrEmpty(endDate.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(endDate.Trim()))) { return(false); } } return(true); } catch { return(false); } }
private bool ValidateControls() { try { var period = int.Parse(ddlPaymentPeriod.SelectedValue); if (period < 1) { ConfirmAlertBox1.ShowMessage("Please Select a Period.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (period == 3) { if (string.IsNullOrEmpty(txtPaymentStart.Text.Trim()) && string.IsNullOrEmpty(txtPaymentEndDate.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (string.IsNullOrEmpty(txtPaymentStart.Text.Trim()) || string.IsNullOrEmpty(txtPaymentStart.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (!string.IsNullOrEmpty(txtPaymentStart.Text.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtPaymentStart.Text.Trim()))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } if (!string.IsNullOrEmpty(DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim()))) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim()))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } if (!DateMap.IsEarlyDate(DateMap.ReverseToServerDate(txtPaymentStart.Text.Trim()), DateMap.ReverseToServerDate(txtPaymentEndDate.Text.Trim()))) { ConfirmAlertBox1.ShowMessage("The 'From' date should not be LATER than the 'To' date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } return(true); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }
private bool ValidateControls() { try { if (string.IsNullOrEmpty(txtStart.Text.Trim()) && string.IsNullOrEmpty(txtEndDate.Text.Trim())) { ErrorDisplay1.ShowError("Please enter at least a date."); return(false); } if (!string.IsNullOrEmpty(txtStart.Text.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtStart.Text.Trim()))) { ErrorDisplay1.ShowError("Please enter a valid date."); return(false); } } if (!string.IsNullOrEmpty(txtEndDate.Text.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtEndDate.Text.Trim()))) { ErrorDisplay1.ShowError("Please enter a valid date."); return(false); } } if (!string.IsNullOrEmpty(txtStart.Text.Trim()) && !string.IsNullOrEmpty(txtEndDate.Text.Trim())) { if (!DateMap.IsEarlyDate(DateMap.ReverseToServerDate(txtStart.Text.Trim()), DateMap.ReverseToServerDate(txtEndDate.Text.Trim()))) { ErrorDisplay1.ShowError("The 'From' date should not be LATER than the 'To' date."); return(false); } } return(true); } catch { ErrorDisplay1.ShowError("An unknown error was encountered. Please try again soon or contact the Admin."); return(false); } }
private bool ValidateDateControls() { try { if (string.IsNullOrEmpty(txtStart.Text.Trim()) && string.IsNullOrEmpty(txtEndDate.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (string.IsNullOrEmpty(txtStart.Text.Trim()) || string.IsNullOrEmpty(txtStart.Text.Trim())) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (!string.IsNullOrEmpty(txtStart.Text.Trim())) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtStart.Text.Trim()))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } if (!string.IsNullOrEmpty(DateMap.ReverseToServerDate(txtEndDate.Text.Trim()))) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(txtEndDate.Text.Trim()))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } return(true); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }
private bool ValidateVouchersByDateArguments(string startDate, string endDate) { try { if (string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(startDate)) { ConfirmAlertBox1.ShowMessage("Please enter a date range.", ConfirmAlertBox.PopupMessageType.Error); return(false); } if (!string.IsNullOrEmpty(startDate)) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(startDate))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } if (!string.IsNullOrEmpty(DateMap.ReverseToServerDate(endDate))) { if (!DateMap.IsDate(DateMap.ReverseToServerDate(endDate))) { ConfirmAlertBox1.ShowMessage("Please enter a valid date.", ConfirmAlertBox.PopupMessageType.Error); return(false); } } return(true); } catch { ConfirmAlertBox1.ShowMessage("An unknown error was encountered. Please try again soon or contact the Admin.", ConfirmAlertBox.PopupMessageType.Error); return(false); } }