@jay,
Hi ,
how to write the business logic codes for an application..i had send some sample coding...pls generate business logic codes for the code..and briefly explain that the business logic codes..
thanx....bye
karthik.k
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
jaya kumar47 reputationPosted Feb 21, 2011, 7:55 PM EST
i given some example to handle Business logic and DataLayer.
Create two class files,like BL.cs and ProductProperties.cs
*to write all Business related functionality in BL.cs
to write code for Login verification (Login Button Click event)
protected void Login_click(object sender, EventArgs e)
{
// to set properties
ProductProperties Obj=new ProductProperties();
Obj.UserName=TextBox1.text;
Obj.Password=TextBox2.text;
//to create Object for BL.cs
BL ObjBL=new BL()
if(ObjBL.isvalid())
{
//login sucessfully...
}
else
{
invalid username or password...
}
}
----------------------------------------------------------------
public class ProductProperties
{
private string userName,Password;
public string UserName
{
set{userName=value;}
get{return userName;}
}
public string Password
{
set{password=value;}
get{return password;}
}
// to write like this for all needed variables..
}
----------------------------------------------------------------
public class BL
{
public BL()
{
//to establish the connection...
}
//to call DB using DataSet or ExecuteScalar
public boolen isvalid(ProductProperties Obj)
{
//to validate username and password using Querystring or StoredProcedure if valid hten return true else return false here am using storedProcedure.
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add("@loginID", SqlDbType.VarChar).Value = TextBox1.Text;//loginID-procedure first argument
cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = TextBox2.Text;//Password-procedure second argument
cmd = new SqlCommand("submitrecord", con);//submitrecord-stored procedure name
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
isValidUser=(cmd.ExecuteScalar().Hasrow)
con.Close()
return (isValidUser);
}
// to insert any data use ExecuteNonquery method..
public int newData(ProductProperties Obj)
{
return(row affected or not..)
}
//to display all datas use Dataset.
public Dataset Alldatas(ProductProperties Obj)
{
return (dataset);
}
}
Felipe RamosRank #1,409 · 1.2K reputationPosted Feb 21, 2011, 5:41 AM EST
-Customer
-Supplier
-Product
You could further extend that by have
CustomerCollection : List
SuppllierCollection : List
etc.
You will also need your data access class
CustomerDAL
SupplierDAL
ProductDAL
example of Customer in vb since your code is on vb
Karthik KRank #1,981 · 738 reputationPosted Oct 26, 2012, 3:19 AM EDT
By
karthik.k
Karthik KRank #1,981 · 738 reputationPosted Oct 26, 2012, 3:20 AM EDT