مدیریت ساده چهار عمل اصلی تکراری داده در صفحات - قسمت 2
نویسنده: مهدی پایروند
تاریخ: ۱۳۹۱/۰۴/۱۱ ۲۱:۴۶
آدرس: www.dntips.ir
public partial class product : PageStateMachine
{
protected void btnSave_Click(object sender, EventArgs e)
{
Go(PageState.Save);
}
protected override ... Save()
{
try
{
if (Id > 0)
{
// get from bank and update
}
else
{
// create new one and add it to context
}
}
catch (Exception ex)
{
// handle exception
}
}
protected void btnSelect_Click(object sender, EventArgs e)
{
Go(PageState.Select);
}
protected override ... Select()
{
try
{
// get from bank and show in details
}
catch (Exception ex)
{
// handle exception
}
}
protected void btnDelete_Click(object sender, EventArgs e)
{
Go(PageState.Delete);
}
protected override StateMachineMessage Delete()
{
try
{
// remove from bank
}
catch (Exception ex)
{
// handle exception
}
}
}