public static EODStatus GetStatus(string catalog, int officeId) { const string sql = "SELECT transactions.get_value_date(@OfficeId::integer) AS value_date, transactions.is_eod_initialized(@OfficeId::integer, transactions.get_value_date(@OfficeId::integer)::date) AS eod_initialized;"; using (NpgsqlCommand command = new NpgsqlCommand(sql)) { command.Parameters.AddWithValue("@OfficeId", officeId); using (DataTable table = DbOperation.GetDataTable(catalog, command)) { if (table.Rows != null && table.Rows.Count.Equals(1)) { EODStatus status = new EODStatus(); status.ValueDate = Conversion.TryCastDate(table.Rows[0]["value_date"]); status.IsInitialized = Conversion.TryCastBoolean(table.Rows[0]["eod_initialized"]); return status; } } } return null; }
public static EODStatus GetStatus(int officeId) { const string sql = "SELECT transactions.get_value_date(@OfficeId) AS value_date, transactions.is_eod_initialized(@OfficeId, transactions.get_value_date(@OfficeId)) AS eod_initialized;"; using (NpgsqlCommand command = new NpgsqlCommand(sql)) { command.Parameters.AddWithValue("@OfficeId", officeId); using (DataTable table = DbOperation.GetDataTable(command)) { if (table.Rows != null && table.Rows.Count.Equals(1)) { EODStatus status = new EODStatus(); status.ValueDate = Conversion.TryCastDate(table.Rows[0]["value_date"]); status.Initialized = Conversion.TryCastBoolean(table.Rows[0]["eod_initialized"]); return(status); } } } return(null); }
private void InitializeEODStatus() { this.officeId = AppUsers.GetCurrentLogin().View.OfficeId.ToInt(); status = Data.EODOperation.GetStatus(AppUsers.GetCurrentUserDB(), officeId); }