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()
 {
     int uID = UserBLL.GetIDFromUserName(this.UserName);
     int i = 0;
     if (uID == 0)
     {
         throw new UserEnrolException("Username not found");
     }
     else
     {
         UserEnrolmentBLL u = new UserEnrolmentBLL { UserID = uID, EventID = this.EventID, Key = this.Key };
         i = u.Save();
     }
     return i;
 }
        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 UserEnrolmentBLL GetDetails(int UserID, int EventID)
 {
     DataTable dt = UserEnrolmentDAL.GetDetails(UserID, EventID).Tables[0];
     UserEnrolmentBLL u = new UserEnrolmentBLL();
     if (dt.Rows.Count > 0)
     {
         u = (UserEnrolmentBLL)dt.Rows[0];
     }
     return u;
 }