Beispiel #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
                {
                    teacher   = new Teacher();
                    classmeet = new ClassMeeting();
                    string id = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    classmeet.Id      = id;
                    teacher.Email     = Session["Username"].ToString();
                    classmeet.Teacher = teacher;
                    UpdateClassTeacherCommand _cmd_ = new UpdateClassTeacherCommand(classmeet);
                    _cmd_.Execute();
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_succ()", true);
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("modify"))
            {
                try
                {
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #2
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)
                {
                }
            }
        }
Beispiel #3
0
        public int UpdateClassMeetingTeacher(ClassMeeting classMeeting)
        {
            conn = DAO.getConnection();
            NpgsqlCommand     command     = new NpgsqlCommand(DAOClassMeetingResource.UpdateClassTeacherSP, conn);
            NpgsqlTransaction transaction = conn.BeginTransaction();

            NpgsqlParameter id      = new NpgsqlParameter();
            NpgsqlParameter teacher = new NpgsqlParameter();

            id.ParameterName      = DAOClassMeetingResource.Id;
            teacher.ParameterName = DAOClassMeetingResource.Teacher;

            id.NpgsqlDbType      = NpgsqlTypes.NpgsqlDbType.Varchar;
            teacher.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Varchar;

            id.Direction      = ParameterDirection.Input;
            teacher.Direction = ParameterDirection.Input;

            id.Value      = classMeeting.Id;
            teacher.Value = classMeeting.Teacher.Email;

            command.Parameters.Add(id);
            command.Parameters.Add(teacher);

            command.CommandType = CommandType.StoredProcedure;

            int response = 500;

            NpgsqlDataReader dr = command.ExecuteReader();


            try
            {
                while (dr.Read())
                {
                    response = dr.GetInt32(0);
                }

                dr.Close();
                transaction.Commit();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(response);
        }
        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
                {
                    teacher   = new Teacher();
                    classmeet = new ClassMeeting();
                    string id = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    classmeet.Id      = id;
                    teacher.Email     = "*****@*****.**";
                    classmeet.Teacher = teacher;
                    UpdateClassTeacherCommand _cmd_ = new UpdateClassTeacherCommand(classmeet);
                    _cmd_.Execute();
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_err()", true);
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MeetingInJson meetingInJson = ZoomAPI.CreateMeeting("Test Modular Zoom", "2021-11-15T20:15:00"); //LLAMADA DE EJEMPLO
            DateTime      startTime     = new DateTime();
            DateTime      createdAt     = new DateTime();

            section       = new Section();
            section.Id    = 8;
            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, "Malo", section, teacher);
            CreateClassMeetingCommand cmd = new CreateClassMeetingCommand(cm);

            cmd.Execute();


            //PastMeetingDetails pastMeetingDetails = ZoomAPI.GetPastMeetingDetails("F8FWJVwPRZiheBjSBBbX4g=="); //LLAMADA DE EJEMPLO
            //Response.Redirect(meetingInJson.join_url);
        }
 public CreateClassMeetingCommand(ClassMeeting classMeeting)
 {
     this.classMeeting = classMeeting;
 }
 public UpdateClassTeacherCommand(ClassMeeting classMeeting)
 {
     this.classMeeting = classMeeting;
 }
 public ReadClassMeetingCommand(ClassMeeting classMeeting)
 {
     this.classMeeting = classMeeting;
 }
Beispiel #9
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);
            }
        }
Beispiel #10
0
 public DeleteClassMeetingCommand(ClassMeeting classMeeting)
 {
     this.classMeeting = classMeeting;
 }
Beispiel #11
0
 public UpdateClassCommentCommand(ClassMeeting classMeeting)
 {
     this.classMeeting = classMeeting;
 }
