/// <summary>
        /// Clones a parameter so that it can be used with another command.
        /// </summary>
        /// <param name="command">The command to use.</param>
        /// <param name="parameter">The parameter to clone.</param>
        /// <returns>The clone.</returns>
        public override IDataParameter CloneParameter(IDbCommand command, IDataParameter parameter)
        {
            // thank you, oracle
            OracleParameter p = (OracleParameter)parameter;

            return((IDataParameter)p.Clone());
        }
        private void GetRetakeAndAdjustment()
        {
            try
            {
                using (OracleConnection connection = new OracleConnection(OracleDataBaseConnection.data))
                {
                    connection.Open();
                    OracleParameter userId = new OracleParameter
                    {
                        ParameterName = "in_user_id",
                        Direction     = ParameterDirection.Input,
                        OracleDbType  = OracleDbType.Int64,
                        Value         = _student.UserId
                    };
                    LoadRetakesAndAdjustmentFromTables("select subject, status, TO_CHAR(adjustment_date, 'DD.MM.YYYY') adjustment_date, TO_CHAR(access_date, 'DD.MM.YYYY') access_date from adjustments where user_id = :in_user_id",
                                                       connection, userId, m_AdjustmentTextBlock, m_AdjustmentSeparator, dg_Adjustments);

                    LoadRetakesAndAdjustmentFromTables("select subject, status, TO_CHAR(retake_date, 'DD.MM.YYYY') retake_date from retakes where user_id = :in_user_id",
                                                       connection, userId.Clone() as OracleParameter, m_RetakeTextBlock, m_RetakeSeparator, dg_Retakes);
                    connection.Close();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                throw;
            }
        }
Ejemplo n.º 3
0
        private void InitializeComboBox()
        {
            string message =
                "Data could not be retrieved. You or students may have entered your personal information incorrectly";

            try
            {
                OracleParameter faculty = new OracleParameter
                {
                    ParameterName = "in_faculty",
                    Direction     = ParameterDirection.Input,
                    OracleDbType  = OracleDbType.Varchar2,
                    Value         = _teacher.Faculty
                };
                using (OracleConnection connection = new OracleConnection(OracleDataBaseConnection.data))
                {
                    connection.Open();
                    GetInfoFromTables("select subject from subjects where faculty = :in_faculty", "subject", s_subjectsComboBox, connection, new[] { faculty }, "Error when reading subjects");
                    GetInfoFromTables("select student_name || ' ' || course || '-' || num_group student " +
                                      "from student_info where faculty = :in_faculty", "student", s_studentsComboBox, connection, new[] { faculty.Clone() as OracleParameter }, message);
                    connection.Close();
                }

                foreach (var note in ue.notes)
                {
                    s_noteComboBox.Items.Add(note);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                throw;
            }
        }
Ejemplo n.º 4
0
        private void InitializeComboBox()
        {
            try
            {
                using (OracleConnection connection = new OracleConnection(OracleDataBaseConnection.data))
                {
                    OracleParameter faculty = new OracleParameter
                    {
                        ParameterName = "in_faculty",
                        Direction     = ParameterDirection.Input,
                        OracleDbType  = OracleDbType.Varchar2,
                        Value         = _student.Faculty
                    };
                    connection.Open();
                    GetInfoFromTables("select subject from subjects where faculty = :in_faculty", "subject", a_subjectComboBox, connection, faculty);
                    GetInfoFromTables("select teacher_name from teacher_info where faculty = :in_faculty", "teacher_name", a_teacherComboBox, connection, faculty.Clone() as OracleParameter);
                    connection.Close();
                }

                a_teacherComboBox.SelectedIndex = 0;
                a_subjectComboBox.SelectedIndex = 0;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 5
0
        private void InitializeComboBox()
        {
            string message =
                "Data could not be retrieved. You or students may have entered your personal information incorrectly";

            try
            {
                OracleParameter faculty = new OracleParameter
                {
                    ParameterName = "in_faculty",
                    Direction     = ParameterDirection.Input,
                    OracleDbType  = OracleDbType.Varchar2,
                    Value         = _student.Faculty
                };
                OracleParameter specialization = new OracleParameter
                {
                    ParameterName = "in_specialization",
                    Direction     = ParameterDirection.Input,
                    OracleDbType  = OracleDbType.Varchar2,
                    Value         = _student.Specialization
                };
                OracleParameter numGroup = new OracleParameter
                {
                    ParameterName = "in_num_group",
                    Direction     = ParameterDirection.Input,
                    OracleDbType  = OracleDbType.Int64,
                    Value         = _student.Group
                };
                OracleParameter course = new OracleParameter
                {
                    ParameterName = "in_course",
                    Direction     = ParameterDirection.Input,
                    OracleDbType  = OracleDbType.Int64,
                    Value         = _student.Course
                };
                using (OracleConnection connection = new OracleConnection(OracleDataBaseConnection.data))
                {
                    connection.Open();
                    GetInfoFromTables("select subject from subjects where faculty = :in_faculty", "subject", p_subjectsComboBox, connection, new OracleParameter[] { faculty }, "Error when reading subjects");
                    GetInfoFromTables("select student_name from student_info where faculty = :in_faculty and specialization = :in_specialization and num_group = :in_num_group and course = :in_course", "student_name", p_studentsComboBox, connection, new [] { faculty.Clone() as OracleParameter, specialization, numGroup, course }, message);
                    connection.Close();
                }// specialization = :in_specialization and and num_group = :in_num_group "and course = :in_course

                foreach (var t in _university.countOfGaps)
                {
                    p_gapsComboBox.Items.Add(t);
                }

                p_studentsComboBox.SelectedIndex = 0;
                p_subjectsComboBox.SelectedIndex = 0;
                p_gapsComboBox.SelectedIndex     = 0;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                this.Close();
            }
        }