public object GetAttendanceList(clsGetAttendanceList attendance) { dynamic TBAttendanceListResult; List <object> AttendanceListResult = new List <object>(); try { List <AttendanceList> Result = Attendance.getAttendanceList(attendance); for (int i = 0; i < Result.Count; i++) { AttendanceListResult.Add(new { AttendanceResult = Result[i] }); } if (AttendanceListResult != null) { TBAttendanceListResult = new { status = "0", message = "success", AttendanceListResult }; } else { TBAttendanceListResult = new { status = "0", message = "Record not found" }; } } catch { TBAttendanceListResult = new { status = "1", message = "failed" }; } return(new { TBAttendanceListResult }); }
public static List <AttendanceList> getAttendanceList(clsGetAttendanceList attendance) { try { MySqlParameter[] param = new MySqlParameter[4]; param[0] = new MySqlParameter("?p_groupProfileID", attendance.groupProfileID); param[1] = new MySqlParameter("?p_attendanceMonth", attendance.month); param[2] = new MySqlParameter("?p_attendanceYear", attendance.year); param[3] = new MySqlParameter("?p_moduleId", attendance.moduleID); var Result = _DbTouchbase.ExecuteStoreQuery <AttendanceList>("CALL USPGetAttendanceList(?p_groupProfileID,?p_attendanceMonth,?p_attendanceYear,?p_moduleId)", param).ToList(); return(Result); } catch (Exception ex) { throw ex; } }
//private static TouchBaseWebAPI.Data.row_productionEntities _DbTouchbase = new TouchBaseWebAPI.Data.row_productionEntities(); public static List <AttendanceList> getAttendanceList(clsGetAttendanceList attendance) { try { MySqlParameter[] param = new MySqlParameter[4]; param[0] = new MySqlParameter("?p_groupProfileID", attendance.groupProfileID); param[1] = new MySqlParameter("?p_attendanceMonth", attendance.month); param[2] = new MySqlParameter("?p_attendanceYear", attendance.year); param[3] = new MySqlParameter("?p_moduleId", attendance.moduleID); using (TouchBaseWebAPI.Data.row_productionEntities context = new TouchBaseWebAPI.Data.row_productionEntities()) { context.Connection.Open(); var Result = context.ExecuteStoreQuery <AttendanceList>("CALL USPGetAttendanceList(?p_groupProfileID,?p_attendanceMonth,?p_attendanceYear,?p_moduleId)", param).ToList(); return(Result); } } catch (Exception ex) { throw ex; } }