/// <summary> /// Displayfields provide a minimal name/value context for data binding the row collection of transactions.non_gl_stock_tax_details. /// </summary> /// <returns>Returns an enumerable name and value collection for the table transactions.non_gl_stock_tax_details</returns> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public IEnumerable<DisplayField> GetDisplayFields() { List<DisplayField> displayFields = new List<DisplayField>(); if(string.IsNullOrWhiteSpace(this.Catalog)) { return displayFields; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Read, this.LoginId, false); } if (!this.HasAccess) { Log.Information("Access to get display field for entity \"NonGlStockTaxDetail\" was denied to the user with Login ID {LoginId}", this.LoginId); throw new UnauthorizedException("Access is denied."); } } const string sql = "SELECT non_gl_stock_tax_detail_id AS key, non_gl_stock_tax_detail_id as value FROM transactions.non_gl_stock_tax_details;"; using (NpgsqlCommand command = new NpgsqlCommand(sql)) { using (DataTable table = DbOperation.GetDataTable(this.Catalog, command)) { if (table?.Rows == null || table.Rows.Count == 0) { return displayFields; } foreach (DataRow row in table.Rows) { if (row != null) { DisplayField displayField = new DisplayField { Key = row["key"].ToString(), Value = row["value"].ToString() }; displayFields.Add(displayField); } } } } return displayFields; }
/// <summary> /// Displayfields provide a minimal name/value context for data binding the row collection of core.compound_unit_scrud_view. /// </summary> /// <returns>Returns an enumerable name and value collection for the view core.compound_unit_scrud_view</returns> /// <exception cref="UnauthorizedException">Thown when the application user does not have sufficient privilege to perform this action.</exception> public IEnumerable<DisplayField> GetDisplayFields() { List<DisplayField> displayFields = new List<DisplayField>(); if (string.IsNullOrWhiteSpace(this._Catalog)) { return displayFields; } if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Read, this._LoginId, this._Catalog, false); } if (!this.HasAccess) { Log.Information("Access to get display field for entity \"CompoundUnitScrudView\" was denied to the user with Login ID {LoginId}", this._LoginId); throw new UnauthorizedException("Access is denied."); } } const string sql = "SELECT compound_unit_id AS key, base_unit_name as value FROM core.compound_unit_scrud_view;"; using (NpgsqlCommand command = new NpgsqlCommand(sql)) { using (DataTable table = DbOperation.GetDataTable(this._Catalog, command)) { if (table?.Rows == null || table.Rows.Count == 0) { return displayFields; } foreach (DataRow row in table.Rows) { if (row != null) { DisplayField displayField = new DisplayField { Key = row["key"].ToString(), Value = row["value"].ToString() }; displayFields.Add(displayField); } } } } return displayFields; }
/// <summary> /// Displayfields provide a minimal name/value context for data binding the row collection of office.cash_repositories. /// </summary> /// <returns>Returns an enumerable name and value collection for the table office.cash_repositories</returns> public IEnumerable<DisplayField> GetDisplayFields() { List<DisplayField> displayFields = new List<DisplayField>(); if(string.IsNullOrWhiteSpace(this.Catalog)) { return displayFields; } try { if (!this.SkipValidation) { if (!this.Validated) { this.Validate(AccessTypeEnum.Read, this.LoginId, false); } if (!this.HasAccess) { throw new UnauthorizedException("Access is denied."); } } const string sql = "SELECT cash_repository_id AS key, cash_repository_id as value FROM office.cash_repositories;"; using (NpgsqlCommand command = new NpgsqlCommand(sql)) { using (DataTable table = DbOperation.GetDataTable(this.Catalog, command)) { if (table?.Rows == null || table.Rows.Count == 0) { return displayFields; } foreach (DataRow row in table.Rows) { if (row != null) { DisplayField displayField = new DisplayField { Key = row["key"].ToString(), Value = row["value"].ToString() }; displayFields.Add(displayField); } } } } return displayFields; } catch (UnauthorizedException ex) { Log.Error("{Exception} {@Exception}", ex.Message, ex); throw new MixERPException(ex.Message, ex); } }