Esempio n. 1
0
        public ScheduleForm()
        {
            prefers          = new timeTable();
            schedule         = new timeTable();
            dictSchedule     = new Dictionary <int, Dictionary <int, ScheduleEvent> >();
            user_scheudle_id = 0;

            InitializeComponent();
        }
Esempio n. 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);
            }
        }