예제 #1
0
    protected void RegIE_Click(object sender, EventArgs e)
    {
        LearningManagementSystem.Components.User _user = new LearningManagementSystem.Components.User();
        _user.AccessToken = TextAccessTokenIE.Text.ToString();
        _user.FirstName   = TextFirstNameIE.Text.ToString();
        _user.LastName    = TextLastNameIE.Text.ToString();
        _user.Title       = DDTextTitleIE.SelectedItem.Text.ToString();
        _user.Designation = DDDesignationIE.SelectedItem.Text.ToString();
        _user.Address     = TextAddressIE.Text.ToString();
        _user.Country     = Convert.ToInt64(DDCountryIE.SelectedValue);
        _user.State       = Convert.ToInt64(StateID.Value);
        _user.City        = Convert.ToInt64(CityID.Value);
        _user.EMailID     = TextEMailIDIE.Text.ToString();
        _user.Username    = TextEMailIDIE.Text.ToString(); //TextNameIE.Text.ToString();
        _user.Password    = TextPasswordIE.Text.ToString();
        if (_user.UpdateUser())
        {
            AssignCourses(_user);

            AcMessage.InnerHtml = "Your account has been activated successfully";
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "openActivateModal();", true);
        }
        else
        {
            AcMessage.InnerHtml = "There is an error while activating your account. Try again!";
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "openActivateModal();", true);
        }
    }
예제 #2
0
    public static void AssignCourses(LearningManagementSystem.Components.User _user)
    {
        try
        {
            Omnificence.Trace.Logger.Log("Assigning courses...");

            DateTime  cDate  = DateTime.Now.AddDays(90);
            DataTable course = LearningManagementSystem.Components.Course.GetActiveCourses();

            Int64 courseId = 0;

            for (Int32 Index = 0; Index < course.Rows.Count; Index++)
            {
                courseId = Convert.ToInt64(course.Rows[Index]["Course_Id"]);
                Omnificence.Trace.Logger.Log("Assigning course id..." + courseId.ToString());
                LearningManagementSystem.Components.Course.AssignCoursetoUser(courseId, _user.UserID, cDate, CourseStatus.NotYetStarted);

                // Get SubCourses

                DataTable subCourse = LearningManagementSystem.Components.Course.GetSubCourses(courseId);
                for (int sub = 0; sub < subCourse.Rows.Count; sub++)
                {
                    Omnificence.Trace.Logger.Log("Assigning subcourse id..." + subCourse.Rows[sub]["Sub_Course_Id"].ToString());
                    LearningManagementSystem.Components.User.MapCoursetoUser(Convert.ToInt64(_user.UserID), Convert.ToInt64(subCourse.Rows[sub]["Sub_Course_Id"].ToString()), subCourse.Rows[sub]["Pass_Percentage"].ToString(), UserCourseStatus.NotYetStarted);
                }

                //courseString.AppendLine(course.Rows[Index]["Name"].ToString() + " " + Environment.NewLine);
            }
        }
        catch (Exception assign)
        {
            Omnificence.Trace.Logger.Log("Error in course assignment : " + assign.StackTrace);
        }
    }