Esempio n. 1
0
        public TCourse getCourse(string course_id)
        {
            //--Data Base Access Variables--
            System.Data.OleDb.OleDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString);
            System.Data.OleDb.OleDbCommand    dbCommand    = new OleDbCommand();
            dbCommand.Connection = dbConnection;
            System.Data.OleDb.OleDbDataReader dbDataReader;
            //------------------------------

            dbCommand.CommandText = "SELECT * FROM Courses INNER JOIN User_Course_Group ON Courses.id = User_Course_Group.course_id WHERE (id = '" + course_id + "')";
            dbConnection.Close();
            dbConnection.Open();
            dbDataReader = dbCommand.ExecuteReader();
            TCourse tCourseAux;

            dbDataReader.Read();
            TUser responsableTeacher = null;

            if (dbDataReader["responsable_teacher"] != null)
            {
                responsableTeacher = getUser(dbDataReader["responsable_teacher"].ToString());
            }
            else
            {
                responsableTeacher = null;
            }
            tCourseAux = new TCourse(dbDataReader["id"].ToString(), dbDataReader["course_name"].ToString(), dbDataReader["group_id"].ToString(), responsableTeacher);

            dbDataReader.Close();
            dbConnection.Close();
            return(tCourseAux);
        }
Esempio n. 2
0
        public List <TCourse> getCourses(string user_id, bool current)
        {
            //--Data Base Access Variables--
            System.Data.OleDb.OleDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString);
            System.Data.OleDb.OleDbCommand    dbCommand    = new OleDbCommand();
            dbCommand.Connection = dbConnection;
            System.Data.OleDb.OleDbDataReader dbDataReader;
            //------------------------------

            dbCommand.CommandText = "SELECT id, course_name, group_id, user_id, is_current, responsable_teacher FROM Courses INNER JOIN User_Course_Group ON (Courses.id = User_Course_Group.course_id) WHERE (user_id = '" + user_id + "') AND (is_current = " + current + ")";
            dbConnection.Close();
            dbConnection.Open();
            dbDataReader = dbCommand.ExecuteReader();
            List <TCourse> tCourseList = new List <TCourse>();
            TCourse        tCourseAux;

            while (dbDataReader.Read())
            {
                TUser responsableTeacher = null;
                if (dbDataReader["responsable_teacher"] != null)
                {
                    responsableTeacher = getUser(dbDataReader["responsable_teacher"].ToString());
                }
                else
                {
                    responsableTeacher = null;
                }
                tCourseAux = new TCourse(dbDataReader["id"].ToString(), dbDataReader["course_name"].ToString(), dbDataReader["group_id"].ToString(), responsableTeacher);
                tCourseList.Add(tCourseAux);
            }
            dbDataReader.Close();
            dbConnection.Close();
            return(tCourseList);
        }
Esempio n. 3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            course = new TCourse(1, "Първи");
            MessageBox.Show("За първи курс няма свободно избираеми дисциплини");
            return;

            OpenSubjects();
        }
 private void FormAddCourse_Load(object sender, EventArgs e)
 {
     if (course == null)
     {
         course = new TCourse();
     }
     bsCourse.DataSource = course;
 }
 private void CBoxEvaluationCourse_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cBoxEvaluationCourse.SelectedItem != null)
     {
         TCourse s = cBoxEvaluationCourse.SelectedItem as TCourse;
         if (s == null)
         {
             return;
         }
         this.courseID = s.ID;
         Filter();
     }
 }
Esempio n. 6
0
 private void cBoxFormElectiveSubjects_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cBoxFormElectiveSubjects.SelectedItem != null)
     {
         TCourse c = cBoxFormElectiveSubjects.SelectedItem as TCourse;
         if (c == null)
         {
             return;
         }
         this.courseID = c.ID;
         Filter();
     }
 }
Esempio n. 7
0
        public void LoadCourse()
        {
            string error = string.Empty;

            this.Courses = TCourse.LoadData(out error);

            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show("Грешка при зареждане от базата данни");
                return;
            }

            bsCourse.DataSource = Courses;
        }
        public void LoadCourse()
        {
            List <TCourse> courses = new List <TCourse>();
            string         error   = string.Empty;

            courses = TCourse.LoadData(out error);

            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show("Грешка при зареждане на курс");
                return;
            }
            cBoxElectiveSubjectCourse.DisplayMember = "NameCourse";
            cBoxElectiveSubjectCourse.ValueMember   = "ID";
            cBoxElectiveSubjectCourse.DataSource    = courses;
        }
        public void LoadCourses()
        {
            string         err    = string.Empty;
            List <TCourse> course = new List <TCourse>();

            course = TCourse.LoadData(out err);

            cbCourse.DisplayMember = "NameCourse";
            cbCourse.ValueMember   = "ID";
            cbCourse.DataSource    = course;

            if (student != null && student.CourseID > 0)
            {
                cbCourse.SelectedValue = student.CourseID;
            }
        }
