سلام وقت به خیر
دوستان من یک برنامه به صورت سه لایه نوشتم که یک قسمتش وظیفه انتشار و ثبت بن خرید برای کارمندان شرکت رو بر عهده داره
ثبت اطلاعات بن خرید به این صورت انجام میشه که اطلاعات در لایه نمایش (Presentation Layer) گرفته میشه و به لایه منطق تجاری (Business Logic Layer) ارسال میشه :
کد PHP:
private void button1_Click(object sender, EventArgs e)
{
BonClass Obj = new BonClass();
Obj.PersoelID = textBox1.Text;
Obj.Description = textBox2.Text;
.
.
.
Obj.Insert();
}
کد PHP:
class BonClass
{
DataAccessLayer DAL = new DataAccessLayer();
.
.
.
public void Insert()
{
SqlParameter persoelIDParam = new SqlParameter("@PersoelID", this.PersoelID);
SqlParameter descriptionParam = new SqlParameter("@Description", this.Description);
.
.
.
DAL.ExecuteCommand("procBonInsert", CommandType.StoredProcedure, persoelIDParam, descriptionParam, ...);
}
.
.
.
}
کد PHP:
class BonClass
{
DataAccessLayer DAL = new DataAccessLayer();
.
.
.
public void Insert()
{
Checking Conditions //بررسی اینکه آیا قبلا بن خریدی برای کارمند ثبت شده یا نه
.
.
.
if(Conditions true)
{
SqlParameter persoelIDParam = new SqlParameter("@PersoelID", this.PersoelID);
SqlParameter descriptionParam = new SqlParameter("@Description", this.Description);
.
.
.
DAL.ExecuteCommand("procBonInsert", CommandType.StoredProcedure, persoelIDParam, descriptionParam, ...);
}
}
.
.
.
}
- - , .
برچسب:
نویسنده: محمد رضا جوادیان