本文整理汇总了C#中SqlFilter.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# SqlFilter.Validate方法的具体用法?C# SqlFilter.Validate怎么用?C# SqlFilter.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlFilter
的用法示例。
在下文中一共展示了SqlFilter.Validate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: pictFindDeadletter_Click
private void pictFindDeadletter_Click(object sender, EventArgs e)
{
try
{
deadletterDataGridView.SuspendDrawing();
deadletterDataGridView.SuspendLayout();
if (deadletterBindingList == null)
{
return;
}
using (var form = new TextForm(FilterExpressionTitle, FilterExpressionLabel, deadletterFilterExpression))
{
form.Size = new Size(600, 200);
if (form.ShowDialog() != DialogResult.OK)
{
return;
}
deadletterFilterExpression = form.Content;
if (string.IsNullOrWhiteSpace(deadletterFilterExpression))
{
deadletterBindingSource.DataSource = deadletterBindingList;
deadletterDataGridView.DataSource = deadletterBindingSource;
writeToLog(FilterExpressionRemovedMessage);
}
else
{
Filter filter;
try
{
var sqlFilter = new SqlFilter(deadletterFilterExpression);
sqlFilter.Validate();
filter = sqlFilter.Preprocess();
}
catch (Exception ex)
{
writeToLog(string.Format(FilterExpressionNotValidMessage, deadletterFilterExpression, ex.Message));
return;
}
var filteredList = deadletterBindingList.Where(filter.Match).ToList();
var bindingList = new SortableBindingList<BrokeredMessage>(filteredList)
{
AllowEdit = false,
AllowNew = false,
AllowRemove = false
};
deadletterBindingSource.DataSource = bindingList;
deadletterDataGridView.DataSource = deadletterBindingSource;
writeToLog(string.Format(FilterExpressionAppliedMessage, deadletterFilterExpression, bindingList.Count));
}
}
}
catch (Exception ex)
{
HandleException(ex);
}
finally
{
deadletterDataGridView.ResumeLayout();
deadletterDataGridView.ResumeDrawing();
}
}
示例2: ValidateParameters
private bool ValidateParameters()
{
try
{
if (string.IsNullOrEmpty(txtMessageText.Text))
{
writeToLog(MessageCannotBeNull);
return false;
}
int temp;
if (string.IsNullOrEmpty(txtReceiveTimeout.Text) ||
!int.TryParse(txtReceiveTimeout.Text, out temp) ||
temp <= 0)
{
writeToLog(ReceiveTimeoutCannotBeNull);
return false;
}
receiveTimeout = temp;
if (string.IsNullOrEmpty(txtSessionTimeout.Text) ||
!int.TryParse(txtSessionTimeout.Text, out temp) ||
temp <= 0)
{
writeToLog(SessionTimeoutCannotBeNull);
return false;
}
sessionTimeout = temp;
if (string.IsNullOrEmpty(txtPrefetchCount.Text) ||
!int.TryParse(txtPrefetchCount.Text, out temp))
{
writeToLog(PrefetchCountCannotBeNull);
return false;
}
prefetchCount = temp;
if (!int.TryParse(txtMessageCount.Text, out temp) || temp < 0)
{
writeToLog(MessageCountMustBeANumber);
return false;
}
messageCount = temp;
if (!int.TryParse(txtSendTaskCount.Text, out temp) || temp <= 0)
{
writeToLog(SendTaskCountMustBeANumber);
return false;
}
senderTaskCount = temp;
if (!int.TryParse(txtReceiveTaskCount.Text, out temp) || temp <= 0)
{
writeToLog(ReceiveTaskCountMustBeANumber);
return false;
}
receiverTaskCount = temp;
var sqlFilter = new SqlFilter(!string.IsNullOrEmpty(txtFilterExpression.Text)
? txtFilterExpression.Text
: DefaultFilterExpression);
sqlFilter.Validate();
filter = sqlFilter.Preprocess();
if (filter == null)
{
writeToLog(FilterExpressionIsNotValid);
}
}
catch (Exception ex)
{
mainForm.HandleException(ex);
return false;
}
return true;
}
示例3: ValidateParameters
private bool ValidateParameters()
{
try
{
if (string.IsNullOrWhiteSpace(txtMessageText.Text))
{
writeToLog(MessageCannotBeNull);
return false;
}
int temp;
if (string.IsNullOrWhiteSpace(txtReceiveTimeout.Text) ||
!int.TryParse(txtReceiveTimeout.Text, out temp) ||
temp < 0)
{
writeToLog(ReceiveTimeoutCannotBeNull);
return false;
}
receiveTimeout = temp;
if (string.IsNullOrWhiteSpace(txtServerTimeout.Text) ||
!int.TryParse(txtServerTimeout.Text, out temp) ||
temp < 0)
{
writeToLog(SessionTimeoutCannotBeNull);
return false;
}
sessionTimeout = temp;
if (string.IsNullOrWhiteSpace(txtPrefetchCount.Text) ||
!int.TryParse(txtPrefetchCount.Text, out temp))
{
writeToLog(PrefetchCountCannotBeNull);
return false;
}
prefetchCount = temp;
if (!int.TryParse(txtMessageCount.Text, out temp) || temp < 0)
{
writeToLog(MessageCountMustBeANumber);
return false;
}
messageCount = temp;
if (!int.TryParse(txtSendBatchSize.Text, out temp) || temp <= 0)
{
writeToLog(SenderBatchSizeMustBeANumber);
return false;
}
senderBatchSize = temp;
if (!int.TryParse(txtReceiveBatchSize.Text, out temp) || temp <= 0)
{
writeToLog(ReceiverBatchSizeMustBeANumber);
return false;
}
receiverBatchSize = temp;
if (!int.TryParse(txtSenderThinkTime.Text, out temp) || temp <= 0)
{
writeToLog(SenderThinkTimeMustBeANumber);
return false;
}
senderThinkTime = temp;
if (!int.TryParse(txtReceiverThinkTime.Text, out temp) || temp <= 0)
{
writeToLog(ReceiverThinkTimeMustBeANumber);
return false;
}
receiverThinkTime = temp;
if (!int.TryParse(txtSendTaskCount.Text, out temp) || temp <= 0)
{
writeToLog(SendTaskCountMustBeANumber);
return false;
}
senderTaskCount = temp;
if (!int.TryParse(txtReceiveTaskCount.Text, out temp) || temp <= 0)
{
writeToLog(ReceiveTaskCountMustBeANumber);
return false;
}
receiverTaskCount = temp;
var sqlFilter = new SqlFilter(!string.IsNullOrWhiteSpace(txtFilterExpression.Text)
? txtFilterExpression.Text
: DefaultFilterExpression);
sqlFilter.Validate();
filter = sqlFilter.Preprocess();
if (filter == null)
{
writeToLog(FilterExpressionIsNotValid);
}
if (messageTabControl.SelectedIndex == FilesTabPage)
{
var fileList = messageFileListView.Items.Cast<ListViewItem>()
.Where(i => i.Checked)
.Select(i => i.Text)
.ToList();
if (fileList.Count == 0)
{
writeToLog(NoMessageSelected);
return false;
}
}
if (messageTabControl.SelectedIndex == GeneratorTabPage && cboBrokeredMessageGeneratorType.SelectedIndex < 1)
{
writeToLog(string.Format(SelectBrokeredMessageGeneratorWarning, topic.Path));
return false;
//.........这里部分代码省略.........
示例4: ValidateParameters
private bool ValidateParameters()
{
try
{
int temp;
if (string.IsNullOrWhiteSpace(txtReceiveTimeout.Text) ||
!int.TryParse(txtReceiveTimeout.Text, out temp) ||
temp < 0)
{
writeToLog(ReceiveTimeoutCannotBeNull);
return false;
}
receiveTimeout = temp;
if (string.IsNullOrWhiteSpace(txtServerTimeout.Text) ||
!int.TryParse(txtServerTimeout.Text, out temp) ||
temp < 0)
{
writeToLog(SessionTimeoutCannotBeNull);
return false;
}
sessionTimeout = temp;
if (string.IsNullOrWhiteSpace(txtPrefetchCount.Text) ||
!int.TryParse(txtPrefetchCount.Text, out temp))
{
writeToLog(PrefetchCountCannotBeNull);
return false;
}
prefetchCount = temp;
if (!int.TryParse(txtReceiveBatchSize.Text, out temp) || temp <= 0)
{
writeToLog(ReceiverBatchSizeMustBeANumber);
return false;
}
receiverBatchSize = temp;
if (!int.TryParse(txtReceiverThinkTime.Text, out temp) || temp <= 0)
{
writeToLog(ReceiverThinkTimeMustBeANumber);
return false;
}
receiverThinkTime = temp;
if (!int.TryParse(txtReceiveTaskCount.Text, out temp) || temp <= 0)
{
writeToLog(ReceiveTaskCountMustBeANumber);
return false;
}
receiverTaskCount = temp;
var sqlFilter = new SqlFilter(!string.IsNullOrWhiteSpace(txtFilterExpression.Text)
? txtFilterExpression.Text
: DefaultFilterExpression);
sqlFilter.Validate();
filter = sqlFilter.Preprocess();
if (filter == null)
{
writeToLog(FilterExpressionIsNotValid);
}
}
catch (Exception ex)
{
HandleException(ex);
return false;
}
return true;
}