Short answer
In your presentation layer, map the string type to the DAL.collection type. You can see it here.
protected void ddl_Customers_SelectedIndexChanged(object sender, EventArgs e) { string selectedValue = ddl_Customers.SelectedValue.ToString();
Explanation
Both errors are compilation errors. You can see their recreation as in this script .
Error 1
The best overloaded method matching for 'BLL.business.returnTicket (DAL.collection)' has some invalid arguments
The compiler is trying to find a method called BLL.business.returnTicket that takes one argument. In the found match, the method takes one argument DAL.collection . You pass string instead, which is an invalid argument because string not DAL.collection . From MSDN :
Overload resolution is a compile-time mechanism for selecting the best member of a function to call a given list of arguments and a set of candidate elements.
Error 2
Argument 1: cannot be converted from 'string' to 'DAL.collection'
Since BLL.business.returnTicket accepts the DAL.collection argument, the compiler tries to convert string to DAL.collection . It fails because there is no implicit conversion from type string to type DAL.collection . From MSDN :
Implicit conversions: no special syntax is required because the conversion is type safe and data will not be lost.
What to do?
There are several approaches that you could take in order of complexity.
In your presentation layer, map the string type to the DAL.collection type. Recommended.
At your business level, create a new returnTicket(string) method, in addition to the existing one, which maps the string class to the DAL.collection class. Recommended.
Change both returnTicket(DAL.collection) and GetTicket(DAL.collection) to take string instead of DAL.collection . This has two drawbacks: it will break other code that currently calls these methods with the DAL.collection argument, and requires changing four lines of code in two different ways.
Create a custom conversion from string to DAL.collection. Downside: This is probably a bust.
Recommended Actions
In your presentation layer, convert or map the string type to the DAL.collection type. Here is what makes the short answer above.
Alternatively, at your business level, create a new overload of the returnTicket(string) method in addition to the existing method. It will look like this.
public string returnTicket(collection b) {
Shaun luttin
source share