public ValueObject.Column SelectByColumneName(string databaseName, string tableName, string columnName) { ValueObject.Column column = null; System.Data.DataRow row = null; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(ConnectionString); row = mySql.GetDataRow(StoredProcedures.Column_Select_ByColumnName.ToString(), "@DatabaseName", databaseName, "@TableName", tableName, "@ColumnName", columnName); if (row != null) column = Fill(row); } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading column.", ex); } finally { if (mySql != null) mySql.Dispose(); } return column; }
public bool ByUserEventId(long userEventID) { DataRow row = null; bool success = false; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(ConnectionString); row = mySql.GetDataRow(StoredProcedures.UserEvents_Select_ByUserEventId.ToString(), "_UserEventID", userEventID); if (row != null) success = row.TryParse<UserEvent>(this) && UserEventId > 0; } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading user event.", ex); } finally { if (mySql != null) mySql.Dispose(); } return success; }
public bool ByAssetCode(string assetCode) { bool success = false; DataRow row = null; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(ConnectionString); row = mySql.GetDataRow(StoredProcedures.Assets_Select_ByAssetCode.ToString(), "_AssetCode", assetCode); if (row != null) success = row.TryParse<Asset>(this) && AssetId > 0; } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading asset.", ex); } finally { if (mySql != null) mySql.Dispose(); } return success; }
public bool ByRoleId(int roleId) { bool success = false; DataRow row = null; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(ConnectionString); row = mySql.GetDataRow(StoredProcedures.Roles_Select_ByRoleId.ToString(), "_RoleId", roleId); if (row != null) success = row.TryParse<Role>(this) && RoleId > 0; } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading role.", ex); } finally { if (mySql != null) mySql.Dispose(); } return success; }
public bool ByEmailAddress(string emailAddress) { bool success = false; DataRow row = null; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(ConnectionString); row = mySql.GetDataRow(StoredProcedures.Users_Select_ByEmailAddress.ToString(), "_EmailAddress", emailAddress); if (row != null) success = row.TryParse<User>(this) && UserId > 0; } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading user.", ex); } finally { if (mySql != null) mySql.Dispose(); } return success; }
public static User Authenticate(string emailAddress, string password) { DataRow row = null; User user = null; DataLayer.MySQL mySql = null; try { mySql = new DataLayer.MySQL(DatConnectionString); row = mySql.GetDataRow(StoredProcedures.Users_Authenticate.ToString(), "_EmailAddress", emailAddress, "_Password", password); if (row == null) return user; user = new User(); if (!row.TryParse<User>(user) || user.UserId < 1) user = null; } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading user.", ex); } finally { if (mySql != null) mySql.Dispose(); } return user; }
public Boolean Load(long postalcode_id) { Boolean success = false; DataLayer.MySQL mySQL = null; DataRow row = null; try { mySQL = new DataLayer.MySQL(ConnectionString); row = mySQL.GetDataRow(DataLayer.StoredProcedures.postal_codes_std_get_id, "@_id_postal_code", postalcode_id); if (row != null) success = Load(row); } catch (Exception ex) { throw new Exceptions.BusinessLogicException("Error loading postal code.", ex); } finally { if (mySQL != null) mySQL.Dispose(); } return success; }