public static UserEnrolmentBLL GetDetails(int UserEnrolmentID) { DataTable dt = UserEnrolmentDAL.GetDetails(UserEnrolmentID).Tables[0]; UserEnrolmentBLL u = new UserEnrolmentBLL(); if (dt.Rows.Count > 0) { u = (UserEnrolmentBLL)dt.Rows[0]; } return(u); }
public int Save() { CourseCreditsBLL cc = null; if (Key != null) { cc = CourseCreditsBLL.GetDetails(Key); if (cc == null) { throw new CourseCreditsException("Invalid Key."); } if (cc.UsedCredits < cc.TotalCredits) { EventID = cc.EventID; } else { throw (new CourseCreditsException("There are no credits left for this key.")); } } if (EventID > 0) { if (UserEnrolmentBLL.GetDetails(UserID, EventID).ID == 0) { AdminUserID = UserBLL.AdminID; ID = UserEnrolmentDAL.Save(UserID, EventID, AdminUserID, (cc.ID > 0) ? "s" : "a", "v", cc.ID); if (ID > 0 && cc != null) { cc++; } } else { throw new UserEnrolException("This user is already enrolled on this event."); } } else { throw (new UserEnrolException("Must include valid EventID or Credit Key")); } return(ID); }
public static List <UserEnrolmentBLL> List() { DataTable dt = UserEnrolmentDAL.List().Tables[0]; return(dt.AsEnumerable().Select(r => (UserEnrolmentBLL)r).ToList()); }