Beispiel #1
0
        public int DelmngineeringTimeTable(TimeTable t)
        {
            try
            {
                sql             = "DELETE from ol_time_table WHERE no=@no";
                cmd.CommandText = sql;
                cmd.Parameters.AddWithValue("no", t.No);

                con.Open();
                return(cmd.ExecuteNonQuery());
            }
            catch (Exception) { throw; }
            finally
            {
                //test
                con.Close();
            }
        }
Beispiel #2
0
        public TimeTable SearchComputingTable(string no)
        {
            string sql = "SELECT * FROM grade_six_to_nine_time_table WHERE no=@no";

            try
            {
                cmd.CommandText = sql;
                cmd.Parameters.AddWithValue("no", no);
                con.Open();

                SqlDataReader reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    TimeTable t = new TimeTable();
                    while (reader.Read())
                    {
                        t.No                = reader[0].ToString();
                        t.Grade             = reader[1].ToString();
                        t.Class             = reader[2].ToString();
                        t.Subject           = reader[3].ToString();
                        t.Teacher           = reader[4].ToString();
                        t.Date              = reader[5].ToString();
                        t.Time              = reader[6].ToString();
                        t.Class_Room_Lab    = reader[7].ToString();
                        t.Class_Room_Lab_ID = reader[8].ToString();
                    }

                    return(t);
                }
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
            finally
            {
                con.Close();
            }
        }
Beispiel #3
0
 public int AddManagementTimeTable(TimeTable t)
 {
     try
     {
         sql             = "INSERT INTO ol_time_table (grade,class,subject,teacher,[date],[time],class_room_lab,class_room_lab_id) VALUES (@grade,@class,@subject,@teacher,@da,@time,@class_room_lab,@class_room_lab_id)";
         cmd.CommandText = sql;
         cmd.Parameters.AddWithValue("grade", t.Grade);
         cmd.Parameters.AddWithValue("class", t.Class);
         cmd.Parameters.AddWithValue("subject", t.Subject);
         cmd.Parameters.AddWithValue("teacher", t.Teacher);
         cmd.Parameters.AddWithValue("da", t.Date);
         cmd.Parameters.AddWithValue("time", t.Time);
         cmd.Parameters.AddWithValue("class_room_lab", t.Class_Room_Lab);
         cmd.Parameters.AddWithValue("class_room_lab_id", t.Class_Room_Lab_ID);
         con.Open();
         return(cmd.ExecuteNonQuery());
     }
     catch (Exception) { throw; }
     finally
     {
         //test
         con.Close();
     }
 }