Example #1
0
        private void ScheduleForm_Load(object sender, EventArgs e)
        {
            // load users
            UsersLoad();


            // init scheduling view
            userPrefers.DocumentText  = prefers.fill();  // user prefers
            scheduleView.DocumentText = schedule.fill(); // user schedule
            prefers_color             = "yellow";
            schedule_color            = "green";
        }
Example #2
0
        public async void ScheduleLoad(int uID)
        {
            try
            {
                timeTable scheduleObj = new timeTable();
                webBrowser1.DocumentText = scheduleObj.clearTable();

                DBA db = DBA.Instance;
                db.connect();
                var con = db.getConnection();
                con.Open();

                string query = "SELECT  * FROM schedule WHERE id IN(SELECT l_id FROM studentSchedule WHERE user_id = " + uID + " )";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    using (SqlDataReader r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            int    cID   = r.GetInt32(2);
                            string day   = r.GetString(4);
                            string title = r.GetString(3) + " " + r.GetString(8);
                            string start = r.GetInt32(5).ToString() + ":00";
                            string end   = r.GetInt32(6).ToString() + ":00";

                            scheduleObj.buildEvent(day, title, start, end, "lightgreen");
                        }
                    }
                }

                await Task.Delay(1000);

                webBrowser1.DocumentText = scheduleObj.fill();
            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }