コード例 #1
0
        /// <summary>
        /// Updates and returns the value of the CustomParameter object.
        /// </summary>
        /// <param name="context">The current System.Web.HttpContext of the request.</param>
        /// <param name="control">The System.Web.UI.Control that the parameter is bound to.</param>
        /// <returns>A System.Object that represents the updated and current value of the parameter.</returns>
        protected override Object Evaluate(HttpContext context, Control control)
        {
            Object value = _value;

            if (ValueType != null)
            {
                value = EntityUtil.ChangeType(value, ValueType);
            }

            return(value);
        }
コード例 #2
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Address> GetSelectData(out int count)
        {
            Hashtable       values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable       customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Address> results      = null;
            Address         item;

            count = 0;

            System.Guid   _rowguid;
            System.String _addressLine1;
            System.String _addressLine2_nullable;
            System.String _city;
            System.Int32  _stateProvinceId;
            System.String _postalCode;
            System.Int32  _addressId;
            System.Int32  _customerId;
            System.Int32  _employeeId;
            System.Int32  _vendorId;

            switch (SelectMethod)
            {
            case AddressSelectMethod.Get:
                AddressKey entityKey = new AddressKey();
                entityKey.Load(values);
                item    = AddressProvider.Get(entityKey);
                results = new TList <Address>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case AddressSelectMethod.GetAll:
                results = AddressProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case AddressSelectMethod.GetPaged:
                results = AddressProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case AddressSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = AddressProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = AddressProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case AddressSelectMethod.GetByAddressId:
                _addressId = (values["AddressId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["AddressId"], typeof(System.Int32)) : (int)0;
                item       = AddressProvider.GetByAddressId(_addressId);
                results    = new TList <Address>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case AddressSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = AddressProvider.GetByRowguid(_rowguid);
                results  = new TList <Address>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case AddressSelectMethod.GetByAddressLine1AddressLine2CityStateProvinceIdPostalCode:
                _addressLine1          = (values["AddressLine1"] != null) ? (System.String)EntityUtil.ChangeType(values["AddressLine1"], typeof(System.String)) : string.Empty;
                _addressLine2_nullable = (System.String)EntityUtil.ChangeType(values["AddressLine2"], typeof(System.String));
                _city            = (values["City"] != null) ? (System.String)EntityUtil.ChangeType(values["City"], typeof(System.String)) : string.Empty;
                _stateProvinceId = (values["StateProvinceId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["StateProvinceId"], typeof(System.Int32)) : (int)0;
                _postalCode      = (values["PostalCode"] != null) ? (System.String)EntityUtil.ChangeType(values["PostalCode"], typeof(System.String)) : string.Empty;
                item             = AddressProvider.GetByAddressLine1AddressLine2CityStateProvinceIdPostalCode(_addressLine1, _addressLine2_nullable, _city, _stateProvinceId, _postalCode);
                results          = new TList <Address>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case AddressSelectMethod.GetByStateProvinceId:
                _stateProvinceId = (values["StateProvinceId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["StateProvinceId"], typeof(System.Int32)) : (int)0;
                results          = AddressProvider.GetByStateProvinceId(_stateProvinceId, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            // M:M
            case AddressSelectMethod.GetByCustomerIdFromCustomerAddress:
                _customerId = (values["CustomerId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["CustomerId"], typeof(System.Int32)) : (int)0;
                results     = AddressProvider.GetByCustomerIdFromCustomerAddress(_customerId, this.StartIndex, this.PageSize, out count);
                break;

            case AddressSelectMethod.GetByEmployeeIdFromEmployeeAddress:
                _employeeId = (values["EmployeeId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32)) : (int)0;
                results     = AddressProvider.GetByEmployeeIdFromEmployeeAddress(_employeeId, this.StartIndex, this.PageSize, out count);
                break;

            case AddressSelectMethod.GetByVendorIdFromVendorAddress:
                _vendorId = (values["VendorId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["VendorId"], typeof(System.Int32)) : (int)0;
                results   = AddressProvider.GetByVendorIdFromVendorAddress(_vendorId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #3
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <param name="values"></param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <EmployeeSkills> GetSelectData(IDictionary values, out int count)
        {
            if (values == null || values.Count == 0)
            {
                values = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            }

            Hashtable customOutput         = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <EmployeeSkills> results = null;
            EmployeeSkills         item;

            count = 0;

            System.Int32  _employeeSkillId;
            System.String _skillCode_nullable;
            System.String _skillLevel_nullable;
            System.Int32? _employeeId_nullable;

            switch (SelectMethod)
            {
            case EmployeeSkillsSelectMethod.Get:
                EmployeeSkillsKey entityKey = new EmployeeSkillsKey();
                entityKey.Load(values);
                item    = EmployeeSkillsProvider.Get(entityKey);
                results = new TList <EmployeeSkills>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeeSkillsSelectMethod.GetAll:
                results = EmployeeSkillsProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case EmployeeSkillsSelectMethod.GetPaged:
                results = EmployeeSkillsProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case EmployeeSkillsSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = EmployeeSkillsProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = EmployeeSkillsProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case EmployeeSkillsSelectMethod.GetByEmployeeSkillId:
                _employeeSkillId = (values["EmployeeSkillId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["EmployeeSkillId"], typeof(System.Int32)) : (int)0;
                item             = EmployeeSkillsProvider.GetByEmployeeSkillId(_employeeSkillId);
                results          = new TList <EmployeeSkills>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            // FK
            case EmployeeSkillsSelectMethod.GetBySkillCode:
                _skillCode_nullable = (System.String)EntityUtil.ChangeType(values["SkillCode"], typeof(System.String));
                results             = EmployeeSkillsProvider.GetBySkillCode(_skillCode_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case EmployeeSkillsSelectMethod.GetBySkillLevel:
                _skillLevel_nullable = (System.String)EntityUtil.ChangeType(values["SkillLevel"], typeof(System.String));
                results = EmployeeSkillsProvider.GetBySkillLevel(_skillLevel_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case EmployeeSkillsSelectMethod.GetByEmployeeId:
                _employeeId_nullable = (System.Int32?)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32?));
                results = EmployeeSkillsProvider.GetByEmployeeId(_employeeId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #4
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <BillOfMaterials> GetSelectData(out int count)
        {
            Hashtable values                = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput          = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <BillOfMaterials> results = null;
            BillOfMaterials         item;

            count = 0;

            System.Int32?   _productAssemblyId_nullable;
            System.Int32    _componentId;
            System.DateTime _startDate;
            System.String   _unitMeasureCode;
            System.Int32    _billOfMaterialsId;

            switch (SelectMethod)
            {
            case BillOfMaterialsSelectMethod.Get:
                BillOfMaterialsKey entityKey = new BillOfMaterialsKey();
                entityKey.Load(values);
                item    = BillOfMaterialsProvider.Get(entityKey);
                results = new TList <BillOfMaterials>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case BillOfMaterialsSelectMethod.GetAll:
                results = BillOfMaterialsProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case BillOfMaterialsSelectMethod.GetPaged:
                results = BillOfMaterialsProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case BillOfMaterialsSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = BillOfMaterialsProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = BillOfMaterialsProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case BillOfMaterialsSelectMethod.GetByBillOfMaterialsId:
                _billOfMaterialsId = (values["BillOfMaterialsId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["BillOfMaterialsId"], typeof(System.Int32)) : (int)0;
                item    = BillOfMaterialsProvider.GetByBillOfMaterialsId(_billOfMaterialsId);
                results = new TList <BillOfMaterials>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case BillOfMaterialsSelectMethod.GetByProductAssemblyIdComponentIdStartDate:
                _productAssemblyId_nullable = (System.Int32?)EntityUtil.ChangeType(values["ProductAssemblyId"], typeof(System.Int32?));
                _componentId = (values["ComponentId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ComponentId"], typeof(System.Int32)) : (int)0;
                _startDate   = (values["StartDate"] != null) ? (System.DateTime)EntityUtil.ChangeType(values["StartDate"], typeof(System.DateTime)) : DateTime.MinValue;
                item         = BillOfMaterialsProvider.GetByProductAssemblyIdComponentIdStartDate(_productAssemblyId_nullable, _componentId, _startDate);
                results      = new TList <BillOfMaterials>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case BillOfMaterialsSelectMethod.GetByUnitMeasureCode:
                _unitMeasureCode = (values["UnitMeasureCode"] != null) ? (System.String)EntityUtil.ChangeType(values["UnitMeasureCode"], typeof(System.String)) : string.Empty;
                results          = BillOfMaterialsProvider.GetByUnitMeasureCode(_unitMeasureCode, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            case BillOfMaterialsSelectMethod.GetByComponentId:
                _componentId = (values["ComponentId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ComponentId"], typeof(System.Int32)) : (int)0;
                results      = BillOfMaterialsProvider.GetByComponentId(_componentId, this.StartIndex, this.PageSize, out count);
                break;

            case BillOfMaterialsSelectMethod.GetByProductAssemblyId:
                _productAssemblyId_nullable = (System.Int32?)EntityUtil.ChangeType(values["ProductAssemblyId"], typeof(System.Int32?));
                results = BillOfMaterialsProvider.GetByProductAssemblyId(_productAssemblyId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #5
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <WorkOrderRouting> GetSelectData(out int count)
        {
            Hashtable values                 = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput           = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <WorkOrderRouting> results = null;
            WorkOrderRouting         item;

            count = 0;

            System.Int32 _productId;
            System.Int32 _workOrderId;
            System.Int16 _operationSequence;
            System.Int16 _locationId;

            switch (SelectMethod)
            {
            case WorkOrderRoutingSelectMethod.Get:
                WorkOrderRoutingKey entityKey = new WorkOrderRoutingKey();
                entityKey.Load(values);
                item    = WorkOrderRoutingProvider.Get(entityKey);
                results = new TList <WorkOrderRouting>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case WorkOrderRoutingSelectMethod.GetAll:
                results = WorkOrderRoutingProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case WorkOrderRoutingSelectMethod.GetPaged:
                results = WorkOrderRoutingProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case WorkOrderRoutingSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = WorkOrderRoutingProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = WorkOrderRoutingProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case WorkOrderRoutingSelectMethod.GetByWorkOrderIdProductIdOperationSequence:
                _workOrderId       = (values["WorkOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["WorkOrderId"], typeof(System.Int32)) : (int)0;
                _productId         = (values["ProductId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductId"], typeof(System.Int32)) : (int)0;
                _operationSequence = (values["OperationSequence"] != null) ? (System.Int16)EntityUtil.ChangeType(values["OperationSequence"], typeof(System.Int16)) : (short)0;
                item    = WorkOrderRoutingProvider.GetByWorkOrderIdProductIdOperationSequence(_workOrderId, _productId, _operationSequence);
                results = new TList <WorkOrderRouting>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case WorkOrderRoutingSelectMethod.GetByProductId:
                _productId = (values["ProductId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductId"], typeof(System.Int32)) : (int)0;
                results    = WorkOrderRoutingProvider.GetByProductId(_productId, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            case WorkOrderRoutingSelectMethod.GetByLocationId:
                _locationId = (values["LocationId"] != null) ? (System.Int16)EntityUtil.ChangeType(values["LocationId"], typeof(System.Int16)) : (short)0;
                results     = WorkOrderRoutingProvider.GetByLocationId(_locationId, this.StartIndex, this.PageSize, out count);
                break;

            case WorkOrderRoutingSelectMethod.GetByWorkOrderId:
                _workOrderId = (values["WorkOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["WorkOrderId"], typeof(System.Int32)) : (int)0;
                results      = WorkOrderRoutingProvider.GetByWorkOrderId(_workOrderId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #6
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Product> GetSelectData(out int count)
        {
            Hashtable       values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable       customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Product> results      = null;
            Product         item;

            count = 0;

            System.String _name;
            System.String _productNumber;
            System.Guid   _rowguid;
            System.Int32  _productId;
            System.Int32? _productModelId_nullable;
            System.Int32? _productSubcategoryId_nullable;
            System.String _sizeUnitMeasureCode_nullable;
            System.String _weightUnitMeasureCode_nullable;
            System.Int32  _documentId;
            System.Int16  _locationId;
            System.Int32  _productPhotoId;
            System.Int32  _vendorId;
            System.Int32  _specialOfferId;

            switch (SelectMethod)
            {
            case ProductSelectMethod.Get:
                ProductKey entityKey = new ProductKey();
                entityKey.Load(values);
                item    = ProductProvider.Get(entityKey);
                results = new TList <Product>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ProductSelectMethod.GetAll:
                results = ProductProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case ProductSelectMethod.GetPaged:
                results = ProductProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case ProductSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = ProductProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = ProductProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case ProductSelectMethod.GetByProductId:
                _productId = (values["ProductId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductId"], typeof(System.Int32)) : (int)0;
                item       = ProductProvider.GetByProductId(_productId);
                results    = new TList <Product>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case ProductSelectMethod.GetByName:
                _name   = (values["Name"] != null) ? (System.String)EntityUtil.ChangeType(values["Name"], typeof(System.String)) : string.Empty;
                item    = ProductProvider.GetByName(_name);
                results = new TList <Product>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ProductSelectMethod.GetByProductNumber:
                _productNumber = (values["ProductNumber"] != null) ? (System.String)EntityUtil.ChangeType(values["ProductNumber"], typeof(System.String)) : string.Empty;
                item           = ProductProvider.GetByProductNumber(_productNumber);
                results        = new TList <Product>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ProductSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = ProductProvider.GetByRowguid(_rowguid);
                results  = new TList <Product>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // FK
            case ProductSelectMethod.GetByProductModelId:
                _productModelId_nullable = (System.Int32?)EntityUtil.ChangeType(values["ProductModelId"], typeof(System.Int32?));
                results = ProductProvider.GetByProductModelId(_productModelId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetByProductSubcategoryId:
                _productSubcategoryId_nullable = (System.Int32?)EntityUtil.ChangeType(values["ProductSubcategoryId"], typeof(System.Int32?));
                results = ProductProvider.GetByProductSubcategoryId(_productSubcategoryId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetBySizeUnitMeasureCode:
                _sizeUnitMeasureCode_nullable = (System.String)EntityUtil.ChangeType(values["SizeUnitMeasureCode"], typeof(System.String));
                results = ProductProvider.GetBySizeUnitMeasureCode(_sizeUnitMeasureCode_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetByWeightUnitMeasureCode:
                _weightUnitMeasureCode_nullable = (System.String)EntityUtil.ChangeType(values["WeightUnitMeasureCode"], typeof(System.String));
                results = ProductProvider.GetByWeightUnitMeasureCode(_weightUnitMeasureCode_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            case ProductSelectMethod.GetByDocumentIdFromProductDocument:
                _documentId = (values["DocumentId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["DocumentId"], typeof(System.Int32)) : (int)0;
                results     = ProductProvider.GetByDocumentIdFromProductDocument(_documentId, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetByLocationIdFromProductInventory:
                _locationId = (values["LocationId"] != null) ? (System.Int16)EntityUtil.ChangeType(values["LocationId"], typeof(System.Int16)) : (short)0;
                results     = ProductProvider.GetByLocationIdFromProductInventory(_locationId, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetByProductPhotoIdFromProductProductPhoto:
                _productPhotoId = (values["ProductPhotoId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductPhotoId"], typeof(System.Int32)) : (int)0;
                results         = ProductProvider.GetByProductPhotoIdFromProductProductPhoto(_productPhotoId, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetByVendorIdFromProductVendor:
                _vendorId = (values["VendorId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["VendorId"], typeof(System.Int32)) : (int)0;
                results   = ProductProvider.GetByVendorIdFromProductVendor(_vendorId, this.StartIndex, this.PageSize, out count);
                break;

            case ProductSelectMethod.GetBySpecialOfferIdFromSpecialOfferProduct:
                _specialOfferId = (values["SpecialOfferId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SpecialOfferId"], typeof(System.Int32)) : (int)0;
                results         = ProductProvider.GetBySpecialOfferIdFromSpecialOfferProduct(_specialOfferId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #7
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <ProductDescription> GetSelectData(out int count)
        {
            Hashtable values                   = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput             = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <ProductDescription> results = null;
            ProductDescription         item;

            count = 0;

            System.Guid   _rowguid;
            System.Int32  _productDescriptionId;
            System.String _cultureId;
            System.Int32  _productModelId;

            switch (SelectMethod)
            {
            case ProductDescriptionSelectMethod.Get:
                ProductDescriptionKey entityKey = new ProductDescriptionKey();
                entityKey.Load(values);
                item    = ProductDescriptionProvider.Get(entityKey);
                results = new TList <ProductDescription>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ProductDescriptionSelectMethod.GetAll:
                results = ProductDescriptionProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case ProductDescriptionSelectMethod.GetPaged:
                results = ProductDescriptionProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case ProductDescriptionSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = ProductDescriptionProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = ProductDescriptionProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case ProductDescriptionSelectMethod.GetByProductDescriptionId:
                _productDescriptionId = (values["ProductDescriptionId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductDescriptionId"], typeof(System.Int32)) : (int)0;
                item    = ProductDescriptionProvider.GetByProductDescriptionId(_productDescriptionId);
                results = new TList <ProductDescription>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case ProductDescriptionSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = ProductDescriptionProvider.GetByRowguid(_rowguid);
                results  = new TList <ProductDescription>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // FK
            // M:M
            case ProductDescriptionSelectMethod.GetByCultureIdFromProductModelProductDescriptionCulture:
                _cultureId = (values["CultureId"] != null) ? (System.String)EntityUtil.ChangeType(values["CultureId"], typeof(System.String)) : string.Empty;
                results    = ProductDescriptionProvider.GetByCultureIdFromProductModelProductDescriptionCulture(_cultureId, this.StartIndex, this.PageSize, out count);
                break;

            case ProductDescriptionSelectMethod.GetByProductModelIdFromProductModelProductDescriptionCulture:
                _productModelId = (values["ProductModelId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductModelId"], typeof(System.Int32)) : (int)0;
                results         = ProductDescriptionProvider.GetByProductModelIdFromProductModelProductDescriptionCulture(_productModelId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #8
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <TestTimestamp> GetSelectData(out int count)
        {
            Hashtable             values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable             customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <TestTimestamp> results      = null;
            TestTimestamp         item;

            count = 0;

            System.Int32 _testTimestampId;

            switch (SelectMethod)
            {
            case TestTimestampSelectMethod.Get:
                TestTimestampKey entityKey = new TestTimestampKey();
                entityKey.Load(values);
                item    = TestTimestampProvider.Get(entityKey);
                results = new TList <TestTimestamp>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case TestTimestampSelectMethod.GetAll:
                results = TestTimestampProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case TestTimestampSelectMethod.GetPaged:
                results = TestTimestampProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case TestTimestampSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = TestTimestampProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = TestTimestampProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case TestTimestampSelectMethod.GetByTestTimestampId:
                _testTimestampId = (values["TestTimestampId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["TestTimestampId"], typeof(System.Int32)) : (int)0;
                item             = TestTimestampProvider.GetByTestTimestampId(_testTimestampId);
                results          = new TList <TestTimestamp>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            // FK
            // M:M
            // Custom
            case TestTimestampSelectMethod.GetAllTimestamp:
                results = TestTimestampProvider.GetAllTimestamp(StartIndex, PageSize);
                break;

            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #9
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Contact> GetSelectData(out int count)
        {
            Hashtable       values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable       customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Contact> results      = null;
            Contact         item;

            count = 0;

            System.Guid   _rowguid;
            System.String _emailAddress_nullable;
            System.Int32  _contactId;
            string        _additionalContactInfo_nullable;

            System.Int32 _creditCardId;
            System.Int32 _customerId;
            System.Int32 _vendorId;

            switch (SelectMethod)
            {
            case ContactSelectMethod.Get:
                ContactKey entityKey = new ContactKey();
                entityKey.Load(values);
                item    = ContactProvider.Get(entityKey);
                results = new TList <Contact>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ContactSelectMethod.GetAll:
                results = ContactProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case ContactSelectMethod.GetPaged:
                results = ContactProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case ContactSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = ContactProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = ContactProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case ContactSelectMethod.GetByContactId:
                _contactId = (values["ContactId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ContactId"], typeof(System.Int32)) : (int)0;
                item       = ContactProvider.GetByContactId(_contactId);
                results    = new TList <Contact>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case ContactSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = ContactProvider.GetByRowguid(_rowguid);
                results  = new TList <Contact>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ContactSelectMethod.GetByEmailAddress:
                _emailAddress_nullable = (System.String)EntityUtil.ChangeType(values["EmailAddress"], typeof(System.String));
                results = ContactProvider.GetByEmailAddress(_emailAddress_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case ContactSelectMethod.GetByAdditionalContactInfo:
                _additionalContactInfo_nullable = (string)EntityUtil.ChangeType(values["AdditionalContactInfo"], typeof(string));
                results = ContactProvider.GetByAdditionalContactInfo(_additionalContactInfo_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            // M:M
            case ContactSelectMethod.GetByCreditCardIdFromContactCreditCard:
                _creditCardId = (values["CreditCardId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["CreditCardId"], typeof(System.Int32)) : (int)0;
                results       = ContactProvider.GetByCreditCardIdFromContactCreditCard(_creditCardId, this.StartIndex, this.PageSize, out count);
                break;

            case ContactSelectMethod.GetByCustomerIdFromStoreContact:
                _customerId = (values["CustomerId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["CustomerId"], typeof(System.Int32)) : (int)0;
                results     = ContactProvider.GetByCustomerIdFromStoreContact(_customerId, this.StartIndex, this.PageSize, out count);
                break;

            case ContactSelectMethod.GetByVendorIdFromVendorContact:
                _vendorId = (values["VendorId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["VendorId"], typeof(System.Int32)) : (int)0;
                results   = ContactProvider.GetByVendorIdFromVendorContact(_vendorId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #10
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Store> GetSelectData(out int count)
        {
            Hashtable     values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable     customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Store> results      = null;
            Store         item;

            count = 0;

            System.Guid  _rowguid;
            System.Int32?_salesPersonId_nullable;
            System.Int32 _customerId;
            string       _demographics_nullable;

            System.Int32 _contactId;

            switch (SelectMethod)
            {
            case StoreSelectMethod.Get:
                StoreKey entityKey = new StoreKey();
                entityKey.Load(values);
                item    = StoreProvider.Get(entityKey);
                results = new TList <Store>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case StoreSelectMethod.GetAll:
                results = StoreProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case StoreSelectMethod.GetPaged:
                results = StoreProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case StoreSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = StoreProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = StoreProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case StoreSelectMethod.GetByCustomerId:
                _customerId = (values["CustomerId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["CustomerId"], typeof(System.Int32)) : (int)0;
                item        = StoreProvider.GetByCustomerId(_customerId);
                results     = new TList <Store>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case StoreSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = StoreProvider.GetByRowguid(_rowguid);
                results  = new TList <Store>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case StoreSelectMethod.GetBySalesPersonId:
                _salesPersonId_nullable = (System.Int32?)EntityUtil.ChangeType(values["SalesPersonId"], typeof(System.Int32?));
                results = StoreProvider.GetBySalesPersonId(_salesPersonId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case StoreSelectMethod.GetByDemographics:
                _demographics_nullable = (string)EntityUtil.ChangeType(values["Demographics"], typeof(string));
                results = StoreProvider.GetByDemographics(_demographics_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            // M:M
            case StoreSelectMethod.GetByContactIdFromStoreContact:
                _contactId = (values["ContactId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ContactId"], typeof(System.Int32)) : (int)0;
                results    = StoreProvider.GetByContactIdFromStoreContact(_contactId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #11
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <param name="values"></param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Classes> GetSelectData(IDictionary values, out int count)
        {
            if (values == null || values.Count == 0)
            {
                values = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            }

            Hashtable       customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Classes> results      = null;
            Classes         item;

            count = 0;

            System.Int32 _id;

            switch (SelectMethod)
            {
            case ClassesSelectMethod.Get:
                ClassesKey entityKey = new ClassesKey();
                entityKey.Load(values);
                item    = ClassesProvider.Get(GetTransactionManager(), entityKey);
                results = new TList <Classes>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case ClassesSelectMethod.GetAll:
                results = ClassesProvider.GetAll(GetTransactionManager(), StartIndex, PageSize, out count);
                break;

            case ClassesSelectMethod.GetPaged:
                results = ClassesProvider.GetPaged(GetTransactionManager(), WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case ClassesSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = ClassesProvider.Find(GetTransactionManager(), FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = ClassesProvider.Find(GetTransactionManager(), WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case ClassesSelectMethod.GetById:
                _id     = (values["Id"] != null) ? (System.Int32)EntityUtil.ChangeType(values["Id"], typeof(System.Int32)) : (int)0;
                item    = ClassesProvider.GetById(GetTransactionManager(), _id);
                results = new TList <Classes>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            // FK
            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #12
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Vendor> GetSelectData(out int count)
        {
            Hashtable      values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable      customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Vendor> results      = null;
            Vendor         item;

            count = 0;

            System.String _accountNumber;
            System.Int32  _vendorId;
            System.Int32  _productId;
            System.Int32  _addressId;
            System.Int32  _contactId;

            switch (SelectMethod)
            {
            case VendorSelectMethod.Get:
                VendorKey entityKey = new VendorKey();
                entityKey.Load(values);
                item    = VendorProvider.Get(entityKey);
                results = new TList <Vendor>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case VendorSelectMethod.GetAll:
                results = VendorProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case VendorSelectMethod.GetPaged:
                results = VendorProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case VendorSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = VendorProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = VendorProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case VendorSelectMethod.GetByVendorId:
                _vendorId = (values["VendorId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["VendorId"], typeof(System.Int32)) : (int)0;
                item      = VendorProvider.GetByVendorId(_vendorId);
                results   = new TList <Vendor>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case VendorSelectMethod.GetByAccountNumber:
                _accountNumber = (values["AccountNumber"] != null) ? (System.String)EntityUtil.ChangeType(values["AccountNumber"], typeof(System.String)) : string.Empty;
                item           = VendorProvider.GetByAccountNumber(_accountNumber);
                results        = new TList <Vendor>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // FK
            // M:M
            case VendorSelectMethod.GetByProductIdFromProductVendor:
                _productId = (values["ProductId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductId"], typeof(System.Int32)) : (int)0;
                results    = VendorProvider.GetByProductIdFromProductVendor(_productId, this.StartIndex, this.PageSize, out count);
                break;

            case VendorSelectMethod.GetByAddressIdFromVendorAddress:
                _addressId = (values["AddressId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["AddressId"], typeof(System.Int32)) : (int)0;
                results    = VendorProvider.GetByAddressIdFromVendorAddress(_addressId, this.StartIndex, this.PageSize, out count);
                break;

            case VendorSelectMethod.GetByContactIdFromVendorContact:
                _contactId = (values["ContactId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ContactId"], typeof(System.Int32)) : (int)0;
                results    = VendorProvider.GetByContactIdFromVendorContact(_contactId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #13
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <SalesOrderHeader> GetSelectData(out int count)
        {
            Hashtable values                 = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput           = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <SalesOrderHeader> results = null;
            SalesOrderHeader         item;

            count = 0;

            System.Guid   _rowguid;
            System.String _salesOrderNumber;
            System.Int32  _customerId;
            System.Int32? _salesPersonId_nullable;
            System.Int32  _salesOrderId;
            System.Int32  _billToAddressId;
            System.Int32  _shipToAddressId;
            System.Int32  _contactId;
            System.Int32? _creditCardId_nullable;
            System.Int32? _currencyRateId_nullable;
            System.Int32? _territoryId_nullable;
            System.Int32  _shipMethodId;
            System.Int32  _salesReasonId;

            switch (SelectMethod)
            {
            case SalesOrderHeaderSelectMethod.Get:
                SalesOrderHeaderKey entityKey = new SalesOrderHeaderKey();
                entityKey.Load(values);
                item    = SalesOrderHeaderProvider.Get(entityKey);
                results = new TList <SalesOrderHeader>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case SalesOrderHeaderSelectMethod.GetAll:
                results = SalesOrderHeaderProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetPaged:
                results = SalesOrderHeaderProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = SalesOrderHeaderProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = SalesOrderHeaderProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case SalesOrderHeaderSelectMethod.GetBySalesOrderId:
                _salesOrderId = (values["SalesOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesOrderId"], typeof(System.Int32)) : (int)0;
                item          = SalesOrderHeaderProvider.GetBySalesOrderId(_salesOrderId);
                results       = new TList <SalesOrderHeader>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case SalesOrderHeaderSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = SalesOrderHeaderProvider.GetByRowguid(_rowguid);
                results  = new TList <SalesOrderHeader>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case SalesOrderHeaderSelectMethod.GetBySalesOrderNumber:
                _salesOrderNumber = (values["SalesOrderNumber"] != null) ? (System.String)EntityUtil.ChangeType(values["SalesOrderNumber"], typeof(System.String)) : string.Empty;
                item    = SalesOrderHeaderProvider.GetBySalesOrderNumber(_salesOrderNumber);
                results = new TList <SalesOrderHeader>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case SalesOrderHeaderSelectMethod.GetByCustomerId:
                _customerId = (values["CustomerId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["CustomerId"], typeof(System.Int32)) : (int)0;
                results     = SalesOrderHeaderProvider.GetByCustomerId(_customerId, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetBySalesPersonId:
                _salesPersonId_nullable = (System.Int32?)EntityUtil.ChangeType(values["SalesPersonId"], typeof(System.Int32?));
                results = SalesOrderHeaderProvider.GetBySalesPersonId(_salesPersonId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            case SalesOrderHeaderSelectMethod.GetByBillToAddressId:
                _billToAddressId = (values["BillToAddressId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["BillToAddressId"], typeof(System.Int32)) : (int)0;
                results          = SalesOrderHeaderProvider.GetByBillToAddressId(_billToAddressId, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByShipToAddressId:
                _shipToAddressId = (values["ShipToAddressId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ShipToAddressId"], typeof(System.Int32)) : (int)0;
                results          = SalesOrderHeaderProvider.GetByShipToAddressId(_shipToAddressId, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByContactId:
                _contactId = (values["ContactId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ContactId"], typeof(System.Int32)) : (int)0;
                results    = SalesOrderHeaderProvider.GetByContactId(_contactId, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByCreditCardId:
                _creditCardId_nullable = (System.Int32?)EntityUtil.ChangeType(values["CreditCardId"], typeof(System.Int32?));
                results = SalesOrderHeaderProvider.GetByCreditCardId(_creditCardId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByCurrencyRateId:
                _currencyRateId_nullable = (System.Int32?)EntityUtil.ChangeType(values["CurrencyRateId"], typeof(System.Int32?));
                results = SalesOrderHeaderProvider.GetByCurrencyRateId(_currencyRateId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByTerritoryId:
                _territoryId_nullable = (System.Int32?)EntityUtil.ChangeType(values["TerritoryId"], typeof(System.Int32?));
                results = SalesOrderHeaderProvider.GetByTerritoryId(_territoryId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSelectMethod.GetByShipMethodId:
                _shipMethodId = (values["ShipMethodId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ShipMethodId"], typeof(System.Int32)) : (int)0;
                results       = SalesOrderHeaderProvider.GetByShipMethodId(_shipMethodId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            case SalesOrderHeaderSelectMethod.GetBySalesReasonIdFromSalesOrderHeaderSalesReason:
                _salesReasonId = (values["SalesReasonId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesReasonId"], typeof(System.Int32)) : (int)0;
                results        = SalesOrderHeaderProvider.GetBySalesReasonIdFromSalesOrderHeaderSalesReason(_salesReasonId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #14
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <TransactionHistory> GetSelectData(out int count)
        {
            Hashtable values                   = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput             = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <TransactionHistory> results = null;
            TransactionHistory         item;

            count = 0;

            System.Int32 _productId;
            System.Int32 _referenceOrderId;
            System.Int32 _referenceOrderLineId;
            System.Int32 _transactionId;

            switch (SelectMethod)
            {
            case TransactionHistorySelectMethod.Get:
                TransactionHistoryKey entityKey = new TransactionHistoryKey();
                entityKey.Load(values);
                item    = TransactionHistoryProvider.Get(entityKey);
                results = new TList <TransactionHistory>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case TransactionHistorySelectMethod.GetAll:
                results = TransactionHistoryProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case TransactionHistorySelectMethod.GetPaged:
                results = TransactionHistoryProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case TransactionHistorySelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = TransactionHistoryProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = TransactionHistoryProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case TransactionHistorySelectMethod.GetByTransactionId:
                _transactionId = (values["TransactionId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["TransactionId"], typeof(System.Int32)) : (int)0;
                item           = TransactionHistoryProvider.GetByTransactionId(_transactionId);
                results        = new TList <TransactionHistory>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case TransactionHistorySelectMethod.GetByProductId:
                _productId = (values["ProductId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ProductId"], typeof(System.Int32)) : (int)0;
                results    = TransactionHistoryProvider.GetByProductId(_productId, this.StartIndex, this.PageSize, out count);
                break;

            case TransactionHistorySelectMethod.GetByReferenceOrderIdReferenceOrderLineId:
                _referenceOrderId     = (values["ReferenceOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ReferenceOrderId"], typeof(System.Int32)) : (int)0;
                _referenceOrderLineId = (values["ReferenceOrderLineId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ReferenceOrderLineId"], typeof(System.Int32)) : (int)0;
                results = TransactionHistoryProvider.GetByReferenceOrderIdReferenceOrderLineId(_referenceOrderId, _referenceOrderLineId, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #15
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Employee> GetSelectData(out int count)
        {
            Hashtable        values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable        customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Employee> results      = null;
            Employee         item;

            count = 0;

            System.String _loginId;
            System.String _nationalIdNumber;
            System.Guid   _rowguid;
            System.Int32? _managerId_nullable;
            System.Int32  _employeeId;
            System.Int32  _contactId;
            System.Int32  _addressId;

            switch (SelectMethod)
            {
            case EmployeeSelectMethod.Get:
                EmployeeKey entityKey = new EmployeeKey();
                entityKey.Load(values);
                item    = EmployeeProvider.Get(entityKey);
                results = new TList <Employee>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeeSelectMethod.GetAll:
                results = EmployeeProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case EmployeeSelectMethod.GetPaged:
                results = EmployeeProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case EmployeeSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = EmployeeProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = EmployeeProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case EmployeeSelectMethod.GetByEmployeeId:
                _employeeId = (values["EmployeeId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32)) : (int)0;
                item        = EmployeeProvider.GetByEmployeeId(_employeeId);
                results     = new TList <Employee>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case EmployeeSelectMethod.GetByLoginId:
                _loginId = (values["LoginId"] != null) ? (System.String)EntityUtil.ChangeType(values["LoginId"], typeof(System.String)) : string.Empty;
                item     = EmployeeProvider.GetByLoginId(_loginId);
                results  = new TList <Employee>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeeSelectMethod.GetByNationalIdNumber:
                _nationalIdNumber = (values["NationalIdNumber"] != null) ? (System.String)EntityUtil.ChangeType(values["NationalIdNumber"], typeof(System.String)) : string.Empty;
                item    = EmployeeProvider.GetByNationalIdNumber(_nationalIdNumber);
                results = new TList <Employee>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeeSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = EmployeeProvider.GetByRowguid(_rowguid);
                results  = new TList <Employee>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeeSelectMethod.GetByManagerId:
                _managerId_nullable = (System.Int32?)EntityUtil.ChangeType(values["ManagerId"], typeof(System.Int32?));
                results             = EmployeeProvider.GetByManagerId(_managerId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            case EmployeeSelectMethod.GetByContactId:
                _contactId = (values["ContactId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["ContactId"], typeof(System.Int32)) : (int)0;
                results    = EmployeeProvider.GetByContactId(_contactId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            case EmployeeSelectMethod.GetByAddressIdFromEmployeeAddress:
                _addressId = (values["AddressId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["AddressId"], typeof(System.Int32)) : (int)0;
                results    = EmployeeProvider.GetByAddressIdFromEmployeeAddress(_addressId, this.StartIndex, this.PageSize, out count);
                break;

            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #16
0
ファイル: SqlFilterParameter.cs プロジェクト: sinnerchen/mvc-
 /// <summary>
 /// 将参数的值转换为对应的系统数据类型的值
 /// </summary>
 public object GetValue()
 {
     return(EntityUtil.ChangeType(Value, SystemType));
 }
コード例 #17
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <StateProvince> GetSelectData(out int count)
        {
            Hashtable             values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable             customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <StateProvince> results      = null;
            StateProvince         item;

            count = 0;

            System.String _name;
            System.Guid   _rowguid;
            System.String _stateProvinceCode;
            System.String _countryRegionCode;
            System.Int32  _stateProvinceId;
            System.Int32  _territoryId;

            switch (SelectMethod)
            {
            case StateProvinceSelectMethod.Get:
                StateProvinceKey entityKey = new StateProvinceKey();
                entityKey.Load(values);
                item    = StateProvinceProvider.Get(entityKey);
                results = new TList <StateProvince>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case StateProvinceSelectMethod.GetAll:
                results = StateProvinceProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case StateProvinceSelectMethod.GetPaged:
                results = StateProvinceProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case StateProvinceSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = StateProvinceProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = StateProvinceProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case StateProvinceSelectMethod.GetByStateProvinceId:
                _stateProvinceId = (values["StateProvinceId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["StateProvinceId"], typeof(System.Int32)) : (int)0;
                item             = StateProvinceProvider.GetByStateProvinceId(_stateProvinceId);
                results          = new TList <StateProvince>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case StateProvinceSelectMethod.GetByName:
                _name   = (values["Name"] != null) ? (System.String)EntityUtil.ChangeType(values["Name"], typeof(System.String)) : string.Empty;
                item    = StateProvinceProvider.GetByName(_name);
                results = new TList <StateProvince>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case StateProvinceSelectMethod.GetByRowguid:
                _rowguid = (values["Rowguid"] != null) ? (System.Guid)EntityUtil.ChangeType(values["Rowguid"], typeof(System.Guid)) : Guid.Empty;
                item     = StateProvinceProvider.GetByRowguid(_rowguid);
                results  = new TList <StateProvince>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case StateProvinceSelectMethod.GetByStateProvinceCodeCountryRegionCode:
                _stateProvinceCode = (values["StateProvinceCode"] != null) ? (System.String)EntityUtil.ChangeType(values["StateProvinceCode"], typeof(System.String)) : string.Empty;
                _countryRegionCode = (values["CountryRegionCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CountryRegionCode"], typeof(System.String)) : string.Empty;
                item    = StateProvinceProvider.GetByStateProvinceCodeCountryRegionCode(_stateProvinceCode, _countryRegionCode);
                results = new TList <StateProvince>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // FK
            case StateProvinceSelectMethod.GetByCountryRegionCode:
                _countryRegionCode = (values["CountryRegionCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CountryRegionCode"], typeof(System.String)) : string.Empty;
                results            = StateProvinceProvider.GetByCountryRegionCode(_countryRegionCode, this.StartIndex, this.PageSize, out count);
                break;

            case StateProvinceSelectMethod.GetByTerritoryId:
                _territoryId = (values["TerritoryId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["TerritoryId"], typeof(System.Int32)) : (int)0;
                results      = StateProvinceProvider.GetByTerritoryId(_territoryId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #18
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <EmployeePayHistory> GetSelectData(out int count)
        {
            Hashtable values                   = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput             = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <EmployeePayHistory> results = null;
            EmployeePayHistory         item;

            count = 0;

            System.Int32    _employeeId;
            System.DateTime _rateChangeDate;

            switch (SelectMethod)
            {
            case EmployeePayHistorySelectMethod.Get:
                EmployeePayHistoryKey entityKey = new EmployeePayHistoryKey();
                entityKey.Load(values);
                item    = EmployeePayHistoryProvider.Get(entityKey);
                results = new TList <EmployeePayHistory>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case EmployeePayHistorySelectMethod.GetAll:
                results = EmployeePayHistoryProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case EmployeePayHistorySelectMethod.GetPaged:
                results = EmployeePayHistoryProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case EmployeePayHistorySelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = EmployeePayHistoryProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = EmployeePayHistoryProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case EmployeePayHistorySelectMethod.GetByEmployeeIdRateChangeDate:
                _employeeId     = (values["EmployeeId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32)) : (int)0;
                _rateChangeDate = (values["RateChangeDate"] != null) ? (System.DateTime)EntityUtil.ChangeType(values["RateChangeDate"], typeof(System.DateTime)) : DateTime.MinValue;
                item            = EmployeePayHistoryProvider.GetByEmployeeIdRateChangeDate(_employeeId, _rateChangeDate);
                results         = new TList <EmployeePayHistory>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            // FK
            case EmployeePayHistorySelectMethod.GetByEmployeeId:
                _employeeId = (values["EmployeeId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32)) : (int)0;
                results     = EmployeePayHistoryProvider.GetByEmployeeId(_employeeId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #19
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <CountryRegionCurrency> GetSelectData(out int count)
        {
            Hashtable values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <CountryRegionCurrency> results = null;
            CountryRegionCurrency         item;

            count = 0;

            System.String _currencyCode;
            System.String _countryRegionCode;

            switch (SelectMethod)
            {
            case CountryRegionCurrencySelectMethod.Get:
                CountryRegionCurrencyKey entityKey = new CountryRegionCurrencyKey();
                entityKey.Load(values);
                item    = CountryRegionCurrencyProvider.Get(entityKey);
                results = new TList <CountryRegionCurrency>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case CountryRegionCurrencySelectMethod.GetAll:
                results = CountryRegionCurrencyProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case CountryRegionCurrencySelectMethod.GetPaged:
                results = CountryRegionCurrencyProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case CountryRegionCurrencySelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = CountryRegionCurrencyProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = CountryRegionCurrencyProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case CountryRegionCurrencySelectMethod.GetByCountryRegionCodeCurrencyCode:
                _countryRegionCode = (values["CountryRegionCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CountryRegionCode"], typeof(System.String)) : string.Empty;
                _currencyCode      = (values["CurrencyCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CurrencyCode"], typeof(System.String)) : string.Empty;
                item    = CountryRegionCurrencyProvider.GetByCountryRegionCodeCurrencyCode(_countryRegionCode, _currencyCode);
                results = new TList <CountryRegionCurrency>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case CountryRegionCurrencySelectMethod.GetByCurrencyCode:
                _currencyCode = (values["CurrencyCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CurrencyCode"], typeof(System.String)) : string.Empty;
                results       = CountryRegionCurrencyProvider.GetByCurrencyCode(_currencyCode, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            case CountryRegionCurrencySelectMethod.GetByCountryRegionCode:
                _countryRegionCode = (values["CountryRegionCode"] != null) ? (System.String)EntityUtil.ChangeType(values["CountryRegionCode"], typeof(System.String)) : string.Empty;
                results            = CountryRegionCurrencyProvider.GetByCountryRegionCode(_countryRegionCode, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #20
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <Department> GetSelectData(out int count)
        {
            Hashtable          values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable          customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <Department> results      = null;
            Department         item;

            count = 0;

            System.String _name;
            System.Int16  _departmentId;

            switch (SelectMethod)
            {
            case DepartmentSelectMethod.Get:
                DepartmentKey entityKey = new DepartmentKey();
                entityKey.Load(values);
                item    = DepartmentProvider.Get(entityKey);
                results = new TList <Department>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case DepartmentSelectMethod.GetAll:
                results = DepartmentProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case DepartmentSelectMethod.GetPaged:
                results = DepartmentProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case DepartmentSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = DepartmentProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = DepartmentProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case DepartmentSelectMethod.GetByDepartmentId:
                _departmentId = (values["DepartmentId"] != null) ? (System.Int16)EntityUtil.ChangeType(values["DepartmentId"], typeof(System.Int16)) : (short)0;
                item          = DepartmentProvider.GetByDepartmentId(_departmentId);
                results       = new TList <Department>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case DepartmentSelectMethod.GetByName:
                _name   = (values["Name"] != null) ? (System.String)EntityUtil.ChangeType(values["Name"], typeof(System.String)) : string.Empty;
                item    = DepartmentProvider.GetByName(_name);
                results = new TList <Department>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // FK
            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #21
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <SalesOrderHeaderSalesReason> GetSelectData(out int count)
        {
            Hashtable values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <SalesOrderHeaderSalesReason> results = null;
            SalesOrderHeaderSalesReason         item;

            count = 0;

            System.Int32 _salesOrderId;
            System.Int32 _salesReasonId;

            switch (SelectMethod)
            {
            case SalesOrderHeaderSalesReasonSelectMethod.Get:
                SalesOrderHeaderSalesReasonKey entityKey = new SalesOrderHeaderSalesReasonKey();
                entityKey.Load(values);
                item    = SalesOrderHeaderSalesReasonProvider.Get(entityKey);
                results = new TList <SalesOrderHeaderSalesReason>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case SalesOrderHeaderSalesReasonSelectMethod.GetAll:
                results = SalesOrderHeaderSalesReasonProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case SalesOrderHeaderSalesReasonSelectMethod.GetPaged:
                results = SalesOrderHeaderSalesReasonProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case SalesOrderHeaderSalesReasonSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = SalesOrderHeaderSalesReasonProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = SalesOrderHeaderSalesReasonProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case SalesOrderHeaderSalesReasonSelectMethod.GetBySalesOrderIdSalesReasonId:
                _salesOrderId  = (values["SalesOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesOrderId"], typeof(System.Int32)) : (int)0;
                _salesReasonId = (values["SalesReasonId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesReasonId"], typeof(System.Int32)) : (int)0;
                item           = SalesOrderHeaderSalesReasonProvider.GetBySalesOrderIdSalesReasonId(_salesOrderId, _salesReasonId);
                results        = new TList <SalesOrderHeaderSalesReason>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            // FK
            case SalesOrderHeaderSalesReasonSelectMethod.GetBySalesOrderId:
                _salesOrderId = (values["SalesOrderId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesOrderId"], typeof(System.Int32)) : (int)0;
                results       = SalesOrderHeaderSalesReasonProvider.GetBySalesOrderId(_salesOrderId, this.StartIndex, this.PageSize, out count);
                break;

            case SalesOrderHeaderSalesReasonSelectMethod.GetBySalesReasonId:
                _salesReasonId = (values["SalesReasonId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["SalesReasonId"], typeof(System.Int32)) : (int)0;
                results        = SalesOrderHeaderSalesReasonProvider.GetBySalesReasonId(_salesReasonId, this.StartIndex, this.PageSize, out count);
                break;

            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }
コード例 #22
0
        /// <summary>
        /// Gets a collection of Entity objects based on the value of the SelectMethod property.
        /// </summary>
        /// <param name="count">The total number of rows in the DataSource.</param>
        /// <returns>A collection of Entity objects.</returns>
        protected override IList <JobCandidate> GetSelectData(out int count)
        {
            Hashtable            values       = CollectionsUtil.CreateCaseInsensitiveHashtable(GetParameterValues());
            Hashtable            customOutput = CollectionsUtil.CreateCaseInsensitiveHashtable();
            IList <JobCandidate> results      = null;
            JobCandidate         item;

            count = 0;

            System.Int32?_employeeId_nullable;
            System.Int32 _jobCandidateId;

            switch (SelectMethod)
            {
            case JobCandidateSelectMethod.Get:
                JobCandidateKey entityKey = new JobCandidateKey();
                entityKey.Load(values);
                item    = JobCandidateProvider.Get(entityKey);
                results = new TList <JobCandidate>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            case JobCandidateSelectMethod.GetAll:
                results = JobCandidateProvider.GetAll(StartIndex, PageSize, out count);
                break;

            case JobCandidateSelectMethod.GetPaged:
                results = JobCandidateProvider.GetPaged(WhereClause, OrderBy, PageIndex, PageSize, out count);
                break;

            case JobCandidateSelectMethod.Find:
                if (FilterParameters != null)
                {
                    results = JobCandidateProvider.Find(FilterParameters, OrderBy, StartIndex, PageSize, out count);
                }
                else
                {
                    results = JobCandidateProvider.Find(WhereClause, StartIndex, PageSize, out count);
                }
                break;

            // PK
            case JobCandidateSelectMethod.GetByJobCandidateId:
                _jobCandidateId = (values["JobCandidateId"] != null) ? (System.Int32)EntityUtil.ChangeType(values["JobCandidateId"], typeof(System.Int32)) : (int)0;
                item            = JobCandidateProvider.GetByJobCandidateId(_jobCandidateId);
                results         = new TList <JobCandidate>();
                if (item != null)
                {
                    results.Add(item);
                }
                count = results.Count;
                break;

            // IX
            case JobCandidateSelectMethod.GetByEmployeeId:
                _employeeId_nullable = (System.Int32?)EntityUtil.ChangeType(values["EmployeeId"], typeof(System.Int32?));
                results = JobCandidateProvider.GetByEmployeeId(_employeeId_nullable, this.StartIndex, this.PageSize, out count);
                break;

            // FK
            // M:M
            // Custom
            default:
                break;
            }

            if (results != null && count < 1)
            {
                count = results.Count;

                if (!String.IsNullOrEmpty(CustomMethodRecordCountParamName))
                {
                    object objCustomCount = EntityUtil.ChangeType(customOutput[CustomMethodRecordCountParamName], typeof(Int32));

                    if (objCustomCount != null)
                    {
                        count = (int)objCustomCount;
                    }
                }
            }

            return(results);
        }