Ejemplo n.º 1
0
        protected void top_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("join"))
            {
                try
                {
                    student   = new Student();
                    classmeet = new ClassMeeting();
                    listado   = new Classlist();
                    Section section = new Section();
                    string  id      = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    section.Id           = Int32.Parse(((Label)class_data.Items[e.Item.ItemIndex].FindControl("section")).Text);
                    classmeet.Id         = id;
                    student.Email        = Session["Username"].ToString();
                    listado.ClassMeeting = classmeet;
                    listado.Student      = student;
                    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 == section.Id && Payment.RemainingClasses > 0)
                        {
                            Payment.Id = Payment.Id;
                            Payment.RemainingClasses = Payment.RemainingClasses - 1;
                            UpdateRemainingClassesCommand __cmd_ = new UpdateRemainingClassesCommand(Payment);
                            __cmd_.Execute();
                            CreateClasslistCommand _cmd_ = new CreateClasslistCommand(listado);
                            _cmd_.Execute();
                            flag = true;
                        }
                    }
                    if (flag == true)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_succ()", true);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_err_class()", true);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("modify"))
            {
                try
                {
                }
                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);
            }
        }
Ejemplo n.º 3
0
        protected void mat_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("join"))
            {
                try
                {
                    clase = new ClassMeeting();
                    string date = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("starttime")).Text;
                    clase.StartTime = Convert.ToDateTime(date);
                    if (clase.StartTime.ToShortDateString() == DateTime.Now.ToShortDateString())
                    {
                        string joinurl = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("joinurl")).Text;
                        Response.Redirect(joinurl);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("cancel"))
            {
                try
                {
                    clase     = new ClassMeeting();
                    clase_aux = new List <Classlist>();
                    string id = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    clase.Id = id;
                    ReadClasslistCommand cmd__ = new ReadClasslistCommand(clase);
                    cmd__.Execute();
                    clase_aux = cmd__.Classlist;
                    foreach (Classlist classlist in clase_aux)
                    {
                        if (classlist.Student.Email == Session["Username"].ToString())
                        {
                            DeleteClasslistCommand __cmd__ = new DeleteClasslistCommand(classlist);
                            __cmd__.Execute();
                        }
                    }
                    student       = new Student();
                    student.Email = Session["Username"].ToString();
                    string sectionid = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("sectionId")).Text;
                    payment = new List <AraPayment>();
                    ReadAllPaymentByStudentCommand _cmd_ = new ReadAllPaymentByStudentCommand(student);
                    _cmd_.Execute();
                    payment = _cmd_.Payments;
                    foreach (AraPayment Payment in payment)
                    {
                        if (Payment.Section.Id == Int32.Parse(sectionid))
                        {
                            Payment.Id = Payment.Id;
                            Payment.RemainingClasses = Payment.RemainingClasses + 1;
                            UpdateRemainingClassesCommand __cmd_ = new UpdateRemainingClassesCommand(Payment);
                            __cmd_.Execute();
                        }
                    }
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_del()", true);
                }
                catch (Exception ex)
                {
                }
            }
        }