Exemplo n.º 1
0
        public SqlExpression <From> Filter <From>(IRequest request, ISqlExpression expr, IQuery model)
        {
            if (QueryFilters == null)
            {
                return((SqlExpression <From>)expr);
            }

            QueryFilterDelegate filterFn = null;

            if (!QueryFilters.TryGetValue(model.GetType(), out filterFn))
            {
                foreach (var type in model.GetType().GetInterfaces())
                {
                    if (QueryFilters.TryGetValue(type, out filterFn))
                    {
                        break;
                    }
                }
            }

            if (filterFn != null)
            {
                return((SqlExpression <From>)(filterFn(request, expr, model) ?? expr));
            }

            return((SqlExpression <From>)expr);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of ColdRoomTemperatures_ArchiveProperty</returns>
        public static QueryFilters <ColdRoomTemperatures_ArchiveProperty> GetChanges(ColdRoomTemperatures_Archive original, ColdRoomTemperatures_Archive changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <ColdRoomTemperatures_ArchiveProperty>(6);

            #region Detect Changes
            if (original.ColdRoomTemperatureID != changed.ColdRoomTemperatureID)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.ColdRoomTemperatureID, FilterConditions.Equals, changed.ColdRoomTemperatureID));
            }
            if (original.ColdRoomSensorNumber != changed.ColdRoomSensorNumber)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.ColdRoomSensorNumber, FilterConditions.Equals, changed.ColdRoomSensorNumber));
            }
            if (original.RecordedWhen != changed.RecordedWhen)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.RecordedWhen, FilterConditions.Equals, changed.RecordedWhen));
            }
            if (original.Temperature != changed.Temperature)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.Temperature, FilterConditions.Equals, changed.Temperature));
            }
            if (original.ValidFrom != changed.ValidFrom)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.ValidFrom, FilterConditions.Equals, changed.ValidFrom));
            }
            if (original.ValidTo != changed.ValidTo)
            {
                changes.Add(QueryFilter.New(ColdRoomTemperatures_ArchiveProperty.ValidTo, FilterConditions.Equals, changed.ValidTo));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of StockItemStockGroupProperty</returns>
        public static QueryFilters <StockItemStockGroupProperty> GetChanges(StockItemStockGroup original, StockItemStockGroup changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <StockItemStockGroupProperty>(5);

            #region Detect Changes
            if (original.StockItemStockGroupID != changed.StockItemStockGroupID)
            {
                changes.Add(QueryFilter.New(StockItemStockGroupProperty.StockItemStockGroupID, FilterConditions.Equals, changed.StockItemStockGroupID));
            }
            if (original.StockItemID != changed.StockItemID)
            {
                changes.Add(QueryFilter.New(StockItemStockGroupProperty.StockItemID, FilterConditions.Equals, changed.StockItemID));
            }
            if (original.StockGroupID != changed.StockGroupID)
            {
                changes.Add(QueryFilter.New(StockItemStockGroupProperty.StockGroupID, FilterConditions.Equals, changed.StockGroupID));
            }
            if (original.LastEditedBy != changed.LastEditedBy)
            {
                changes.Add(QueryFilter.New(StockItemStockGroupProperty.LastEditedBy, FilterConditions.Equals, changed.LastEditedBy));
            }
            if (original.LastEditedWhen != changed.LastEditedWhen)
            {
                changes.Add(QueryFilter.New(StockItemStockGroupProperty.LastEditedWhen, FilterConditions.Equals, changed.LastEditedWhen));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of ColorProperty</returns>
        public static QueryFilters <ColorProperty> GetChanges(Color original, Color changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <ColorProperty>(5);

            #region Detect Changes
            if (original.ColorID != changed.ColorID)
            {
                changes.Add(QueryFilter.New(ColorProperty.ColorID, FilterConditions.Equals, changed.ColorID));
            }
            if (string.CompareOrdinal(original.ColorName, changed.ColorName) != 0)
            {
                changes.Add(QueryFilter.New(ColorProperty.ColorName, FilterConditions.Equals, changed.ColorName));
            }
            if (original.LastEditedBy != changed.LastEditedBy)
            {
                changes.Add(QueryFilter.New(ColorProperty.LastEditedBy, FilterConditions.Equals, changed.LastEditedBy));
            }
            if (original.ValidFrom != changed.ValidFrom)
            {
                changes.Add(QueryFilter.New(ColorProperty.ValidFrom, FilterConditions.Equals, changed.ValidFrom));
            }
            if (original.ValidTo != changed.ValidTo)
            {
                changes.Add(QueryFilter.New(ColorProperty.ValidTo, FilterConditions.Equals, changed.ValidTo));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Executes Stored Procedure named CheckInvoiceLine.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of CheckInvoiceLine_Result</returns>
        public StoredProcResult <CheckInvoiceLine_Result> CheckInvoiceLine(CheckInvoiceLine_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <CheckInvoiceLine_RequestProperty> {
                QueryFilter.New(CheckInvoiceLine_RequestProperty.InvoiceLineId, FilterConditions.Equals, request.InvoiceLineId)
            };
            #endregion
            var result = new List <CheckInvoiceLine_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new CheckInvoiceLine_Result
                    {
                        BlankName_0 = r.GetValue(0) as bool?,
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_CheckInvoiceLine, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <CheckInvoiceLine_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Exemplo n.º 6
0
        private QueryFilters GetFilters(BaseItem[] items)
        {
            var result = new QueryFilters();

            result.Years = items.Select(i => i.ProductionYear ?? -1)
                           .Where(i => i > 0)
                           .Distinct()
                           .OrderBy(i => i)
                           .ToArray();

            result.Genres = items.SelectMany(i => i.Genres)
                            .DistinctNames()
                            .OrderBy(i => i)
                            .ToArray();

            result.Tags = items
                          .SelectMany(i => i.Tags)
                          .Distinct(StringComparer.OrdinalIgnoreCase)
                          .OrderBy(i => i)
                          .ToArray();

            result.OfficialRatings = items
                                     .Select(i => i.OfficialRating)
                                     .Where(i => !string.IsNullOrWhiteSpace(i))
                                     .Distinct(StringComparer.OrdinalIgnoreCase)
                                     .OrderBy(i => i)
                                     .ToArray();

            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Executes Stored Procedure named GetInvoiceLinesByTrack.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of GetInvoiceLinesByTrack_Result</returns>
        public StoredProcResult <GetInvoiceLinesByTrack_Result> GetInvoiceLinesByTrack(GetInvoiceLinesByTrack_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <GetInvoiceLinesByTrack_RequestProperty> {
                QueryFilter.New(GetInvoiceLinesByTrack_RequestProperty.TrackId, FilterConditions.Equals, request.TrackId)
            };
            #endregion
            var result = new List <GetInvoiceLinesByTrack_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetInvoiceLinesByTrack_Result
                    {
                        InvoiceLineId = r.GetInt32(0),
                        InvoiceId     = r.GetInt32(1),
                        TrackId       = r.GetInt32(2),
                        UnitPrice     = r.GetDecimal(3),
                        Quantity      = r.GetInt32(4),
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_GetInvoiceLinesByTrack, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <GetInvoiceLinesByTrack_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of InvoiceLineProperty</returns>
        public static QueryFilters <InvoiceLineProperty> GetChanges(InvoiceLine original, InvoiceLine changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <InvoiceLineProperty>(5);

            #region Detect Changes
            if (original.InvoiceLineId != changed.InvoiceLineId)
            {
                changes.Add(QueryFilter.New(InvoiceLineProperty.InvoiceLineId, FilterConditions.Equals, changed.InvoiceLineId));
            }
            if (original.InvoiceId != changed.InvoiceId)
            {
                changes.Add(QueryFilter.New(InvoiceLineProperty.InvoiceId, FilterConditions.Equals, changed.InvoiceId));
            }
            if (original.TrackId != changed.TrackId)
            {
                changes.Add(QueryFilter.New(InvoiceLineProperty.TrackId, FilterConditions.Equals, changed.TrackId));
            }
            if (original.UnitPrice != changed.UnitPrice)
            {
                changes.Add(QueryFilter.New(InvoiceLineProperty.UnitPrice, FilterConditions.Equals, changed.UnitPrice));
            }
            if (original.Quantity != changed.Quantity)
            {
                changes.Add(QueryFilter.New(InvoiceLineProperty.Quantity, FilterConditions.Equals, changed.Quantity));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }
Exemplo n.º 9
0
        public SqlExpression <From> Filter <From>(ISqlExpression q, IQueryDb dto, IRequest req)
        {
            if (QueryFilters == null)
            {
                return((SqlExpression <From>)q);
            }

            QueryFilterDelegate filterFn = null;

            if (!QueryFilters.TryGetValue(dto.GetType(), out filterFn))
            {
                foreach (var type in dto.GetType().GetInterfaces())
                {
                    if (QueryFilters.TryGetValue(type, out filterFn))
                    {
                        break;
                    }
                }
            }

            if (filterFn != null)
            {
                filterFn(q, dto, req);
            }

            return((SqlExpression <From>)q);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Entity.MainDb.Accounting.Invoice from the database by Primary Key.
 /// </summary>
 /// <param name="invoiceid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int invoiceid)
 {
     var where = new QueryFilters <InvoiceProperty>(1)
     {
         QueryFilter.New(InvoiceProperty.InvoiceId, FilterConditions.Equals, invoiceid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color from the database by Primary Key.
 /// </summary>
 /// <param name="colorid">Primary Key Field.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color</returns>
 public Color ByPK(int colorid)
 {
     var where = new QueryFilters <ColorProperty>(1)
     {
         QueryFilter.New(ColorProperty.ColorID, FilterConditions.Equals, colorid),
     };
     return(SelectSingle(where, DefaultSort));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color from the database by Primary Key.
 /// </summary>
 /// <param name="colorid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int colorid)
 {
     var where = new QueryFilters <ColorProperty>(1)
     {
         QueryFilter.New(ColorProperty.ColorID, FilterConditions.Equals, colorid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.SupplierTransaction from the database by Primary Key.
 /// </summary>
 /// <param name="suppliertransactionid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int suppliertransactionid)
 {
     var where = new QueryFilters <SupplierTransactionProperty>(1)
     {
         QueryFilter.New(SupplierTransactionProperty.SupplierTransactionID, FilterConditions.Equals, suppliertransactionid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.SupplierTransaction from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="suppliertransactionid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.SupplierTransaction</returns>
 public SupplierTransaction ByPK(int suppliertransactionid, NavProps <SupplierTransactionNavProperty> navprops)
 {
     var where = new QueryFilters <SupplierTransactionProperty>(1)
     {
         QueryFilter.New(SupplierTransactionProperty.SupplierTransactionID, FilterConditions.Equals, suppliertransactionid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.PurchaseOrder from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="purchaseorderid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.PurchaseOrder</returns>
 public PurchaseOrder ByPK(int purchaseorderid, NavProps <PurchaseOrderNavProperty> navprops)
 {
     var where = new QueryFilters <PurchaseOrderProperty>(1)
     {
         QueryFilter.New(PurchaseOrderProperty.PurchaseOrderID, FilterConditions.Equals, purchaseorderid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="deliverymethodid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod</returns>
 public DeliveryMethod ByPK(int deliverymethodid, NavProps <DeliveryMethodNavProperty> navprops)
 {
     var where = new QueryFilters <DeliveryMethodProperty>(1)
     {
         QueryFilter.New(DeliveryMethodProperty.DeliveryMethodID, FilterConditions.Equals, deliverymethodid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.ColdRoomTemperature from the database by Primary Key.
 /// </summary>
 /// <param name="coldroomtemperatureid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(long coldroomtemperatureid)
 {
     var where = new QueryFilters <ColdRoomTemperatureProperty>(1)
     {
         QueryFilter.New(ColdRoomTemperatureProperty.ColdRoomTemperatureID, FilterConditions.Equals, coldroomtemperatureid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.ColdRoomTemperature from the database by Primary Key.
 /// </summary>
 /// <param name="coldroomtemperatureid">Primary Key Field.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.ColdRoomTemperature</returns>
 public ColdRoomTemperature ByPK(long coldroomtemperatureid)
 {
     var where = new QueryFilters <ColdRoomTemperatureProperty>(1)
     {
         QueryFilter.New(ColdRoomTemperatureProperty.ColdRoomTemperatureID, FilterConditions.Equals, coldroomtemperatureid),
     };
     return(SelectSingle(where, DefaultSort));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Genre from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="genreid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Genre</returns>
 public Genre ByPK(int genreid, NavProps <GenreNavProperty> navprops)
 {
     var where = new QueryFilters <GenreProperty>(1)
     {
         QueryFilter.New(GenreProperty.GenreId, FilterConditions.Equals, genreid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Entity.MainDb.Media.Genre from the database by Primary Key.
 /// </summary>
 /// <param name="genreid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int genreid)
 {
     var where = new QueryFilters <GenreProperty>(1)
     {
         QueryFilter.New(GenreProperty.GenreId, FilterConditions.Equals, genreid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod from the database by Primary Key.
 /// </summary>
 /// <param name="deliverymethodid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int deliverymethodid)
 {
     var where = new QueryFilters <DeliveryMethodProperty>(1)
     {
         QueryFilter.New(DeliveryMethodProperty.DeliveryMethodID, FilterConditions.Equals, deliverymethodid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Entity.MainDb.Accounting.Invoice from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="invoiceid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Entity.MainDb.Accounting.Invoice</returns>
 public Invoice ByPK(int invoiceid, NavProps <InvoiceNavProperty> navprops)
 {
     var where = new QueryFilters <InvoiceProperty>(1)
     {
         QueryFilter.New(InvoiceProperty.InvoiceId, FilterConditions.Equals, invoiceid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 23
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Entity.MainDb.Media.Track from the database by Primary Key.
 /// </summary>
 /// <param name="trackid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int trackid)
 {
     var where = new QueryFilters <TrackProperty>(1)
     {
         QueryFilter.New(TrackProperty.TrackId, FilterConditions.Equals, trackid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.PurchaseOrder from the database by Primary Key.
 /// </summary>
 /// <param name="purchaseorderid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int purchaseorderid)
 {
     var where = new QueryFilters <PurchaseOrderProperty>(1)
     {
         QueryFilter.New(PurchaseOrderProperty.PurchaseOrderID, FilterConditions.Equals, purchaseorderid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 25
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Track from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="trackid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Track</returns>
 public Track ByPK(int trackid, NavProps <TrackNavProperty> navprops)
 {
     var where = new QueryFilters <TrackProperty>(1)
     {
         QueryFilter.New(TrackProperty.TrackId, FilterConditions.Equals, trackid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 26
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.VehicleTemperature from the database by Primary Key.
 /// </summary>
 /// <param name="vehicletemperatureid">Primary Key Field.</param>
 /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.VehicleTemperature</returns>
 public VehicleTemperature ByPK(long vehicletemperatureid)
 {
     var where = new QueryFilters <VehicleTemperatureProperty>(1)
     {
         QueryFilter.New(VehicleTemperatureProperty.VehicleTemperatureID, FilterConditions.Equals, vehicletemperatureid),
     };
     return(SelectSingle(where, DefaultSort));
 }
 /// <summary>
 /// Gets the specified TheSharpFactory.Entity.MainDb.Media.MediaType from the database by Primary Key. Supports navigation properties.
 /// </summary>
 /// <param name="mediatypeid">Primary Key Field.</param>
 /// <param name="navprops">The navigation properties to include in the result.</param>
 /// <returns>Single TheSharpFactory.Entity.MainDb.Media.MediaType</returns>
 public MediaType ByPK(int mediatypeid, NavProps <MediaTypeNavProperty> navprops)
 {
     var where = new QueryFilters <MediaTypeProperty>(1)
     {
         QueryFilter.New(MediaTypeProperty.MediaTypeId, FilterConditions.Equals, mediatypeid),
     };
     return(SelectSingle(where, DefaultSort, navprops));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Deletes the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.VehicleTemperature from the database by Primary Key.
 /// </summary>
 /// <param name="vehicletemperatureid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(long vehicletemperatureid)
 {
     var where = new QueryFilters <VehicleTemperatureProperty>(1)
     {
         QueryFilter.New(VehicleTemperatureProperty.VehicleTemperatureID, FilterConditions.Equals, vehicletemperatureid),
     };
     return(DeleteAny(where) > 0);
 }
 /// <summary>
 /// Deletes the specified TheSharpFactory.Entity.MainDb.Media.MediaType from the database by Primary Key.
 /// </summary>
 /// <param name="mediatypeid">Primary Key Field.</param>
 /// <returns>True if succeeded. False if it does not exist.</returns>
 public bool DeleteByPK(int mediatypeid)
 {
     var where = new QueryFilters <MediaTypeProperty>(1)
     {
         QueryFilter.New(MediaTypeProperty.MediaTypeId, FilterConditions.Equals, mediatypeid),
     };
     return(DeleteAny(where) > 0);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Gets the specified TheSharpFactory.Entity.MainDb.Accounting.OrderDetail from the database by Primary Key.
 /// </summary>
 /// <param name="id">Primary Key Field.</param>
 /// <param name="subid">Primary Key Field.</param>
 /// <returns>Single TheSharpFactory.Entity.MainDb.Accounting.OrderDetail</returns>
 public OrderDetail ByPK(int id, string subid)
 {
     var where = new QueryFilters <OrderDetailProperty>(2)
     {
         QueryFilter.New(OrderDetailProperty.Id, FilterConditions.Equals, id), QueryFilter.New(OrderDetailProperty.SubId, FilterConditions.Equals, subid),
     };
     return(SelectSingle(where, DefaultSort));
 }