Ejemplo n.º 1
0
 public bool UpdateAttendance(AttendanceModel iList)
 {
     using (SqlConnection con = new SqlConnection(constring))
     {
         string query = "Update Attendance set ClassID =" + iList.Classes.ClassID + ", StudentID =" + iList.Students.StudentID + ",AttendanceDateTime = '" + iList.AttendanceDateTime + "' where AttendanceID = " + iList.AttendanceID;
         using (SqlCommand cmd = new SqlCommand(query, con))
         {
             con.Open();
             int i = cmd.ExecuteNonQuery();
             if (i >= 1)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public bool InsertAttendance(AttendanceModel iList)
 {
     using (SqlConnection con = new SqlConnection(constring))
     {
         string query = "Insert Into Attendance(ClassID,StudentID,AttendanceDateTime) values(" + iList.Classes.ClassID + "," + iList.Students.StudentID + ",'" + iList.AttendanceDateTime + "')";
         using (SqlCommand cmd = new SqlCommand(query, con))
         {
             con.Open();
             int i = cmd.ExecuteNonQuery();
             if (i >= 1)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
 }