Friday, May 2, 2008

create a property dataset for coding C# - Sanjeewa Sapumana

//This will provide easy and convenient way of using property C#

#region Properties

DataSet DsCourseList
{
get
{
if (dsCourseList == null)
{
try
{
Course objCourse = new Course();
DataSet dsTemp;
dsTemp = objCourse.GetAllExamPaperDetails();
if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
{
dsCourseList = dsTemp;
Session["dsCourseList"] = dsCourseList;
}
}
catch (Exception ex)
{
ex.Data.Add("UILayerException", this.GetType().ToString() + MyTutorErrorMesseges.Error_Seperator + "DataSet DsCourseList GEt {}");
Response.Redirect("../Error.aspx?LogId=" + MyTutorException.WriteEventLogs(ex, Constants.Database_Connection_Name, Master.LoggedUser.UserName), false);
}
}
return dsCourseList;
}
set
{
dsCourseList = value;
}
}

#endregion

No comments: