コード例 #1
0
        public async Task <HttpResponseMessage> Get(SupplierSearchFilter filter)
        {
            HttpResponseMessage response = null;

            if (filter != null)
            {
                var session = (Session)ContextOperator.Get(ContextKeys.SESSION_ID);
                filter.CompanyId = session.CompanyId;
                var collection = this._supplierService.Get(filter);
                response = Request.CreateResponse(HttpStatusCode.OK, new ResponseMessage <object>(true, "Succeeded", collection));
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.OK, new ResponseMessage <object>(false, MessageString.INVALID_REQUEST_PARMS, null));
            }
            return(await Task.Run(() => response));
        }
コード例 #2
0
        public IEnumerable <Supplier> Get(SupplierSearchFilter filter)
        {
            try
            {
                if (filter == null)
                {
                    throw new ArgumentNullException("filter");
                }

                if (string.IsNullOrEmpty(filter.CompanyId))
                {
                    throw new ArgumentNullException("CompanyId");
                }

                if (string.IsNullOrEmpty(filter.Keyword))
                {
                    filter.Keyword = "*";
                }

                if (filter.Take <= 0)
                {
                    filter.Take = 100;
                }

                var status = filter.Status != null ? filter.Status : (byte)StatusType.Active;

                Expression <Func <Supplier, bool> > predicate = x =>
                                                                x.CompanyId == filter.CompanyId && x.Status == status &&
                                                                (filter.Keyword == "*" || x.FirstName.StartsWith(filter.Keyword) || x.LastName.StartsWith(filter.Keyword) || x.MiddleName.StartsWith(filter.Keyword) || x.Company.StartsWith(filter.Keyword));

                return(this._supplierRepository.Find(predicate).Skip(filter.Start).Take(filter.Take).ToList());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #3
0
        public SupplierSearchViewModel()
        {
            FriendlyMessage = new List <FriendlyMessage>();

            SupplierSearch = new SupplierSearchInfo();

            SupplierSearchList = new List <SupplierSearchInfo>();

            SupplierList = new List <SupplierSearchInfo>();

            SupplierHotelList = new List <SupplierSearchInfo>();

            SupplierSearchRoomList = new List <SupplierSearchInfo>();

            SupplierSearchExtraList = new List <SupplierSearchInfo>();

            SupplierSearchExtraChildList = new List <SupplierSearchInfo>();

            SupplierSearchFilter = new SupplierSearchFilter();

            SupplierSearchFilterList = new List <SupplierSearchFilter>();

            SupplierHotelTariff = new SupplierHotelTariffInfo();

            SupplierHotelTariffs = new List <SupplierHotelTariffInfo>();



            Cities = new List <CityInfo>();

            Countries = new List <CountryInfo>();

            States = new List <StateInfo>();

            Pager = new PaginationInfo();
        }