I am using a 3 tier architecture in my C# WinForms application. When I compile the application, I am thrown with the following error in my Presentation layer form1.cs
Code:
private void btnSave_Click(object sender, EventArgs e)
{
BLL.clsBLL obj = new BLL.clsBLL();
string firstname = txtClientFirstName.Text;
string lastname = txtClientLastName.Text;
string age = txtClientAge.Text;
int Res = 0;
try
{
Res = obj.Save_Client(Client_FirstName, Client_Lastname, Client_Age);
}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
if(Res ==1)
{
MessageBox.Show("Data Saved");
}
else
{
MessageBox.Show("Data Not Saved");
}
}
Error:
'BLL.clsBLL' does not contain a definition for 'Save_Client' and no extension method 'Save_Client' accepting a first argument of type 'BLL.clsBLL' could be found (are you missing a using directive or an assembly reference?)
The code for the Save_Client in BLL layer in as follows:
Code:
public int Save_Client(string Client_FirstName, string Client_Lastname, string Client_Age)
{
Boolean bopassed = true;
bopassed = Check_Rules(Client_FirstName, Client_Lastname, Client_Age);
DAL.clsDAL obj = new DAL.clsDAL();
int Res = 0;
try
{
if (bopassed == true)
{
obj.Insert_Clients(Client_FirstName, Client_Lastname, Convert.ToInt32(Client_Age));
Res = 1;
}
else
{
Res = 0;
}
}
catch (SqlException)
{
throw;
}
return Res;
}
private Boolean Check_Rules(Client_FirstName, Client_Lastname, Client_Age)
{
Boolean bolres = true;
if(Client_FirstName=="")
{
bolres=false;
}
if(Client_Lastname=="")
{
bolres=false;
}
if(Client_Age=="")
{
bolres=false;
}
return bolres;
}
Error:
"Identifier Expected"
in the method private Boolean Check_Rules(Client_FirstName, Client_Lastname, Client_Age)
I can't able to figure out the cause for the errors .
Can anybody tell me what the issue is?