Esempio n. 10
0
        public TTopic createTopic(TUser tUserStarter, TCourse tCourse, string title)
        {
            //--Data Base Access Variables--
            System.Data.OleDb.OleDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString);
            System.Data.OleDb.OleDbCommand    dbCommand    = new OleDbCommand();
            dbCommand.Connection = dbConnection;
            System.Data.OleDb.OleDbDataReader  dbDataReader;
            System.Data.OleDb.OleDbTransaction dbTransaction;
            //-----------------------------

            dbConnection.Close();
            dbConnection.Open();
            dbTransaction         = dbConnection.BeginTransaction();
            dbCommand.Transaction = dbTransaction;
            TTopic tTopic = new TTopic(tCourse, title);

            try
            {
                //Begin Transaction
                tTopic.startDateTime  = DateTime.Now;
                tTopic.starterTeacher = tUserStarter;
                dbCommand.CommandText = "INSERT INTO Topics (course_id, group_id, title, startDateTime, starterTeacher) VALUES('" + tTopic.tCourse.id + "', '" + tTopic.tCourse.groupId + "', '" + tTopic.title + "', '" + tTopic.startDateTime.ToString() + "', '" + tUserStarter.id + "')";
                dbCommand.ExecuteNonQuery();
                dbCommand.CommandText = "SELECT * FROM Topics WHERE (course_id = '" + tTopic.tCourse.id + "') AND (group_id = '" + tTopic.tCourse.groupId + "') AND (title = '" + tTopic.title + "') AND (startDateTime = '" + tTopic.startDateTime.ToString() + "')";
                dbDataReader          = dbCommand.ExecuteReader();
                dbDataReader.Read();
                tTopic.id = Convert.ToInt32(dbDataReader["id"]);
                dbDataReader.Close();
                dbTransaction.Commit();
                //End Transaction
            }
            catch
            {
                dbTransaction.Rollback();
                dbCommand.Transaction = null;
                dbTransaction         = null;
                dbConnection.Close();
                return(null);
            }

            dbCommand.Transaction = null;
            dbTransaction         = null;
            dbDataReader.Close();
            dbConnection.Close();
            return(tTopic);
        }
Esempio n. 11
0
        protected void btnJustStartTopic_Click(object sender, EventArgs e)
        {
            List <TCourse> listTCourse = (List <TCourse>)Session["currentCourses"];
            TCourse        tCourse     = null;
            string         tCourseId   = lbCurrentCourses.SelectedValue;

            for (int count = 0; count < listTCourse.Count; count++)
            {
                tCourse = listTCourse[count];
                if (tCourse.id == tCourseId)
                {
                    break;
                }
            }

            TUser tUser = (TUser)Session["user"];
            //Insert in DATABASE
            TTopic tTopic = DbControl.getInstance().createTopic(tUser, tCourse, tbTopicTitle.Text);

            addContentToLbStartedTopics(tUser.id);
            btnCancelTopic_Click(sender, e);
        }
        public void LoadCourse()
        {
            List <TCourse> courses = new List <TCourse>();
            string         error   = string.Empty;

            courses = TCourse.LoadData(out error);

            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show("Грешка при зареждане на курс");
                return;
            }

            TCourse course = new TCourse();

            course.NameCourse = "Всички";
            course.ID         = -1;

            courses.Insert(0, course);
            cBoxEvaluationCourse.DisplayMember = "NameCourse";
            cBoxEvaluationCourse.ValueMember   = "ID";
            cBoxEvaluationCourse.DataSource    = courses;
        }
Esempio n. 13
0
        protected void btnStartAndEnterTopic_Click(object sender, EventArgs e)
        {
            List <TCourse> listTCourse = (List <TCourse>)Session["currentCourses"];
            TCourse        tCourse     = null;
            string         tCourseId   = lbCurrentCourses.SelectedValue;

            for (int count = 0; count < listTCourse.Count; count++)
            {
                tCourse = listTCourse[count];
                if (tCourse.id == tCourseId)
                {
                    break;
                }
            }

            TUser tUser = (TUser)Session["user"];
            //Insert in DATABASE
            TTopic tTopic = DbControl.getInstance().createTopic(tUser, tCourse, tbTopicTitle.Text);

            Application["updateAvaiable_" + tTopic.id.ToString()] = 0;
            Session["updateAvaiable"] = 0;
            DbControl.getInstance().enterTopic(tUser, tTopic);
            Response.Redirect("topic.aspx");
        }
Esempio n. 14
0
 private void Button4_Click(object sender, EventArgs e)
 {
     course = new TCourse(3, "Трети");
     OpenSubjects();
 }
Esempio n. 15
0
 public FormCourceAdd(TCourse c)
 {
     InitializeComponent();
     course = c;
 }
Esempio n. 16
0
 private void Button2_Click(object sender, EventArgs e)
 {
     course = new TCourse(2, "Втори");
     OpenSubjects();
 }
Esempio n. 17
0
 private void Button3_Click(object sender, EventArgs e)
 {
     course = new TCourse(4, "Четвърти");
     OpenSubjects();
 }