Beispiel #12
0
        private void InitializeDbObjects()
        {
            _currentTerm = new Term()
            {
                Id        = Guid.NewGuid(),
                IsCurrent = true,
                StartDate = DateTime.Now
            };

            _lastTerm = new Term()
            {
                Id        = Guid.NewGuid(),
                IsCurrent = false,
                StartDate = DateTime.Now.AddMonths(-6)
            };

            _termList = new List <Term>
            {
                _currentTerm,
                _lastTerm
            };

            _user0 = new User()
            {
                Id           = Guid.NewGuid(),
                WorkingGroup = new WorkingGroup(),
                DisplayName  = "test User"
            };

            _userList = new List <User>
            {
                _user0
            };

            _course0 = new Course()
            {
                Id               = Guid.NewGuid(),
                UserId           = _user0.Id,
                User             = _user0,
                Term             = _currentTerm,
                MetaCourseId     = Guid.NewGuid(),
                CoursePreference = new CoursePreference()
                {
                    Id = Guid.NewGuid()
                },
                ShowHiddenLessons = true
            };

            _course0.CoursePreferenceId = _course0.CoursePreference.Id;

            _course1 = new Course()
            {
                Id                 = Guid.NewGuid(),
                UserId             = _user0.Id,
                User               = _user0,
                Term               = _lastTerm,
                MetaCourseId       = _course0.MetaCourseId,
                CoursePreference   = _course0.CoursePreference,
                CoursePreferenceId = _course0.CoursePreferenceId,
                ShowHiddenLessons  = true
            };

            _courseList = new List <Course>()
            {
                _course0,
                _course1
            };

            _classSection0 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                CourseId = _course0.Id,
                Course   = _course0
            };

            _classSection1 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                CourseId = _course0.Id,
                Course   = _course0
            };

            _classSection2 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                CourseId = _course1.Id,
                Course   = _course1
            };

            _classSectionList = new List <ClassSection>()
            {
                _classSection0,
                _classSection1,
                _classSection2
            };

            _classMeeting0 = new ClassMeeting()
            {
                Id             = Guid.NewGuid(),
                ClassSectionId = _classSection0.Id,
                ClassSection   = _classSection0,
                StartTime      = DateTime.Now.AddDays(2),
                MeetingNumber  = 1
            };

            _classMeeting1 = new ClassMeeting()
            {
                Id             = Guid.NewGuid(),
                ClassSectionId = _classSection0.Id,
                ClassSection   = _classSection0,
                NoClass        = true, MeetingNumber = 2
            };

            _classMeeting2 = new ClassMeeting()
            {
                Id                = Guid.NewGuid(),
                ClassSectionId    = _classSection0.Id,
                ClassSection      = _classSection0,
                IsBeginningOfWeek = true,
                MeetingNumber     = 3
            };

            _classMeetingList = new List <ClassMeeting>()
            {
                _classMeeting0,
                _classMeeting1,
                _classMeeting2
            };

            _lesson0 = new Lesson()
            {
                Course     = _course0,
                CourseId   = _course0.Id,
                Id         = Guid.NewGuid(),
                LessonPlan = new LessonPlan()
                {
                    Id = Guid.NewGuid()
                },
                Narrative = new Narrative()
                {
                    Id = Guid.NewGuid()
                }
            };

            _lesson0.LessonPlanId   = _lesson0.LessonPlan.Id;
            _lesson0.NarrativeId    = _lesson0.Narrative.Id;
            _lesson0.Narrative.Text = "Some Text";

            _lesson1 = new Lesson()
            {
                Course       = _course0,
                CourseId     = _course0.Id,
                Id           = Guid.NewGuid(),
                Narrative    = _lesson0.Narrative,
                NarrativeId  = _lesson0.NarrativeId,
                LessonPlan   = _lesson0.LessonPlan,
                LessonPlanId = _lesson0.LessonPlanId
            };

            _lessonList = new List <Lesson>()
            {
                _lesson0,
                _lesson1
            };

            _lessonUse0 = new LessonUse()
            {
                Lesson         = _lesson0,
                LessonId       = _lesson0.Id,
                Id             = Guid.NewGuid(),
                SequenceNumber = 1,
                ClassMeeting   = _classMeeting0,
                ClassMeetingId = _classMeeting0.Id
            };

            _lessonUse1 = new LessonUse()
            {
                Lesson         = _lesson1,
                LessonId       = _lesson1.Id,
                Id             = Guid.NewGuid(),
                SequenceNumber = 2,
                ClassMeeting   = _classMeeting0,
                ClassMeetingId = _classMeeting0.Id
            };

            _lessonUse2 = new LessonUse()
            {
                Lesson         = _lesson1,
                LessonId       = _lesson1.Id,
                Id             = Guid.NewGuid(),
                SequenceNumber = 3,
                ClassMeeting   = _classMeeting1,
                ClassMeetingId = _classMeeting1.Id
            };

            _lessonUseList = new List <LessonUse>()
            {
                _lessonUse0,
                _lessonUse1,
                _lessonUse2
            };

            _referenceSection0 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                Course   = _course0,
                CourseId = _course0.Id
            };

            _referenceSection1 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                Course   = _course0,
                CourseId = _course0.Id
            };

            _referenceSection2 = new ClassSection()
            {
                Id       = Guid.NewGuid(),
                Course   = _course1,
                CourseId = _course1.Id
            };

            _referenceCalendar0 = new ReferenceCalendar()
            {
                Id                      = Guid.NewGuid(),
                ClassSection            = _classSection0,
                ClassSectionId          = _classSection0.Id,
                ReferenceClassSection   = _referenceSection0,
                ReferenceClassSectionId = _referenceSection0.Id
            };

            _referenceCalendar1 = new ReferenceCalendar()
            {
                Id                      = Guid.NewGuid(),
                ClassSection            = _classSection0,
                ClassSectionId          = _classSection0.Id,
                ReferenceClassSection   = _referenceSection1,
                ReferenceClassSectionId = _referenceSection1.Id
            };

            _referenceCalendar2 = new ReferenceCalendar()
            {
                Id                      = Guid.NewGuid(),
                ClassSection            = _classSection1,
                ClassSectionId          = _classSection1.Id,
                ReferenceClassSection   = _referenceSection2,
                ReferenceClassSectionId = _referenceSection2.Id
            };

            _listReferenceCalendar = new List <ReferenceCalendar>()
            {
                _referenceCalendar0,
                _referenceCalendar1,
                _referenceCalendar2
            };

            _referenceSectionsForClassSection0 = new List <ClassSection>()
            {
                _referenceSection0,
                _referenceSection1
            };

            _classSection0.ClassMeetings.Add(_classMeeting0);
            _classSection0.ClassMeetings.Add(_classMeeting1);
            _classSection0.ClassMeetings.Add(_classMeeting2);

            _classMeeting0.LessonUses = _lessonUseList;
            _classMeeting1.LessonUses = _lessonUseList;
            _classMeeting2.LessonUses = _lessonUseList;

            _course0.LastDisplayedClassSectionId = _classSection1.Id;
            _course0.ClassSections = new HashSet <ClassSection>()
            {
                _classSection0,
                _classSection1
            };
            _course0.Lessons.Add(_lesson0);
            _course0.Lessons.Add(_lesson1);
        }
