/// <summary> /// to get service log by id /// </summary> public TRN_SERVICE_TB GetServiceLog(int serviceLogID) { using (Entities dbServiceLog = new Entities()) { TRN_SERVICE_TB log = dbServiceLog.TRN_SERVICE_TB .Where(u => u.N_SERVICE_SYSID == serviceLogID) .Distinct() .FirstOrDefault(); return(log); } }
/// <summary> /// to get service log by service date and worker principal name /// </summary> public TRN_SERVICE_TB GetServiceLog(DateTime serviceDate, string workerName) { using (Entities dbServiceLog = new Entities()) { string test = dbServiceLog.Database.Connection.ConnectionString; TRN_SERVICE_TB log = dbServiceLog.TRN_SERVICE_TB .Where(u => u.DT_SERVICE.Year == serviceDate.Year && u.DT_SERVICE.Month == serviceDate.Month && u.DT_SERVICE.Day == serviceDate.Day && u.SZ_USER_NAME == workerName) .Distinct() .FirstOrDefault(); return(log); } }