Repository navigation
Expand file tree
/
Copy pathCommandParameterCollection.cs
More file actions
69 lines (65 loc) · 1.99 KB
/
Copy pathCommandParameterCollection.cs
File metadata and controls
69 lines (65 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using FastReport.Utils;
namespace FastReport.Data
{
/// <summary>
/// Represents the collection of <see cref="CommandParameter"/> objects.
/// </summary>
/// <remarks>
/// This class is used to store the list of parameters defined in the datasource. See the
/// <see cref="TableDataSource.Parameters"/> property for more details.
/// </remarks>
public class CommandParameterCollection : FRCollectionBase
{
/// <summary>
/// Gets or sets a parameter.
/// </summary>
/// <param name="index">The index of a parameter in this collection.</param>
/// <returns>The parameter with specified index.</returns>
public CommandParameter this[int index]
{
get { return List[index] as CommandParameter; }
set { List[index] = value; }
}
/// <summary>
/// Finds a parameter by its name.
/// </summary>
/// <param name="name">The name of a parameter.</param>
/// <returns>The <see cref="CommandParameter"/> object if found; otherwise <b>null</b>.</returns>
public CommandParameter FindByName(string name)
{
foreach (CommandParameter c in this)
{
if (c.Name == name)
return c;
}
return null;
}
/// <summary>
/// Returns an unique parameter name based on given name.
/// </summary>
/// <param name="name">The base name.</param>
/// <returns>The unique name.</returns>
public string CreateUniqueName(string name)
{
string baseName = name;
int i = 1;
while (FindByName(name) != null)
{
name = baseName + i.ToString();
i++;
}
return name;
}
/// <summary>
/// Initializes a new instance of the <see cref="CommandParameterCollection"/> class with default settings.
/// </summary>
/// <param name="owner">The owner of this collection.</param>
public CommandParameterCollection(Base owner) : base(owner)
{
}
}
}