Beispiel #13
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)
                {
                }
            }
        }
Beispiel #14
0
        public List <Classlist> ReadClasslist(ClassMeeting classMeeting)
        {
            conn = DAO.getConnection();
            Classlist        readClasslist = new Classlist();
            List <Classlist> classLists    = new List <Classlist>();
            int id;

            try
            {
                conn = DAO.getConnection();
                NpgsqlTransaction tran      = conn.BeginTransaction();
                NpgsqlCommand     command   = new NpgsqlCommand(DAOClasslistResource.ReadClasslistByClassSP, conn);
                NpgsqlParameter   parameter = new NpgsqlParameter();
                parameter.ParameterName = DAOClasslistResource.Id;
                parameter.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Varchar;
                parameter.Direction     = ParameterDirection.Input;
                parameter.Value         = classMeeting.Id;
                command.Parameters.Add(parameter);
                command.CommandType = CommandType.StoredProcedure;

                NpgsqlDataReader dr = command.ExecuteReader();
                try
                {
                    while (dr.Read())
                    {
                        id = dr.GetInt32(0);
                        String   classId         = dr.GetString(1);
                        DateTime classDate       = dr.GetDateTime(2);
                        String   classLink       = dr.GetString(3);
                        String   classComment    = dr.GetString(4);
                        String   studentEmail    = dr.GetString(5);
                        String   studentName     = dr.GetString(6);
                        String   studentLastname = dr.GetString(7);
                        Student  student         = new Student();
                        student.Email          = studentEmail;
                        student.Name           = studentName;
                        student.LastName       = studentLastname;
                        classMeeting.StartTime = classDate;
                        classMeeting.JoinUrl   = classLink;
                        classMeeting.Comment   = classComment;
                        readClasslist          = new Classlist(id, classMeeting, student);
                        classLists.Add(readClasslist);
                    }
                    dr.Close();
                    tran.Commit();
                    return(classLists);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (NpgsqlException ex2)
            {
                throw ex2;
            }
            finally
            {
                conn.Close();
            }
        }
Beispiel #15
0
        public List <ClassMeeting> ReadClassByTeacherBetweenDates(DateTime initDate, DateTime endDate, Teacher teacher)
        {
            conn = DAO.getConnection();
            ClassMeeting        meeting  = new ClassMeeting();
            List <ClassMeeting> meetings = new List <ClassMeeting>();

            String   id;
            String   uuId;
            String   hostId;
            String   hostEmail;
            String   topic;
            int      type;
            String   status;
            DateTime startTime;
            int      duration;
            String   timezone;
            String   agenda;
            DateTime createdAt;
            String   startUrl;
            String   joinUrl;
            String   password;
            String   h323Password;
            String   pstnPassword;
            String   encryptedPassword;
            String   comment;
            Section  section;

            try
            {
                conn = DAO.getConnection();
                NpgsqlTransaction tran        = conn.BeginTransaction();
                NpgsqlCommand     command     = new NpgsqlCommand(DAOReportResource.ReadClassByTeacherPeriodSP, conn);
                NpgsqlParameter   parameter   = new NpgsqlParameter();
                NpgsqlParameter   parameter_2 = new NpgsqlParameter();
                NpgsqlParameter   parameter_3 = new NpgsqlParameter();

                parameter.ParameterName = DAOReportResource.IniDate;
                parameter.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Date;
                parameter.Direction     = ParameterDirection.Input;
                parameter.Value         = initDate;
                command.Parameters.Add(parameter);


                parameter_2.ParameterName = DAOReportResource.EndDate;
                parameter_2.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Date;
                parameter_2.Direction     = ParameterDirection.Input;
                parameter_2.Value         = endDate;
                command.Parameters.Add(parameter_2);


                parameter_3.ParameterName = DAOReportResource.Id;
                parameter_3.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Varchar;
                parameter_3.Direction     = ParameterDirection.Input;
                parameter_3.Value         = teacher.Email;
                command.Parameters.Add(parameter_3);

                command.CommandType = CommandType.StoredProcedure;

                NpgsqlDataReader dr = command.ExecuteReader();
                try
                {
                    while (dr.Read())
                    {
                        id                = dr.GetString(0);
                        uuId              = dr.GetString(1);
                        hostId            = dr.GetString(2);
                        hostEmail         = dr.GetString(3);
                        topic             = dr.GetString(4);
                        type              = dr.GetInt32(5);
                        status            = dr.GetString(6);
                        startTime         = dr.GetDateTime(7);
                        duration          = dr.GetInt32(8);
                        timezone          = dr.GetString(9);
                        agenda            = dr.GetString(10);
                        createdAt         = dr.GetDateTime(11);
                        startUrl          = dr.GetString(12);
                        joinUrl           = dr.GetString(13);
                        password          = dr.GetString(14);
                        h323Password      = dr.GetString(15);
                        pstnPassword      = dr.GetString(16);
                        encryptedPassword = dr.GetString(17);
                        comment           = dr.GetString(18);
                        int    sectionId       = dr.GetInt32(19);
                        String sectionName     = dr.GetString(20);
                        String teacherId       = dr.GetString(21);
                        String teacherName     = dr.GetString(22);
                        String teacherLastname = dr.GetString(23);
                        section          = new Section();
                        teacher          = new Teacher();
                        section.Id       = sectionId;
                        section.Name     = sectionName;
                        teacher.Email    = teacherId;
                        teacher.Name     = teacherName;
                        teacher.LastName = teacherLastname;
                        meeting          = new ClassMeeting(id, uuId, hostId, hostEmail, topic, type, status, startTime, duration, timezone, agenda, createdAt, startUrl, joinUrl, password, h323Password, pstnPassword, encryptedPassword, comment, section, teacher);
                        meetings.Add(meeting);
                    }
                    dr.Close();
                    tran.Commit();
                    return(meetings);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (NpgsqlException ex2)
            {
                throw ex2;
            }
            finally
            {
                conn.Close();
            }
            throw new NotImplementedException();
        }
Beispiel #16
0
        public List <Teacher> CalculateTeacherSalaryBetweenDates(DateTime initDate, DateTime endDate)
        {
            conn = DAO.getConnection();
            ClassMeeting   meeting  = new ClassMeeting();
            int            salary   = -1;
            Teacher        teacher  = new Teacher();
            List <Teacher> teachers = new List <Teacher>();

            String   id;
            String   uuId;
            String   hostId;
            String   hostEmail;
            String   topic;
            int      type;
            String   status;
            DateTime startTime;
            int      duration;
            String   timezone;
            String   agenda;
            DateTime createdAt;
            String   startUrl;
            String   joinUrl;
            String   password;
            String   h323Password;
            String   pstnPassword;
            String   encryptedPassword;
            String   comment;
            Section  section;

            try
            {
                conn = DAO.getConnection();
                NpgsqlTransaction tran        = conn.BeginTransaction();
                NpgsqlCommand     command     = new NpgsqlCommand(DAOReportResource.TotalHoursTeacher, conn);
                NpgsqlParameter   parameter   = new NpgsqlParameter();
                NpgsqlParameter   parameter_2 = new NpgsqlParameter();
                NpgsqlParameter   parameter_3 = new NpgsqlParameter();

                parameter.ParameterName = DAOReportResource.IniDate;
                parameter.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Date;
                parameter.Direction     = ParameterDirection.Input;
                parameter.Value         = initDate;
                command.Parameters.Add(parameter);


                parameter_2.ParameterName = DAOReportResource.EndDate;
                parameter_2.NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Date;
                parameter_2.Direction     = ParameterDirection.Input;
                parameter_2.Value         = endDate;
                command.Parameters.Add(parameter_2);

                command.CommandType = CommandType.StoredProcedure;

                NpgsqlDataReader dr = command.ExecuteReader();
                try
                {
                    while (dr.Read())
                    {
                        teacher          = new Teacher();
                        teacher.Salary   = dr.GetInt32(0);
                        teacher.Email    = dr.GetString(1);
                        teacher.Name     = dr.GetString(2);
                        teacher.LastName = dr.GetString(3);
                        teachers.Add(teacher);
                    }
                    dr.Close();
                    tran.Commit();
                    return(teachers);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (NpgsqlException ex2)
            {
                throw ex2;
            }
            finally
            {
                conn.Close();
            }
            throw new NotImplementedException();
        }
Beispiel #17
0
        public int UpdateClassMeeting(ClassMeeting classMeeting)
        {
            conn = DAO.getConnection();
            NpgsqlCommand     command     = new NpgsqlCommand(DAOClassMeetingResource.UpdateClassSP, conn);
            NpgsqlTransaction transaction = conn.BeginTransaction();

            NpgsqlParameter id                = new NpgsqlParameter();
            NpgsqlParameter uuId              = new NpgsqlParameter();
            NpgsqlParameter hostId            = new NpgsqlParameter();
            NpgsqlParameter hostEmail         = new NpgsqlParameter();
            NpgsqlParameter topic             = new NpgsqlParameter();
            NpgsqlParameter type              = new NpgsqlParameter();
            NpgsqlParameter status            = new NpgsqlParameter();
            NpgsqlParameter startTime         = new NpgsqlParameter();
            NpgsqlParameter duration          = new NpgsqlParameter();
            NpgsqlParameter timezone          = new NpgsqlParameter();
            NpgsqlParameter agenda            = new NpgsqlParameter();
            NpgsqlParameter createdAt         = new NpgsqlParameter();
            NpgsqlParameter startUrl          = new NpgsqlParameter();
            NpgsqlParameter joinUrl           = new NpgsqlParameter();
            NpgsqlParameter password          = new NpgsqlParameter();
            NpgsqlParameter h323Password      = new NpgsqlParameter();
            NpgsqlParameter pstnPassword      = new NpgsqlParameter();
            NpgsqlParameter encryptedPassword = new NpgsqlParameter();
            NpgsqlParameter comment           = new NpgsqlParameter();
            NpgsqlParameter section           = new NpgsqlParameter();
            NpgsqlParameter teacher           = new NpgsqlParameter();

            id.ParameterName                = DAOClassMeetingResource.Id;
            uuId.ParameterName              = DAOClassMeetingResource.uuId;
            hostId.ParameterName            = DAOClassMeetingResource.IdHost;
            hostEmail.ParameterName         = DAOClassMeetingResource.EmailHost;
            topic.ParameterName             = DAOClassMeetingResource.Topic;
            type.ParameterName              = DAOClassMeetingResource.Type;
            status.ParameterName            = DAOClassMeetingResource.Status;
            startTime.ParameterName         = DAOClassMeetingResource.StartTime;
            duration.ParameterName          = DAOClassMeetingResource.Duration;
            timezone.ParameterName          = DAOClassMeetingResource.Timezone;
            agenda.ParameterName            = DAOClassMeetingResource.Agenda;
            createdAt.ParameterName         = DAOClassMeetingResource.CreationDate;
            startUrl.ParameterName          = DAOClassMeetingResource.StartLink;
            joinUrl.ParameterName           = DAOClassMeetingResource.ReunionLink;
            password.ParameterName          = DAOClassMeetingResource.Password;
            h323Password.ParameterName      = DAOClassMeetingResource.PasswordH323;
            pstnPassword.ParameterName      = DAOClassMeetingResource.PasswordPSTN;
            encryptedPassword.ParameterName = DAOClassMeetingResource.PasswordEncrypted;
            comment.ParameterName           = DAOClassMeetingResource.Comment;
            section.ParameterName           = DAOClassMeetingResource.Section;
            teacher.ParameterName           = DAOClassMeetingResource.Teacher;

            id.NpgsqlDbType                = NpgsqlTypes.NpgsqlDbType.Varchar;
            uuId.NpgsqlDbType              = NpgsqlTypes.NpgsqlDbType.Varchar;
            hostId.NpgsqlDbType            = NpgsqlTypes.NpgsqlDbType.Varchar;
            hostEmail.NpgsqlDbType         = NpgsqlTypes.NpgsqlDbType.Varchar;
            topic.NpgsqlDbType             = NpgsqlTypes.NpgsqlDbType.Varchar;
            type.NpgsqlDbType              = NpgsqlTypes.NpgsqlDbType.Integer;
            status.NpgsqlDbType            = NpgsqlTypes.NpgsqlDbType.Varchar;
            startTime.NpgsqlDbType         = NpgsqlTypes.NpgsqlDbType.Date;
            duration.NpgsqlDbType          = NpgsqlTypes.NpgsqlDbType.Integer;
            timezone.NpgsqlDbType          = NpgsqlTypes.NpgsqlDbType.Varchar;
            agenda.NpgsqlDbType            = NpgsqlTypes.NpgsqlDbType.Varchar;
            createdAt.NpgsqlDbType         = NpgsqlTypes.NpgsqlDbType.Date;
            startUrl.NpgsqlDbType          = NpgsqlTypes.NpgsqlDbType.Varchar;
            joinUrl.NpgsqlDbType           = NpgsqlTypes.NpgsqlDbType.Varchar;
            password.NpgsqlDbType          = NpgsqlTypes.NpgsqlDbType.Varchar;
            h323Password.NpgsqlDbType      = NpgsqlTypes.NpgsqlDbType.Varchar;
            pstnPassword.NpgsqlDbType      = NpgsqlTypes.NpgsqlDbType.Varchar;
            encryptedPassword.NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Varchar;
            comment.NpgsqlDbType           = NpgsqlTypes.NpgsqlDbType.Varchar;
            section.NpgsqlDbType           = NpgsqlTypes.NpgsqlDbType.Integer;
            teacher.NpgsqlDbType           = NpgsqlTypes.NpgsqlDbType.Varchar;

            id.Direction                = ParameterDirection.Input;
            uuId.Direction              = ParameterDirection.Input;
            hostId.Direction            = ParameterDirection.Input;
            hostEmail.Direction         = ParameterDirection.Input;
            topic.Direction             = ParameterDirection.Input;
            type.Direction              = ParameterDirection.Input;
            status.Direction            = ParameterDirection.Input;
            startTime.Direction         = ParameterDirection.Input;
            duration.Direction          = ParameterDirection.Input;
            timezone.Direction          = ParameterDirection.Input;
            agenda.Direction            = ParameterDirection.Input;
            createdAt.Direction         = ParameterDirection.Input;
            startUrl.Direction          = ParameterDirection.Input;
            joinUrl.Direction           = ParameterDirection.Input;
            password.Direction          = ParameterDirection.Input;
            h323Password.Direction      = ParameterDirection.Input;
            pstnPassword.Direction      = ParameterDirection.Input;
            encryptedPassword.Direction = ParameterDirection.Input;
            comment.Direction           = ParameterDirection.Input;
            section.Direction           = ParameterDirection.Input;
            teacher.Direction           = ParameterDirection.Input;

            id.Value                = classMeeting.Id;
            uuId.Value              = classMeeting.UuId;
            hostId.Value            = classMeeting.HostId;
            hostEmail.Value         = classMeeting.HostEmail;
            topic.Value             = classMeeting.Topic;
            type.Value              = classMeeting.Type;
            status.Value            = classMeeting.Status;
            startTime.Value         = classMeeting.StartTime;
            duration.Value          = classMeeting.Duration;
            timezone.Value          = classMeeting.Timezone;
            agenda.Value            = classMeeting.Agenda;
            createdAt.Value         = classMeeting.CreatedAt;
            startUrl.Value          = classMeeting.StartUrl;
            joinUrl.Value           = classMeeting.JoinUrl;
            password.Value          = classMeeting.Password;
            h323Password.Value      = classMeeting.H323Password;
            pstnPassword.Value      = classMeeting.PstnPassword;
            encryptedPassword.Value = classMeeting.EncryptedPassword;
            comment.Value           = classMeeting.Comment;
            section.Value           = classMeeting.Section.Id;
            teacher.Value           = classMeeting.Teacher.Email;

            command.Parameters.Add(id);
            command.Parameters.Add(uuId);
            command.Parameters.Add(hostId);
            command.Parameters.Add(hostEmail);
            command.Parameters.Add(topic);
            command.Parameters.Add(type);
            command.Parameters.Add(status);
            command.Parameters.Add(startTime);
            command.Parameters.Add(duration);
            command.Parameters.Add(timezone);
            command.Parameters.Add(agenda);
            command.Parameters.Add(createdAt);
            command.Parameters.Add(startUrl);
            command.Parameters.Add(joinUrl);
            command.Parameters.Add(password);
            command.Parameters.Add(h323Password);
            command.Parameters.Add(pstnPassword);
            command.Parameters.Add(encryptedPassword);
            command.Parameters.Add(comment);
            command.Parameters.Add(section);
            command.Parameters.Add(teacher);

            command.CommandType = CommandType.StoredProcedure;

            int response = 500;

            NpgsqlDataReader dr = command.ExecuteReader();


            try
            {
                while (dr.Read())
                {
                    response = dr.GetInt32(0);
                }

                dr.Close();
                transaction.Commit();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(response);
        }