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 void UpdateAdminUserRoleAssignments(AdminUserRoleCollection roles) { using (SqlDataReaderWrapper dataReaderWrapper = new SqlDataReaderWrapper(this.Registry.ConnectionStringDefault)) { dataReaderWrapper.ProcedureName = "AdminUser_UpdateAdminUserRolesByXmlGuidList"; dataReaderWrapper.AddGuid("AdminUserId", this.Id); dataReaderWrapper.AddNVarChar("AdminUserRoleXmlGuidList", roles.ToXmlGuidList()); dataReaderWrapper.ExecuteNonQuery(); } }
public override SqlTransaction Save(SqlConnection connection, SqlTransaction transaction) { transaction = base.Save(connection, transaction); if (this.IsObjectDirty) { transaction = this.EnsureDatabasePrepared(connection, transaction); using (SqlDataReaderWrapper dataReaderWrapper = new SqlDataReaderWrapper(connection, false)) { if (this.IsObjectCreated) { dataReaderWrapper.ProcedureName = "AdminUser_Create"; this.CreatedDateTimeUTC = DateTime.UtcNow; this.UpdatedDateTimeUTC = this.CreatedDateTimeUTC; } else { dataReaderWrapper.ProcedureName = "AdminUser_Save"; } dataReaderWrapper.AddGuid("AdminUserId", this.Id); dataReaderWrapper.AddNVarChar("FirstName", this.FirstName); dataReaderWrapper.AddNVarChar("LastName", this.LastName); dataReaderWrapper.AddNVarChar("EmailAddress", this.EmailAddress); dataReaderWrapper.AddNVarChar("PhoneNumber", InnovaFormatting.CleanPhoneNumber(this.PhoneNumber)); dataReaderWrapper.AddNVarChar("Password", this.Password); dataReaderWrapper.AddNVarChar("Address1", this.Address1); dataReaderWrapper.AddNVarChar("Address2", this.Address2); dataReaderWrapper.AddNVarChar("City", this.City); dataReaderWrapper.AddNVarChar("State", this.State); dataReaderWrapper.AddNVarChar("PostalCode", this.PostalCode); dataReaderWrapper.AddNVarChar("ShippingAddress1", this.ShippingAddress1); dataReaderWrapper.AddNVarChar("ShippingAddress2", this.ShippingAddress2); dataReaderWrapper.AddNVarChar("ShippingCity", this.ShippingCity); dataReaderWrapper.AddNVarChar("ShippingState", this.ShippingState); dataReaderWrapper.AddNVarChar("ShippingPostalCode", this.ShippingPostalCode); dataReaderWrapper.AddNVarChar("AreasOfExpertise", this.AreasOfExpertise); dataReaderWrapper.AddInt32("AdminUserType", (int)this.AdminUserType); dataReaderWrapper.AddBoolean("IsSystemAdministrator", this.IsSystemAdministrator); dataReaderWrapper.AddBoolean("IsReceivesPastDueNoFixNotifications", this.IsReceivesPastDueNoFixNotifications); dataReaderWrapper.AddInt32("Market", (int)this.Market); dataReaderWrapper.AddNVarChar("Permissions", this.Permissions); dataReaderWrapper.AddDecimal("ValidationPayRateDollarsPerHour", this.ValidationPayRateDollarsPerHour); dataReaderWrapper.AddBoolean("IsActive", this.IsActive); dataReaderWrapper.AddBoolean("IsDeleted", this.IsDeleted); dataReaderWrapper.AddDateTime("UpdatedDateTimeUTC", this.UpdatedDateTimeUTC); dataReaderWrapper.AddDateTime("CreatedDateTimeUTC", this.CreatedDateTimeUTC); dataReaderWrapper.AddDateTime("LastLoginDateTimeUTC", this.LastLoginDateTimeUTC); dataReaderWrapper.AddBusinessObject("PropertyDefinitionDataSetId", (BusinessObjectBase)this.PropertyDefinitionDataSet); dataReaderWrapper.AddBoolean("EnablePropertyDefinitionEditingOnForms", this.EnablePropertyDefinitionEditingOnForms); dataReaderWrapper.Execute(transaction); } this.IsObjectDirty = false; } transaction = this.SaveCollections(connection, transaction); return(transaction); }
public new void LoadPropertiesFromDataReader(SqlDataReaderWrapper dr, bool isSetBase) { if (isSetBase) { base.LoadPropertiesFromDataReader(dr, isSetBase); } if (!this.IsObjectLoaded) { this.SetPropertiesFromDataReader(dr); } this.IsObjectLoaded = true; }
public override SqlTransaction Delete(SqlConnection connection, SqlTransaction transaction) { this.EnsureValidId(); transaction = this.EnsureDatabasePrepared(connection, transaction); using (SqlDataReaderWrapper dataReaderWrapper = new SqlDataReaderWrapper(connection, false)) { dataReaderWrapper.ProcedureName = "AdminUser_Delete"; dataReaderWrapper.AddGuid("AdminUserId", this.Id); dataReaderWrapper.ExecuteNonQuery(transaction); } transaction = base.Delete(connection, transaction); 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)); } } } }
internal SqlSpatialDataReader(DbSpatialServices spatialServices, SqlDataReaderWrapper underlyingReader) { _spatialServices = spatialServices; _reader = underlyingReader; var fieldCount = _reader.FieldCount; _geographyColumns = new bool[fieldCount]; _geometryColumns = new bool[fieldCount]; for (var i = 0; i < _reader.FieldCount; i++) { var fieldTypeName = _reader.GetDataTypeName(i); // Use EndsWith so that we just see the schema and type name, not the database name. if (fieldTypeName.EndsWith(GeographySqlType, StringComparison.Ordinal)) { _geographyColumns[i] = true; } else if (fieldTypeName.EndsWith(GeometrySqlType, StringComparison.Ordinal)) { _geometryColumns[i] = true; } } }
internal SqlSpatialDataReader(DbSpatialServices spatialServices, SqlDataReaderWrapper underlyingReader) { _spatialServices = spatialServices; _reader = underlyingReader; var fieldCount = _reader.FieldCount; _geographyColumns = new bool[fieldCount]; _geometryColumns = new bool[fieldCount]; for (var i = 0; i < _reader.FieldCount; i++) { var fieldTypeName = _reader.GetDataTypeName(i); // Use EndsWith so that we just see the schema and type name, not the database name. if (fieldTypeName.EndsWith(GeographySqlType, StringComparison.Ordinal)) { _geographyColumns[i] = true; } else if (fieldTypeName.EndsWith(GeometrySqlType, StringComparison.Ordinal)) { _geometryColumns[i] = true; } } }
internal SqlSpatialDataReader( DbSpatialServices spatialServices, SqlDataReaderWrapper underlyingReader) { this._spatialServices = spatialServices; this._reader = underlyingReader; int fieldCount = this._reader.FieldCount; this._geographyColumns = new bool[fieldCount]; this._geometryColumns = new bool[fieldCount]; for (int i = 0; i < this._reader.FieldCount; ++i) { string dataTypeName = this._reader.GetDataTypeName(i); if (dataTypeName.EndsWith("sys.geography", StringComparison.Ordinal)) { this._geographyColumns[i] = true; } else if (dataTypeName.EndsWith("sys.geometry", StringComparison.Ordinal)) { this._geometryColumns[i] = true; } } }
protected new void SetPropertiesFromDataReader(SqlDataReaderWrapper dr) { this.firstName = dr.GetString("FirstName"); this.lastName = dr.GetString("LastName"); this.emailAddress = dr.GetString("EmailAddress"); this.phoneNumber = dr.GetString("PhoneNumber"); this.password = dr.GetString("Password"); this.address1 = dr.GetString("Address1"); this.address2 = dr.GetString("Address2"); this.city = dr.GetString("City"); this.state = dr.GetString("State"); this.postalCode = dr.GetString("PostalCode"); this.shippingAddress1 = dr.GetString("ShippingAddress1"); this.shippingAddress2 = dr.GetString("ShippingAddress2"); this.shippingCity = dr.GetString("ShippingCity"); this.shippingState = dr.GetString("ShippingState"); this.shippingPostalCode = dr.GetString("ShippingPostalCode"); this.areasOfExpertise = dr.GetString("AreasOfExpertise"); this.adminUserType = (AdminUserType)dr.GetInt32("AdminUserType"); this.isSystemAdministrator = dr.GetBoolean("IsSystemAdministrator"); this.isReceivesPastDueNoFixNotifications = dr.GetBoolean("IsReceivesPastDueNoFixNotifications"); this.market = (Market)dr.GetInt32("Market"); this.permissions = dr.GetString("Permissions"); this.validationPayRateDollarsPerHour = dr.GetNullableDecimal("ValidationPayRateDollarsPerHour"); this.isActive = dr.GetBoolean("IsActive"); this.isDeleted = dr.GetBoolean("IsDeleted"); this.updatedDateTimeUTC = dr.GetDateTime("UpdatedDateTimeUTC"); this.createdDateTimeUTC = dr.GetDateTime("CreatedDateTimeUTC"); this.lastLoginDateTimeUTC = dr.GetNullableDateTime("LastLoginDateTimeUTC"); this.propertyDefinitionDataSet = (PropertyDefinitionDataSet)dr.GetBusinessObjectBase(this.Registry, typeof(PropertyDefinitionDataSet), "PropertyDefinitionDataSetId"); this.enablePropertyDefinitionEditingOnForms = dr.GetBoolean("EnablePropertyDefinitionEditingOnForms"); if (!dr.IsDBNull("ValidationTestResultsTotalMinutesToComplete")) { this.validationTestResultsTotalMinutesToComplete = dr.GetInt32("ValidationTestResultsTotalMinutesToComplete"); } this.IsObjectLoaded = true; }
internal SqlSpatialDataReader(DbSpatialServices spatialServices, SqlDataReaderWrapper underlyingReader) { _spatialServices = spatialServices; _reader = underlyingReader; }
protected new void SetLoadProcedureCall(SqlDataReaderWrapper dr) { dr.ProcedureName = "AdminUser_Load"; dr.AddGuid("AdminUserId", this.Id); }
internal SqlSpatialDataReader(DbSpatialServices spatialServices, SqlDataReaderWrapper underlyingReader) { _spatialServices = spatialServices; _reader = underlyingReader; }