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) { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session["Username"] != null && Session["Token"] != null && Session["Id_mod"] != 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_mod = Session["Id_mod"].ToString(); course = new Course(); section = new Section(); section.Id = Int32.Parse(id_mod); 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; name.Value = section.Name; desc.Value = section.Description; amount.Value = section.Amount.ToString(); } else { Response.Redirect("/site/admin/login.aspx"); } } catch (Exception ex) { } } }
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) { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session["Username"] != null && Session["Token"] != null) { Educate educate = new Educate(); Teacher teacher = new Teacher(); teacher.Email = Session["Username"].ToString(); educate.Teacher = teacher; GetSectionsByTeacherCommand cmd = new GetSectionsByTeacherCommand(educate); cmd.Execute(); educateList = cmd.EducateList; foreach (Educate educate1 in educateList) { ReadSectionCommand cmd_ = new ReadSectionCommand(educate1.Section); cmd_.Execute(); section_aux = new Section(); section_aux = cmd_.Section; sectionList.Add(section_aux); } foreach (Section section in sectionList) { list_section.DataTextField = "Name"; list_section.DataValueField = "Id"; list_section.DataSource = sectionList; 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("/site/professor/login.aspx"); } } catch (Exception ex) { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session["Username"] != null && Session["Token"] != null && Session["Id_doc"] != 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_doc = Session["Id_doc"].ToString(); document = new Document(); section = new Section(); course = new Course(); topic = new Topic(); document.Id = Int32.Parse(Id_doc); ReadDocumentCommand cmd_ = new ReadDocumentCommand(document); cmd_.Execute(); document = cmd_.Document; topic.Id = document.Topic.Id; 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(); Section _section = new Section(); _section.Id = Int32.Parse(list_section.SelectedValue); _section.Name = list_section.DataTextField; ReadAllTopicByTopicCommand __cmd__ = new ReadAllTopicByTopicCommand(section); __cmd__.Execute(); topic_list = __cmd__.Topics; foreach (Topic topic in topic_list) { list_topic.DataTextField = "Name"; list_topic.DataValueField = "Id"; list_topic.DataSource = topic_list; list_topic.DataBind(); } list_topic.SelectedValue = topic.Id.ToString(); name.Value = document.File; } else { Response.Redirect("/site/admin/login.aspx"); } } catch (Exception ex) { } } }
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) { } } }
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) { } } }
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>(); teacher = new Teacher(); student.Email = Session["Username"].ToString(); educate = new Educate(); teacher.Email = student.Email; educate.Teacher = teacher; GetSectionsByTeacherCommand cmd_ = new GetSectionsByTeacherCommand(educate); cmd_.Execute(); list_edu = cmd_.EducateList; foreach (Educate educate in list_edu) { section = new Section(); section.Id = educate.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 && classMeeting.Teacher.Email == "*****@*****.**") { list_class_aux.Add(classMeeting); } } } class_data.DataSource = list_class_aux; class_data.DataBind(); int i; list_data = new List <object>(); for (i = 0; i < list_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) { } } }