예제 #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)
                {
                }
            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             if (Session["Username"] != null && Session["Token"] != null)
             {
                 student       = new Student();
                 student.Email = Session["Username"].ToString();
                 ReadAllPaymentByStudentCommand cmd = new ReadAllPaymentByStudentCommand(student);
                 cmd.Execute();
                 list_pagos = cmd.Payments;
                 foreach (AraPayment payment in list_pagos)
                 {
                     section    = new Section();
                     section.Id = payment.Section.Id;
                     ReadSectionCommand cmd_ = new ReadSectionCommand(section);
                     cmd_.Execute();
                     payment.Section.Name = cmd_.Section.Name;
                     mod_data.DataSource  = list_pagos;
                     mod_data.DataBind();
                 }
             }
             else
             {
                 Response.Redirect("/site/student/login.aspx");
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null)
                    {
                        student       = new Student();
                        sections      = new List <Section>();
                        student.Email = Session["Username"].ToString();
                        ReadAllPaymentByStudentCommand cmd_ = new ReadAllPaymentByStudentCommand(student);
                        cmd_.Execute();
                        payment = cmd_.Payments;
                        foreach (AraPayment araPayment in payment)
                        {
                            section    = new Section();
                            section.Id = araPayment.Section.Id;
                            ReadSectionCommand cmd = new ReadSectionCommand(section);
                            cmd.Execute();
                            sections.Add(cmd.Section);
                        }

                        foreach (Section section in sections)
                        {
                            list_section.DataTextField  = "Name";
                            list_section.DataValueField = "Id";
                            list_section.DataSource     = sections;
                            list_section.DataBind();
                        }

                        list_section.Items.Insert(0, new ListItem("Seleccione", ""));
                        list_section.Items[0].Selected = true;
                        list_section.Items[0].Attributes["disabled"] = "disabled";
                    }
                    else
                    {
                        Response.Redirect("login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #4
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);
            }
        }
예제 #5
0
        protected void add_cart(object source, RepeaterCommandEventArgs e)
        {
            student       = new Student();
            student.Email = Session["Username"].ToString();
            ReadAllPaymentByStudentCommand cmd_ = new ReadAllPaymentByStudentCommand(student);

            cmd_.Execute();
            payment  = cmd_.Payments;
            CartList = (List <Section>)Session["ScItms"];
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;
            string      id           = ((Label)rb_mod.Items[e.Item.ItemIndex].FindControl("Id")).Text;
            Boolean     flag         = false;

            if (action.ID.Equals("add"))
            {
                try
                {
                    if (CartList == null)
                    {
                        foreach (AraPayment araPayment in payment)
                        {
                            if (araPayment.Section.Id == Int32.Parse(id))
                            {
                                flag = true;
                                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertmeErr()", true);
                            }
                            else
                            {
                            }
                        }
                        if (flag == false)
                        {
                            CartList   = new List <Section>();
                            section    = new Section();
                            section.Id = Int32.Parse(id);
                            ReadSectionCommand cmd = new ReadSectionCommand(section);
                            cmd.Execute();
                            CartList.Add(cmd.Section);
                            ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        foreach (AraPayment araPayment in payment)
                        {
                            if (araPayment.Section.Id == Int32.Parse(id))
                            {
                                flag = true;
                                ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertmeErr()", true);
                            }
                            else
                            {
                                foreach (Section section in CartList)
                                {
                                    if (section.Id == Int32.Parse(id))
                                    {
                                        flag = true;
                                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertmeErr()", true);
                                    }
                                    else
                                    {
                                    }
                                }
                            }
                        }

                        if (flag == false)
                        {
                            section    = new Section();
                            section.Id = Int32.Parse(id);
                            ReadSectionCommand cmd = new ReadSectionCommand(section);
                            cmd.Execute();
                            CartList.Add(cmd.Section);
                            ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                        }
                        else
                        {
                        }
                    }
                    Session["ScItms"] = CartList;
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #6
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)
                {
                }
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["Username"] != null && Session["Token"] != null)
                    {
                        student       = new Student();
                        sections      = new List <Section>();
                        student.Email = Session["Username"].ToString();
                        ReadAllPaymentByStudentCommand cmd_ = new ReadAllPaymentByStudentCommand(student);
                        cmd_.Execute();
                        payment = cmd_.Payments;
                        foreach (AraPayment araPayment in payment)
                        {
                            section    = new Section();
                            section.Id = araPayment.Section.Id;
                            ReadSectionCommand cmd = new ReadSectionCommand(section);
                            cmd.Execute();
                            sections.Add(cmd.Section);
                        }

                        ReadAllClassMeetingCommand _cmd_ = new ReadAllClassMeetingCommand();
                        _cmd_.Execute();
                        list_class = _cmd_.ClassMeetings;
                        foreach (Section section in sections)
                        {
                            foreach (ClassMeeting classMeeting in list_class)
                            {
                                if (section.Id == classMeeting.Section.Id)
                                {
                                    list_class_aux.Add(classMeeting);
                                }
                            }
                        }

                        foreach (ClassMeeting classMeeting1 in list_class_aux)
                        {
                            ReadClasslistCommand cmd2 = new ReadClasslistCommand(classMeeting1);
                            cmd2.Execute();
                            class_list = cmd2.Classlist;
                            if (class_list.Count == 0)
                            {
                                class_aux.Add(classMeeting1);
                            }
                        }
                        class_data.DataSource = class_aux;
                        class_data.DataBind();
                        int i;
                        list_data = new List <object>();
                        for (i = 0; i < class_aux.Count; i++)
                        {
                            var myData = new
                            {
                                title = list_class_aux[i].Agenda,
                                start = new DateTime(list_class_aux[i].StartTime.Year, list_class_aux[i].StartTime.Month, list_class_aux[i].StartTime.Day).ToString("yyyy-MM-dd")
                            };

                            list_data.Add(myData);
                        }
                        //Tranform it to Json object
                        jsonData = JsonConvert.SerializeObject(list_data);
                    }
                    else
                    {
                        Response.Redirect("login.aspx");
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }