public static List <DiagnosticReportOBDFixAdminUserStatistics> GetOBDFixStats(Registry registry, AdminUserCollection users, DateTime?startDateTimeUTC, DateTime?endDateTimeUTC) { List <DiagnosticReportOBDFixAdminUserStatistics> adminUserStatisticsList = new List <DiagnosticReportOBDFixAdminUserStatistics>(); foreach (AdminUser user in (CollectionBase)users) { using (SqlDataReaderWrapper dataReaderWrapper = new SqlDataReaderWrapper(registry.ConnectionStringDefault)) { dataReaderWrapper.ProcedureName = "DiagnosticReportFixFeedback_GetAdminUserStats"; dataReaderWrapper.AddGuid("AdminUserId", user.Id); if (startDateTimeUTC.HasValue) { dataReaderWrapper.AddDateTime("StartDateTimeUTC", startDateTimeUTC.Value); } if (endDateTimeUTC.HasValue) { dataReaderWrapper.AddDateTime("EndDateTimeUTC", endDateTimeUTC.Value); } dataReaderWrapper.Execute(); if (dataReaderWrapper.Read()) { DiagnosticReportOBDFixAdminUserStatistics adminUserStatistics = new DiagnosticReportOBDFixAdminUserStatistics(user, dataReaderWrapper.GetInt32("ReportsClosedNewFixAdded"), dataReaderWrapper.GetInt32("ReportsClosedExistingFixSelected"), dataReaderWrapper.GetInt32("ReportsClosedRejected"), dataReaderWrapper.GetInt32("NumOfFixesFromFixReport"), dataReaderWrapper.GetInt32("NumOfDirectFixes")); adminUserStatisticsList.Add(adminUserStatistics); } } } return(adminUserStatisticsList); }
public new SqlTransaction Load(SqlConnection connection, SqlTransaction transaction, bool isLoadBase) { this.EnsureValidId(); if (isLoadBase) { transaction = base.Load(connection, transaction, isLoadBase); } if (!this.IsObjectLoaded) { SqlDataReaderWrapper dr = connection != null ? new SqlDataReaderWrapper(connection, false) : new SqlDataReaderWrapper(this.ConnectionString); using (dr) { this.SetLoadProcedureCall(dr); if (transaction == null) { dr.Execute(); } else { dr.Execute(transaction); } if (!dr.Read()) { throw new ApplicationException("Load Failed for type " + this.GetType().ToString() + " using Procedure: " + dr.ProcedureCall); } this.LoadPropertiesFromDataReader(dr, isLoadBase); } } return(transaction); }
public static AdminUser GetUserByEmailAddress(Registry registry, string emailAddress) { AdminUser adminUser = (AdminUser)null; using (SqlDataReaderWrapper dr = new SqlDataReaderWrapper(registry.ConnectionStringDefault)) { dr.ProcedureName = "AdminUser_LoadByEmailAddress"; dr.AddNVarChar("EmailAddress", emailAddress); dr.Execute(); if (dr.Read()) { adminUser = (AdminUser)registry.CreateInstance(typeof(AdminUser), dr.GetGuid("AdminUserId")); adminUser.SetPropertiesFromDataReader(dr); } } return(adminUser); }
public static void SetValidationTestResultPaymentAmounts(AdminUserCollection usersToUpdate, NullableDateTime submittedStartDateUTC, NullableDateTime submittedEndDateUTC) { using (SqlDataReaderWrapper dataReaderWrapper = new SqlDataReaderWrapper(usersToUpdate.Registry.ConnectionStringDefault)) { dataReaderWrapper.ProcedureName = "AdminUser_GetValidationTestResultPaymentAmounts"; dataReaderWrapper.AddNVarChar("AdminUserXmlGuidList", usersToUpdate.ToXmlGuidList()); dataReaderWrapper.AddDateTime("SubmittedStartDateUTC", submittedStartDateUTC); dataReaderWrapper.AddDateTime("SubmittedEndDateUTC", submittedEndDateUTC); dataReaderWrapper.Execute(); while (dataReaderWrapper.Read()) { AdminUser byProperty = (AdminUser)usersToUpdate.FindByProperty("Id", (object)dataReaderWrapper.GetGuid("AdminUserId")); if (byProperty != null) { byProperty.ValidationTestResultsTotalMinutesToComplete = dataReaderWrapper.GetInt32("ValidationTestResultsTotalMinutesToComplete"); byProperty.ValidationTestResultsPaymentAmount = byProperty.ValidationPayRateDollarsPerHour * (NullableDecimal)((Decimal)byProperty.ValidationTestResultsTotalMinutesToComplete / new Decimal(60)); } } } }