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


C# QueryBuilder.AddWhere方法代码示例

本文整理汇总了C#中QueryBuilder.AddWhere方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.AddWhere方法的具体用法?C# QueryBuilder.AddWhere怎么用?C# QueryBuilder.AddWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder.AddWhere方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public static RangePriceGroup Load(Guid Id)
        {
            bool success = false;
            RangePriceGroup result = new RangePriceGroup ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "validfromtimestamp",
                "validtotimestamp",
                "name",
                "rangepriceids"
                );

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._validfromtimestamp = query.GetInt (qb.ColumnPos ("validfromtimestamp"));
                    result._validtotimestamp  = query.GetInt (qb.ColumnPos ("validtotimestamp"));
                    result._name = query.GetString (qb.ColumnPos ("name"));
                    result._rangepriceidsasstring = query.GetString (qb.ColumnPos ("rangepricegroupids"));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.RangePriceGroupLoad, Id));
            }

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:48,代码来源:RangePriceGroup.cs

示例2: Save

        public void Save()
        {
            bool success = false;
            QueryBuilder qb = null;

            if (!Helpers.GuidExists (Runtime.DBConnection, DatabaseTableName, this._id))
            {
                qb = new QueryBuilder (QueryBuilderType.Insert);
            }
            else
            {
                qb = new QueryBuilder (QueryBuilderType.Update);
                qb.AddWhere ("id", "=", this._id);
            }

            this._updatetimestamp = Toolbox.Date.CurrentDateTimeToTimestamp ();

            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "validfromtimestamp",
                "validtotimestamp",
                "name",
                "rangepriceids"
                );

            qb.Values (
                this._id,
                this._createtimestamp,
                this._updatetimestamp,
                this._validfromtimestamp,
                this._validtotimestamp,
                this._name,
                this._rangepriceidsasstring
                );

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.AffectedRows > 0)
            {
                success = true;
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.RangePriceGroupSave, this._id));
            }
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:54,代码来源:RangePriceGroup.cs

示例3: Delete

        public static void Delete(Guid Id)
        {
            bool success = false;

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Delete);
            qb.Table (DatabaseTableName);

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.AffectedRows > 0)
            {
                success = true;
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.RangePriceGroupDelete, Id));
            }
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:25,代码来源:RangePriceGroup.cs

示例4: List

        public static List<RangePriceGroup> List(Range Range)
        {
            List<RangePriceGroup> result = new List<RangePriceGroup> ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns ("id");
            qb.AddWhere ("rangeid", "=", Range.Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);
            if (query.Success)
            {
                while (query.NextRow ())
                {
                    try
                    {
                        result.Add (Load (query.GetGuid (qb.ColumnPos ("id"))));
                    }
                    catch
                    {}
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:29,代码来源:RangePriceGroup.cs

示例5: Load

        public static Usage Load(Guid Id)
        {
            bool success = false;
            Usage result = new Usage ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "subscriptionid",
                "begintimestamp",
                "duration",
                "anumber",
                "bnumber",
                "direction"
                );

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._subscriptionid = query.GetGuid (qb.ColumnPos ("subscriptionid"));
                    result._begintimestamp = query.GetInt (qb.ColumnPos ("begintimestamp"));
                    result._duration = query.GetInt (qb.ColumnPos ("duration"));
                    result._anumber = query.GetString (qb.ColumnPos ("anumber"));
                    result._bnumber = query.GetString (qb.ColumnPos ("anumber"));
                    result._direction = query.GetEnum<Enums.UsageDirection> (qb.ColumnPos ("direction"));
                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.UsageLoad, Id));
            }

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:51,代码来源:Usage.cs

示例6: Save

        public void Save()
        {
            bool success = false;
            QueryBuilder qb = null;

            if (!Helpers.GuidExists (Runtime.DBConnection, DatabaseTableName, this._id))
            {
                qb = new QueryBuilder (QueryBuilderType.Insert);
            }
            else
            {
                qb = new QueryBuilder (QueryBuilderType.Update);
                qb.AddWhere ("id", "=", this._id);
            }

            this._updatetimestamp = Toolbox.Date.CurrentDateTimeToTimestamp ();

            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "subscriptionid",
                "begintimestamp",
                "duration",
                "anumber",
                "bnumber",
                "direction"
                );

            qb.Values (
                this._id,
                this._createtimestamp,
                this._updatetimestamp,
                this._subscriptionid,
                this._begintimestamp,
                this._duration,
                this._anumber,
                this._bnumber,
                this._direction
                );

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.AffectedRows > 0)
            {
                success = true;
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.UsageSave, this._id));
            }
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:58,代码来源:Usage.cs

