当前位置: 首页>>代码示例>>C#>>正文


C# PetaPoco.DisplayField类代码示例

本文整理汇总了C#中PetaPoco.DisplayField的典型用法代码示例。如果您正苦于以下问题:C# DisplayField类的具体用法?C# DisplayField怎么用?C# DisplayField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DisplayField类属于PetaPoco命名空间,在下文中一共展示了DisplayField类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDisplayFields

        /// <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;
        }
开发者ID:MarsShaw,项目名称:mixerp,代码行数:55,代码来源:NonGlStockTaxDetail.cs

示例2: GetDisplayFields

        /// <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;
        }
开发者ID:abinabrahamanchery,项目名称:mixerp,代码行数:55,代码来源:CompoundUnitScrudView.cs

示例3: GetDisplayFields

        /// <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);
            }
        }
开发者ID:mohamedmahir,项目名称:mixerp,代码行数:61,代码来源:CashRepository.cs


注:本文中的PetaPoco.DisplayField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。