Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null && Session["Id_top"] != null)
                    {
                        ReadAllGradeCommand cmd = new ReadAllGradeCommand();
                        cmd.Execute();
                        grade_list = cmd.Grades;
                        foreach (Grade grade in grade_list)
                        {
                            list_grades.DataTextField  = "Name";
                            list_grades.DataValueField = "Id";
                            list_grades.DataSource     = grade_list;
                            list_grades.DataBind();
                        }

                        string Id_top = Session["Id_top"].ToString();
                        topic    = new Topic();
                        section  = new Section();
                        course   = new Course();
                        topic.Id = Int32.Parse(Id_top);
                        ReadTopicCommand cmd_ = new ReadTopicCommand(topic);
                        cmd_.Execute();
                        topic      = cmd_.Topic;
                        section.Id = topic.Section.Id;
                        ReadSectionCommand cmd__ = new ReadSectionCommand(section);
                        cmd__.Execute();
                        section   = cmd__.Section;
                        course.Id = section.Course.Id;
                        ReadCourseCommand _cmd = new ReadCourseCommand(course);
                        _cmd.Execute();
                        course = _cmd.Course;
                        list_grades.SelectedValue = course.Grade.Id.ToString();
                        Grade grade_ = new Grade();
                        grade_.Id   = Int32.Parse(list_grades.SelectedValue);
                        grade_.Name = list_grades.DataTextField;
                        ReadAllCourseByGradeCommand __cmd = new ReadAllCourseByGradeCommand(grade_);
                        __cmd.Execute();
                        course_list = __cmd.Courses;
                        foreach (Course course in course_list)
                        {
                            list_course.DataTextField  = "Name";
                            list_course.DataValueField = "Id";
                            list_course.DataSource     = course_list;
                            list_course.DataBind();
                        }
                        list_course.SelectedValue = course.Id;
                        Course _course = new Course();
                        _course.Id   = list_course.SelectedValue;
                        _course.Name = list_course.DataTextField;
                        ReadAllSectionByCourseCommand _cmd_ = new ReadAllSectionByCourseCommand(course);
                        _cmd_.Execute();
                        section_list = _cmd_.Sections;
                        foreach (Section section in section_list)
                        {
                            list_section.DataTextField  = "Name";
                            list_section.DataValueField = "Id";
                            list_section.DataSource     = section_list;
                            list_section.DataBind();
                        }
                        list_section.SelectedValue = section.Id.ToString();
                        name.Value = topic.Name;
                    }
                    else
                    {
                        Response.Redirect("/site/admin/login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 2
0
        protected void Create_Class(object sender, EventArgs e)
        {
            student       = new Student();
            student.Email = Session["Username"].ToString();
            payment       = new List <AraPayment>();
            ReadAllPaymentByStudentCommand _cmd_ = new ReadAllPaymentByStudentCommand(student);

            _cmd_.Execute();
            payment = _cmd_.Payments;
            bool flag = false;

            foreach (AraPayment Payment in payment)
            {
                if (Payment.Section.Id == Int32.Parse(list_section.SelectedValue) && Payment.RemainingClasses > 0)
                {
                    Payment.Id = Payment.Id;
                    Payment.RemainingClasses = Payment.RemainingClasses - 1;
                    UpdateRemainingClassesCommand __cmd_ = new UpdateRemainingClassesCommand(Payment);
                    __cmd_.Execute();
                    topic    = new Topic();
                    topic.Id = Int32.Parse(list_topics.SelectedValue);
                    ReadTopicCommand cmd_ = new ReadTopicCommand(topic);
                    cmd_.Execute();
                    topic = cmd_.Topic;
                    MeetingInJson meetingInJson = ZoomAPI.CreateMeeting(topic.Name, "2021-11-15T20:15:00"); //LLAMADA DE EJEMPLO
                    DateTime      startTime     = DateTime.Parse(fec_ini.Value, CultureInfo.GetCultureInfo("en-US"));
                    DateTime      hourTime      = DateTime.Parse(Hora.Value, System.Globalization.CultureInfo.CurrentCulture);
                    startTime = Convert.ToDateTime(startTime.ToShortDateString() + " " + hourTime.TimeOfDay);
                    DateTime createdAt = DateTime.Now;
                    section       = new Section();
                    section.Id    = Int32.Parse(list_section.SelectedValue);
                    teacher       = new Teacher();
                    teacher.Email = "*****@*****.**";
                    ClassMeeting cm = new ClassMeeting(meetingInJson.id, meetingInJson.uuid, meetingInJson.host_id,
                                                       meetingInJson.host_email, meetingInJson.topic, 1,
                                                       meetingInJson.status, startTime, Int32.Parse(meetingInJson.duration),
                                                       meetingInJson.timezone, meetingInJson.agenda, createdAt, meetingInJson.start_url,
                                                       meetingInJson.join_url, meetingInJson.password, meetingInJson.h323_password, meetingInJson.pstn_password,
                                                       meetingInJson.encrypted_password, "Clase Creada", section, teacher);
                    CreateClassMeetingCommand cmd = new CreateClassMeetingCommand(cm);
                    cmd.Execute();
                    if (cmd.ClassMeeting.Code == 200)
                    {
                        listado              = new Classlist(meetingInJson, student);
                        student              = new Student();
                        classmeet            = new ClassMeeting();
                        classmeet.Id         = meetingInJson.id;
                        student.Email        = Session["Username"].ToString();
                        listado.Student      = student;
                        listado.ClassMeeting = classmeet;
                        CreateClasslistCommand _cmd = new CreateClasslistCommand(listado);
                        _cmd.Execute();
                        flag = true;
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                    }
                }
            }
            if (flag == true)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_succ()", true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_err_class()", true);
            }
        }