示例7: OnLanguageChange

        private void OnLanguageChange()
        {
            //DictionariesCollection = new ObservableCollection<Dictionary>(Subtitles.PrimaryLanguage.DictionariesCollection.Where(x=>x.SecondaryLanguage == Subtitles.SecondaryLanguage));
            //string sql = 
            //    "SELECT * FROM " + Dictionary.TableName + 
            //    " WHERE SecondaryLanguage_id = " + Subtitles.SecondaryLanguage_id.Hex+
            //    " AND id in (SELECT Dictionary_id FROM "+Subtitles.TableName+")";
            //List<Dictionary> lst = EFDbConnect.Main.Query<Dictionary>(sql);
            //DictionariesCollection = new ObservableCollection<Dictionary>(lst);

            var qb = new QueryBuilder<Dictionary>(EFDbContext.Context);
            qb.AddWhere($"{nameof(Dictionary.SecondaryLanguage_id)} = {Subtitles.SecondaryLanguage_id.Hex} AND id IN (SELECT {nameof(Subtitles.Dictionary_id)} FROM {Subtitles.TableName})");
            List<Dictionary> lst = EFDbContext.Context.Query(qb);
            DictionariesCollection = new ObservableCollection<Dictionary>(lst);
        }
开发者ID:vlkam,项目名称:OpenLearningPlayer,代码行数:15,代码来源:SubtitleEditor_ViewModel_WPF.cs

示例8: Load

        public static CountryCode Load(Guid Id)
        {
            bool success = false;
            CountryCode result = new CountryCode ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "name",
                "alternativnames",
                "dialcodes"
                );

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._name = query.GetString (qb.ColumnPos ("name"));
                    result._alternativnamesasstring = query.GetString (qb.ColumnPos ("alternativnames"));
                    result._dialcodesasstring = query.GetString (qb.ColumnPos ("dialcodes"));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.CountryCodeLoad, Id));
            }

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:46,代码来源:CountryCode.cs

示例9: Load

        public static RangePrice Load(Guid Id)
        {
            bool success = false;
            RangePrice result = new RangePrice ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns (
                "id",
                "createtimestamp",
                "updatetimestamp",
                "price",
                "hourspanbegin",
                "hourspanend",
                "weekdays"
                );

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));
                    result._price = query.GetDecimal (qb.ColumnPos ("price"));
                    result._hourspanbegin = query.GetString (qb.ColumnPos ("hourspanbegin"));
                    result._hourspanend = query.GetString (qb.ColumnPos ("hourspanend"));
                    result._weekdays = query.GetEnum<Enums.Weekday> (qb.ColumnPos ("weekdays"));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.RangePriceLoad, Id));
            }

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:48,代码来源:RangePrice.cs

示例10: Delete

        /// <summary>
        /// Delete a <see cref="CDRLib.Customer"/> instance from database using a <see cref="System.Guid"/> identifier.
        /// </summary>
        public static void Delete(Guid Id)
        {
            bool success = false;

            foreach (Subscription subscription in Customer.Load (Id).Subscriptions)
            {
                Subscription.Delete (subscription.Id);
            }

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Delete);
            qb.Table (DatabaseTableName);

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.AffectedRows > 0)
            {
                success = true;
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.CustomerDelete, Id));
            }
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:33,代码来源:Customer.cs

示例11: Load

        /// <summary>
        /// Load a <see cref="CDRLib.Subscription"/> instance from database using a <see cref="System.Guid"/> identifier.
        /// </summary>
        public static Subscription Load(Guid Id)
        {
            bool success = false;
            Subscription result = new Subscription ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns ("id",
                        "createtimestamp",
                        "updatetimestamp");

            qb.AddWhere ("id", "=", Id);

            Query query = Runtime.DBConnection.Query (qb.QueryString);

            if (query.Success)
            {
                if (query.NextRow ())
                {
                    result._id = query.GetGuid (qb.ColumnPos ("id"));
                    result._createtimestamp = query.GetInt (qb.ColumnPos ("createtimestamp"));
                    result._updatetimestamp = query.GetInt (qb.ColumnPos ("updatetimestamp"));

                    success = true;
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            if (!success)
            {
                throw new Exception (string.Format (Strings.Exception.SubscriptionLoad, Id));
            }

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:41,代码来源:Subscription.cs

示例12: List

        /// <summary>
        /// Returns a list of all <see cref="CDRLib.SIPAccount"/> instances in the database, belonging to a <see cref="CDRLib.Subscription"/> instance.
        /// </summary>			
        internal static List<SIPAccount> List(Subscription Subscription)
        {
            List<SIPAccount> result = new List<SIPAccount> ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns ("id");

            if (Subscription != null)
            {
                qb.AddWhere ("subscriptionid", "=",  Subscription.Id);
            }

            Query query = Runtime.DBConnection.Query (qb.QueryString);
            if (query.Success)
            {
                while (query.NextRow ())
                {
                    try
                    {
                        result.Add (Load (query.GetGuid (qb.ColumnPos ("id"))));
                    }
                    catch
                    {}
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:36,代码来源:SIPAccount.cs

示例13: FindByNumber

        public static SIPAccount FindByNumber(string Number)
        {
            SIPAccount result = null;

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns ("id");
            qb.AddWhere ("numbers", "like",  "%"+ Number +";%");

            Query query = Runtime.DBConnection.Query (qb.QueryString);
            if (query.Success)
            {
                while (query.NextRow ())
                {
                    try
                    {
            //						result = Load (query.GetGuid (qb.ColumnPos ("id")));
                    }
                    catch
                    {}
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            return result;
        }
开发者ID:sundowndk,项目名称:CDRLib,代码行数:29,代码来源:SIPAccount.cs


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