Beispiel #1
0
 public Enrollment SendUserEnrollment(DataTable dataTableEnrollment)
 {
     Enrollment enrollment = new Enrollment();
     enrollment.Id = Convert.ToInt32(dataTableEnrollment.Rows[0]["Id"]);
     enrollment.Lapse.Id = Convert.ToInt32(dataTableEnrollment.Rows[0]["LapseId"]);
     enrollment.Lapse.Name = dataTableEnrollment.Rows[0]["LapseName"].ToString();
     return enrollment;
 }
Beispiel #2
0
        protected Enrollment CreateEnrollment()
        {
            Lapse lapse = new Lapse();
            Enrollment enrollment = new Enrollment();
            lapse = lapseData.SendLapse(lapseData.DataTableLapseOn());
            enrollment.UserName = Session["User-UserName"].ToString();
            enrollment.Lapse = lapse;

            if (lapse == null)
                return null;
            else
                return enrollment;
        }
Beispiel #3
0
 public void UpdateEnrollment(Enrollment enrollment)
 {
     SqlConnection connection = ManageDatabaseConnection("Open");
     using (SqlCommand update = new SqlCommand(@"UpdateEnrollment", connection))
     {
         update.CommandType = CommandType.StoredProcedure;
         update.Parameters.Add("@UserName", SqlDbType.VarChar).Value = enrollment.UserName;
         update.Parameters.Add("@LapseId", SqlDbType.Int).Value = enrollment.Lapse.Id;
         update.Parameters.Add("@LapseName", SqlDbType.VarChar).Value = enrollment.Lapse.Name;
         update.ExecuteNonQuery();
     }
     connection = ManageDatabaseConnection("Close");
 }
Beispiel #4
0
 protected void InsertEnrollment(Enrollment enrollment)
 {
     if (enrollment == null)
         buttonStyle.buttonStyleRed(buttonErrors, "No lapse active you can't create your enrollment.");
     else
     {
         try
         {
             enrollmentData.InsertEnrollment(enrollment);
             buttonActivateEnrollment.Visible = true;
             buttonCreateEnrollment.Visible = false;
             buttonStyle.buttonStyleBlue(buttonErrors, "Enrollment created succesfull.");
             SetEnrollmentValues();
         }
         catch (Exception)
         {
             buttonStyle.buttonStyleRed(buttonErrors, "Ops an error ocurred creating your enrollment." + "\n" + "Please, try again.");
         }
     }
 }
Beispiel #5
0
 protected void ActivateEnrollment(Enrollment enrollment)
 {
     if (enrollment != null)
     {
         try
         {
             enrollmentData.UpdateEnrollment(enrollment);
             SetEnrollmentValues();
             buttonActivateEnrollment.Disabled = true;
             buttonStyle.buttonStyleBlue(buttonErrors, "Enrollment activated successful");
         }
         catch (Exception)
         {
             buttonStyle.buttonStyleRed(buttonErrors, "Ops an error ocurred activating your enrollment." + "\n" + "Please, try again.");
         }
     }
     else
     {
         buttonStyle.buttonStyleRed(buttonErrors, "You can't activate your enrollment." + "/n" + "Please, wait one week before begin the period.");
     }
 }