public int insertAttendanceRecord(DsPSMS.ST_ATTENDANCE_DATARow adr) { if (adr == null) { return(-1); } string query = "INSERT INTO ST_ATTENDANCE_DATA ("; string data = ""; int result; query += "STUDENT_ID "; data += "" + adr.STUDENT_ID; query += ", EDU_YEAR"; data += ",'" + adr.EDU_YEAR + "'"; query += ", MORNING"; data += ",'" + adr.MORNING + "'"; query += ", EVENING"; data += ",'" + adr.EVENING + "'"; query += ", ATTENDANCE_DATE"; data += ",'" + adr.ATTENDANCE_DATE.ToString() + "'"; if (!adr.IsREMARKNull()) { query += ", REMARK"; data += "," + adr.REMARK; } if (!adr.IsCRT_DT_TMNull()) { query += ", CRT_DT_TM"; data += "," + adr.CRT_DT_TM; } if (!adr.IsCRT_USER_IDNull()) { query += ", CRT_USER_ID"; data += "," + adr.CRT_USER_ID; } if (!adr.IsUPD_DT_TMNull()) { query += ", UPD_DT_TM"; data += "," + adr.UPD_DT_TM; } if (!adr.IsUPD_USER_IDNull()) { query += ", UPD_USER_ID"; data += "," + adr.UPD_USER_ID; } query += ", DEL_FLG"; data += "," + 0; query += ") VALUES(" + data + ");"; SqlCommand cmd = new SqlCommand(query, conn); result = cmd.ExecuteNonQuery(); return(result); }
public DsPSMS.ATTENDANCE_RESULTDataTable selectAttendanceData(DsPSMS.ST_STUDENT_DATARow sr, DsPSMS.ST_ATTENDANCE_DATARow dr) { if (dr == null) { return(null); } string query = "SELECT ST_STUDENT_DATA.STUDENT_ID, ST_STUDENT_DATA.STUDENT_NAME, ST_STUDENT_DATA.ROLL_NO, ST_ATTENDANCE_DATA.MORNING, ST_ATTENDANCE_DATA.EVENING, ST_ATTENDANCE_DATA.ATTENDANCE_DATE FROM ST_STUDENT_DATA INNER JOIN ST_ATTENDANCE_DATA ON ST_STUDENT_DATA.STUDENT_ID = ST_ATTENDANCE_DATA.STUDENT_ID WHERE (ST_STUDENT_DATA.GRADE_ID = '" + sr.GRADE_ID + "' AND ST_STUDENT_DATA.ROOM_ID= '" + sr.ROOM_ID + "' AND ST_ATTENDANCE_DATA.ATTENDANCE_DATE = '" + dr.ATTENDANCE_DATE + "');"; SqlCommand cmd = new SqlCommand(query, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DsPSMS.ATTENDANCE_RESULTDataTable st = new DsPSMS.ATTENDANCE_RESULTDataTable(); da.Fill(st); return(st); }