Example #1
0
        protected void btnGoFindOrder_Click(object sender, EventArgs e)
        {
            lblFindOrderMessage.Text = string.Empty;

            var c = new OrderSearchCriteria();

            c.OrderNumber  = FindOrderNumberField.Text.Trim();
            c.IsPlaced     = true;
            c.StartDateUtc = DateTime.UtcNow.AddYears(-5);
            c.EndDateUtc   = DateTime.UtcNow.AddYears(1);

            var found = false;

            var totalCount = 0;
            var results    = HccApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 10, ref totalCount);

            if (results != null)
            {
                if (results.Count > 0)
                {
                    found = true;
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = HccApp.MembershipServices.Customers.Find(results[0].UserID);
                    UserSelected(args);
                }
            }

            if (!found)
            {
                lblFindOrderMessage.Text = "<span class=\"errormessage\">That order was not found</span>";
            }
        }
Example #2
0
        public List <Order> SearchingOrder(OrderSearchCriteria productionRequestSearchCriteria)
        {
            List <Order> orders = OnGetItems <Order>();

            if (productionRequestSearchCriteria != null)
            {
                if (productionRequestSearchCriteria.CreatedBy.HasValue)
                {
                    orders = orders.Where(pr => pr.UserId == productionRequestSearchCriteria.CreatedBy.Value).ToList();
                }
                if (productionRequestSearchCriteria.Customer.HasValue)
                {
                    orders = orders.Where(pr => pr.CustId == productionRequestSearchCriteria.Customer.Value).ToList();
                }
                if (productionRequestSearchCriteria.Code != "")
                {
                    orders = orders.Where(pr => pr.OrderCode.ToLower().Contains(productionRequestSearchCriteria.Code)).ToList();
                }
                if (productionRequestSearchCriteria.To.HasValue && productionRequestSearchCriteria.From.HasValue)
                {
                    orders = orders.
                             Where(pr => pr.CreatedDate.CompareTo(productionRequestSearchCriteria.From.Value) >= 0 &&
                                   pr.CreatedDate.CompareTo(productionRequestSearchCriteria.To.Value) <= 0)
                             .ToList();
                }
            }
            return(orders);
        }
Example #3
0
        public static IQueryable <Order> ThatMatch(this IQueryable <Order> orders, OrderSearchCriteria criteria)
        {
            orders = orders.Where(x => x.OrderStatus.Id > 0);             //Exclude 'Pending'

            if (criteria.OrderId != 0)
            {
                orders = orders.Where(o => o.Id == criteria.OrderId);
            }
            if (!string.IsNullOrEmpty(criteria.Email))
            {
                orders = orders.Where(o => o.Email == criteria.Email);
            }
            if (!string.IsNullOrEmpty(criteria.Postcode))
            {
                orders = orders.Where(o => o.CardContact.Postcode == criteria.Postcode);
            }
            if (!string.IsNullOrEmpty(criteria.Lastname))
            {
                orders = orders.Where(o => o.CardContact.Lastname == criteria.Lastname);
            }
            if (criteria.OrderStatusId != 0)
            {
                orders = orders.Where(o => o.OrderStatus.Id == criteria.OrderStatusId);
            }
            return(orders);
        }
        protected void btnGoFindOrder_Click(object sender, EventArgs e)
        {
            lblFindOrderMessage.Text = string.Empty;

            var c = new OrderSearchCriteria();

            c.OrderNumber  = FindOrderNumberField.Text.Trim();
            c.IsPlaced     = true;
            c.StartDateUtc = DateTime.UtcNow.AddYears(-5);
            c.EndDateUtc   = DateTime.UtcNow.AddYears(1);

            var found = false;

            var totalCount = 0;
            var results    = HccApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 10, ref totalCount);

            if (results != null)
            {
                if (results.Count > 0)
                {
                    found = true;
                    var args = new UserSelectedEventArgs();
                    args.UserAccount = HccApp.MembershipServices.Customers.Find(results[0].UserID);
                    UserSelected(args);
                }
            }

            if (!found)
            {
                lblFindOrderMessage.Text = string.Format(ERRORFORMAT, Localization.GetString("NoOrder"));
            }
        }
Example #5
0
        /// <summary>
        /// All pertinent data other than the Profiles gets copied from otherPatient to thisPatient
        /// </summary>
        /// <param name="thisPatient"></param>
        /// <param name="otherPatient"></param>
        /// <param name="context"></param>
        static private void ReconnectRelatedPatientInformation(Patient thisPatient, Patient otherPatient, IPersistenceContext context)
        {
            foreach (PatientNote note in otherPatient.Notes)
            {
                thisPatient.AddNote(note);
            }

            OrderSearchCriteria orderCriteria = new OrderSearchCriteria();

            orderCriteria.Patient.EqualTo(otherPatient);
            IList <Order> otherOrders = context.GetBroker <IOrderBroker>().Find(orderCriteria);

            foreach (Order order in otherOrders)
            {
                order.Patient = thisPatient;
            }

            VisitSearchCriteria visitCriteria = new VisitSearchCriteria();

            visitCriteria.Patient.EqualTo(otherPatient);
            IList <Visit> otherVisits = context.GetBroker <IVisitBroker>().Find(visitCriteria);

            foreach (Visit visit in otherVisits)
            {
                visit.Patient = thisPatient;
            }

            // TODO: delete the otherPatient
        }
        public PagedList <Order> SearchOrders(OrderSearchCriteria criteria)
        {
            var query = _orderRepository.Table;

            if (criteria.StartDate.HasValue)
            {
                var dateBegin = criteria.StartDate.Value.BeginOfDay();
                query = query.Where(i => i.FADateTime >= dateBegin);
            }

            if (criteria.EndDate.HasValue)
            {
                var dateEnd = criteria.EndDate.Value.EndOfDay();
                query = query.Where(i => i.FADateTime <= dateEnd);
            }

            if (string.IsNullOrEmpty(criteria.OrderNumber))
            {
                query = query.Where(i => i.OrderNumber == criteria.OrderNumber);
            }
            query = query.OrderByDescending(i => i.Id);

            var result = new PagedList <Order>(query, criteria.PagingRequest.PageIndex, criteria.PagingRequest.PageSize);

            return(result);
        }
Example #7
0
        //Get: /Order  订单管理
        public ActionResult Order()
        {
            ViewBag.txtGroupId = SuperMan.App_Start.UserContext.Current.GroupId;//集团id


            int UserType = UserContext.Current.AccountType == 1 ? 0 : UserContext.Current.Id;//如果管理后台的类型是所有权限就传0,否则传管理后台id

            ViewBag.openCityList = iAreaProvider.GetOpenCityOfSingleCity(ParseHelper.ToInt(UserType));
            var superManModel = iDistributionProvider.GetClienterModelByGroupID(ViewBag.txtGroupId);

            if (superManModel != null)
            {
                ViewBag.superManModel = superManModel;
            }
            var criteria = new OrderSearchCriteria()
            {
                orderStatus = -1,
                //GroupId = UserContext.Current.GroupId,
                AuthorityCityNameListStr = iAreaProvider.GetAuthorityCityNameListStr(UserType)
            };

            if (UserType > 0 && string.IsNullOrWhiteSpace(criteria.AuthorityCityNameListStr))
            {
                return(View());
            }
            var pagedList = iOrderProvider.GetOrders(criteria);

            return(View(pagedList));
        }
        public static IQueryable<Order> ThatMatch(this IQueryable<Order> orders, OrderSearchCriteria criteria)
        {

			orders = orders.Where(x => x.OrderStatus.Id > 0); //Exclude 'Pending'

            if (criteria.OrderId != 0)
            {
                orders = orders.Where(o => o.Id == criteria.OrderId);
            }
            if (!string.IsNullOrEmpty(criteria.Email))
            {
                orders = orders.Where(o => o.Email == criteria.Email);
            }
            if (!string.IsNullOrEmpty(criteria.Postcode))
            {
                orders = orders.Where(o => o.CardContact.Postcode == criteria.Postcode);
            }
            if (!string.IsNullOrEmpty(criteria.Lastname))
            {
                orders = orders.Where(o => o.CardContact.Lastname == criteria.Lastname);
            }
            if (criteria.OrderStatusId != 0)
            {
                orders = orders.Where(o => o.OrderStatus.Id == criteria.OrderStatusId);
            }
            return orders;
        }
Example #9
0
        void LoadData()
        {
            try
            {
                TotalSub   = 0;
                TotalCount = 0;

                OrderSearchCriteria c = new OrderSearchCriteria();
                c.IsPlaced       = false;
                c.SortDescending = true;

                List <OrderSnapshot> found = new List <OrderSnapshot>();
                int totalCarts             = 0;
                found = HccApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 1000, ref totalCarts);

                TotalCount = found.Count;

                foreach (OrderSnapshot o in found)
                {
                    TotalSub += o.TotalOrderBeforeDiscounts;
                }

                dgList.DataSource = found;
                dgList.DataBind();
            }

            catch (Exception Ex)
            {
                msg.ShowException(Ex);
                EventLog.LogEvent(Ex);
            }
        }
Example #10
0
		/// <summary>
		/// All pertinent data other than the Profiles gets copied from otherPatient to thisPatient
		/// </summary>
		/// <param name="thisPatient"></param>
		/// <param name="otherPatient"></param>
		/// <param name="context"></param>
		static private void ReconnectRelatedPatientInformation(Patient thisPatient, Patient otherPatient, IPersistenceContext context)
		{
			foreach (PatientNote note in otherPatient.Notes)
			{
				thisPatient.AddNote(note);
			}

			OrderSearchCriteria orderCriteria = new OrderSearchCriteria();
			orderCriteria.Patient.EqualTo(otherPatient);
			IList<Order> otherOrders = context.GetBroker<IOrderBroker>().Find(orderCriteria);
			foreach (Order order in otherOrders)
			{
				order.Patient = thisPatient;
			}

			VisitSearchCriteria visitCriteria = new VisitSearchCriteria();
			visitCriteria.Patient.EqualTo(otherPatient);
			IList<Visit> otherVisits = context.GetBroker<IVisitBroker>().Find(visitCriteria);
			foreach (Visit visit in otherVisits)
			{
				visit.Patient = thisPatient;
			}

			// TODO: delete the otherPatient
		}
        protected Order GetOrder(LogicalHL7EventArgs item)
        {
            var criteria = new OrderSearchCriteria();

            criteria.OID.EqualTo(item.OrderOID);
            return(PersistenceScope.CurrentContext.GetBroker <IOrderBroker>().FindOne(criteria));
        }
        private static List <OrderNote> CreateReplaceDestinationNotes(Order order, IPersistenceContext context)
        {
            var where = new OrderSearchCriteria();
            where.CancelInfo.ReplacementOrder.EqualTo(order);

            // expect 0 or 1 results
            var replacedOrder = CollectionUtils.FirstElement(context.GetBroker <IOrderBroker>().Find(where));

            if (replacedOrder == null)
            {
                return(new List <OrderNote>());
            }

            var text = string.Format(SR.OrderNoteOrderReplacedBy, replacedOrder.AccessionNumber);
            var note = OrderNote.CreateVirtualNote(
                order,
                OrderNote.Categories.General,
                replacedOrder.CancelInfo.CancelledBy,
                text,
                replacedOrder.EndTime.Value);

            return(new List <OrderNote> {
                note
            });
        }
        protected void btnGoFindOrder_Click(object sender, System.EventArgs e)
        {
            this.lblFindOrderMessage.Text = string.Empty;

            OrderSearchCriteria c = new OrderSearchCriteria();

            c.OrderNumber  = this.FindOrderNumberField.Text.Trim();
            c.IsPlaced     = true;
            c.StartDateUtc = DateTime.UtcNow.AddYears(-5);
            c.EndDateUtc   = DateTime.UtcNow.AddYears(1);

            bool found = false;

            int totalCount = 0;
            List <OrderSnapshot> results = MTApp.OrderServices.Orders.FindByCriteriaPaged(c, 1, 10, ref totalCount);

            if (results != null)
            {
                if (results.Count > 0)
                {
                    found = true;
                    MerchantTribe.Commerce.Controls.UserSelectedEventArgs args = new MerchantTribe.Commerce.Controls.UserSelectedEventArgs();
                    args.UserAccount = MTApp.MembershipServices.Customers.Find(results[0].UserID);
                    this.UserSelected(args);
                }
            }

            if (!found)
            {
                this.lblFindOrderMessage.Text = "<span class=\"errormessage\">That order was not found</span>";
            }
        }
Example #14
0
        public ActionResult PostOrder(int pageindex = 1)
        {
            ViewBag.txtGroupId = SuperMan.App_Start.UserContext.Current.GroupId;;             //集团id
            int UserType = UserContext.Current.AccountType == 1 ? 0 : UserContext.Current.Id; //如果管理后台的类型是所有权限就传0,否则传管理后台id

            ViewBag.openCityList = iAreaProvider.GetOpenCityOfSingleCity(ParseHelper.ToInt(UserType));
            var criteria = new OrderSearchCriteria();

            TryUpdateModel(criteria);
            criteria.AuthorityCityNameListStr =
                iAreaProvider.GetAuthorityCityNameListStr(UserType);
            //指派超人时  以下代码 有用,现在 注释掉  wc
            //var superManModel = iDistributionProvider.GetClienterModelByGroupID(ViewBag.txtGroupId);
            //if (superManModel != null)
            //{
            //    ViewBag.superManModel = superManModel;
            //}
            if (UserType > 0 && string.IsNullOrWhiteSpace(criteria.AuthorityCityNameListStr))
            {
                return(PartialView("_PartialOrderList"));
            }
            var pagedList = iOrderProvider.GetOrders(criteria);

            return(PartialView("_PartialOrderList", pagedList));
        }
Example #15
0
        public Page <BuyOrderLiteDto> SearchCreatedOrders(OrderSearchCriteria searchCriteria)
        {
            var ordersQuery = Repository.Query(x => x.Status == BuyOrderStatus.Created);

            if (!String.IsNullOrEmpty(searchCriteria.OrderNumber))
            {
                ordersQuery = ordersQuery.Where(x => x.OrderNumber != null && x.OrderNumber.Contains(searchCriteria.OrderNumber));
            }
            var totalCount = ordersQuery.Count();
            var orders     = ordersQuery
                             .Skip((searchCriteria.PageIndex - 1) * searchCriteria.PageSize)
                             .Take(searchCriteria.PageSize).ToList();

            var movieIds  = orders.Select(x => x.MovieId).ToList();
            var movies    = _movieRepository.Query(x => movieIds.Contains(x.Id)).ToList();
            var ordersDto = MapCollection <BuyOrder, BuyOrderLiteDto>(orders);

            foreach (var order in ordersDto)
            {
                var movie = movies.FirstOrDefault(x => x.Id == order.MovieId);
                order.MovieName = movie != null ? movie.Name : null;
            }

            return(new Page <BuyOrderLiteDto>(searchCriteria.PageIndex, searchCriteria.PageSize, totalCount, ordersDto));
        }
Example #16
0
        private void lnkExportToQuickbooks_Click(object sender, EventArgs e)
        {
            var criteria = new OrderSearchCriteria
            {
                IsPlaced   = true,
                StatusCode = lstStatus.SelectedValue
            };

            if (lstPaymentStatus.SelectedValue != string.Empty)
            {
                criteria.PaymentStatus = (OrderPaymentStatus)int.Parse(lstPaymentStatus.SelectedValue);
            }
            if (lstShippingStatus.SelectedValue != string.Empty)
            {
                criteria.ShippingStatus = (OrderShippingStatus)int.Parse(lstShippingStatus.SelectedValue);
            }
            criteria.StartDateUtc           = DateRangePicker1.StartDate.ToUniversalTime();
            criteria.EndDateUtc             = DateRangePicker1.EndDate.ToUniversalTime();
            criteria.Keyword                = FilterField.Text.Trim();
            criteria.SortDescending         = chkNewestFirst.Checked;
            criteria.IsIncludeCanceledOrder = true;

            var pageSize   = int.MaxValue;
            var totalCount = 0;

            var orders       = HccApp.OrderServices.Orders.FindByCriteriaPaged(criteria, 1, pageSize, ref totalCount);
            var ordersExport = new QuickbooksOrdersExport(HccApp);

            ordersExport.ExportToQuickbooks(Response, "Hotcakes_Orders.iif", orders);
        }
        public static void AcceptAllNewOrders(OrderService svc)
        {
            var criteria = new OrderSearchCriteria();

            criteria.IsPlaced   = true;
            criteria.StatusCode = OrderStatusCode.Received;
            var pageSize   = 1000;
            var totalCount = 0;

            var orders = svc.Orders.FindByCriteriaPaged(criteria, 1, pageSize, ref totalCount);

            if (orders != null)
            {
                foreach (var o in orders)
                {
                    var ord = svc.Orders.FindForCurrentStore(o.bvin);
                    if (ord != null)
                    {
                        ord.StatusCode = OrderStatusCode.ReadyForPayment;
                        ord.StatusName = "Ready for Payment";
                        svc.Orders.Update(ord);
                    }
                }
            }
        }
Example #18
0
        public static Task WithUserOrdersAsync(this IWorkContextBuilder builder)
        {
            if (builder.WorkContext.CurrentUser != null)
            {
                var serviceProvider = builder.HttpContext.RequestServices;
                var orderService    = serviceProvider.GetRequiredService <ICustomerOrderService>();

                Func <int, int, IEnumerable <SortInfo>, NameValueCollection, IPagedList <CustomerOrder> > factory = (pageNumber, pageSize, sortInfos, @params) =>
                {
                    var orderSearchcriteria = new OrderSearchCriteria
                    {
                        CustomerId = builder.WorkContext.CurrentUser.Id,
                        PageNumber = pageNumber,
                        PageSize   = pageSize,
                        Sort       = sortInfos?.ToString()
                    };
                    if (@params != null)
                    {
                        orderSearchcriteria.CopyFrom(@params);
                    }
                    var result = orderService.SearchOrders(orderSearchcriteria);
                    return(new StaticPagedList <CustomerOrder>(result, pageNumber, pageSize, result.Count));
                };
                return(builder.WithUserOrdersAsync(new MutablePagedList <CustomerOrder>(factory, 1, OrderSearchCriteria.DefaultPageSize)));
            }
            return(Task.CompletedTask);
        }
        public async Task <ActionResult <CustomerOrderSearchResult> > SearchCustomerOrders([FromBody] OrderSearchCriteria criteria)
        {
            if (criteria == null)
            {
                criteria = new OrderSearchCriteria();
            }
            var authorizationResult = await _authorizationService.AuthorizeAsync(User, null, SecurityConstants.Permissions.CanViewOrders);

            if (!authorizationResult.Succeeded)
            {
                //Does not allow to see a other customer orders
                criteria.CustomerId = WorkContext.CurrentUser.Id;
            }
            var result = await _orderApi.SearchCustomerOrderAsync(criteria.ToSearchCriteriaDto());

            var orders = result.Results.Select(x => x.ToCustomerOrder(WorkContext.AllCurrencies, WorkContext.CurrentLanguage)).ToArray();
            await _orderService.LoadProductsAsync(orders);

            _orderService.SelectConfiguredProductParts(orders);

            return(new CustomerOrderSearchResult
            {
                Results = orders,
                TotalCount = result.TotalCount ?? default(int),
            });
        }
 public List <Execl_OrderDetailDto> GetOrderDetail(OrderSearchCriteria csc)
 {
     using (var db = base.NewDB())
     {
         var data = db.Orders.AsQueryable();
         if (csc.StarTime != null)
         {
             data = data.Where(c => c.CreatedTime >= csc.StarTime);
         }
         if (csc.EndTime != null)
         {
             data = data.Where(c => c.CreatedTime <= csc.EndTime);
         }
         if (!string.IsNullOrEmpty(csc.Search))
         {
             data = data.Where(c => c.OrderNum.Contains(csc.Search));
         }
         return((from o in data
                 from od in db.OrderDetails
                 where o.Id == od.OrderId
                 select new Execl_OrderDetailDto
         {
             Remark = o.Remark,
             Money = o.Money,
             OrderNum = o.OrderNum,
             PhoneNum = o.PhoneNum,
             Count = od.Count,
             CDName = od.CDName,
             BuyerName = o.BuyerName,
             DeliveryAddress = o.DeliveryAddress,
             DeliveryTime = o.DeliveryTime
         }).ToList());
     }
 }
Example #21
0
        // Searching
        private void FindOrders(int pageNumber)
        {
            OrderSearchCriteria criteria = new OrderSearchCriteria();

            criteria.IsPlaced   = true;
            criteria.StatusCode = this.lstStatus.SelectedValue;
            if (this.lstPaymentStatus.SelectedValue != string.Empty)
            {
                criteria.PaymentStatus = (OrderPaymentStatus)(int.Parse(this.lstPaymentStatus.SelectedValue));
            }
            if (this.lstShippingStatus.SelectedValue != string.Empty)
            {
                criteria.ShippingStatus = (OrderShippingStatus)(int.Parse(this.lstShippingStatus.SelectedValue));
            }
            criteria.StartDateUtc   = this.DateRangePicker1.StartDate.ToUniversalTime();
            criteria.EndDateUtc     = this.DateRangePicker1.EndDate.ToUniversalTime();
            criteria.Keyword        = this.FilterField.Text.Trim();
            criteria.SortDescending = this.chkNewestFirst.Checked;

            int pageSize   = 20;
            int totalCount = 0;

            List <OrderSnapshot> orders = MTApp.OrderServices.Orders.FindByCriteriaPaged(criteria, pageNumber, pageSize, ref totalCount);

            RenderOrders(orders);

            this.litPager.Text  = MerchantTribe.Web.Paging.RenderPager(Page.ResolveUrl("~/bvadmin/orders/default.aspx?p={0}"), pageNumber, totalCount, pageSize);
            this.litPager2.Text = this.litPager.Text;

            SaveSessionKeys(pageNumber);
            ShowCorrectBatchButtons(criteria.StatusCode);
        }
Example #22
0
 public OrderModel(IDomainContext domainContext)
 {
     DomainContext = domainContext;
     SearchCriteria = new OrderSearchCriteria(domainContext.ConvertService);
     Entities = new ObservableCollection<OrderItem>();
     SelectEntities();
 }
Example #23
0
        public long CountByResultRecipient(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria)
        {
            var query = GetBaseResultRecipientQuery(orderSearchCriteria, recipientSearchCriteria);

            query.Selects.Add(new HqlSelect("count(*)"));
            return(ExecuteHqlUnique <long>(query));
        }
Example #24
0
        public IList <Order> FindByResultRecipient(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria, SearchResultPage page)
        {
            var query = GetBaseResultRecipientQuery(orderSearchCriteria, recipientSearchCriteria);

            query.Page = page;
            return(ExecuteHql <Order>(query));
        }
        public void OnGet([FromQuery] OrderSearchCriteria searchCriteria)
        {
            PageIndex   = searchCriteria.PageIndex;
            PageSize    = searchCriteria.PageSize;
            OrderNumber = searchCriteria.OrderNumber;

            BuyOrders = _buyOrderService.SearchCreatedOrders(searchCriteria);
        }
Example #26
0
        /// <summary>
        /// Counts the number of orders for given search criteria
        /// </summary>
        /// <param name="criteria">The search criteria for orders to search</param>
        /// <returns>The number of orders for given search criteria</returns>
        public static int SearchCount(OrderSearchCriteria criteria)
        {
            //COUNT ORDER IDS THAT FIT THE CRITERIA
            Database  database     = Token.Instance.Database;
            DbCommand countCommand = criteria.BuildSelectCommand(string.Empty, true);

            return(AlwaysConvert.ToInt(database.ExecuteScalar(countCommand)));
        }
        public IEnumerable <Order> Get2(OrderSearchCriteria searchCriteria)
        {
            var query = from p in context.Orders
                        where p.Status == searchCriteria.Status
                        orderby p.OrderDate, p.OrderNumber
            select p;

            return(query.ToList());
        }
Example #28
0
        private static IList <Order> GetOrderBatchByOrderingPractitioner(ExternalPractitioner practitioner, Action <OrderSearchCriteria> priorityFilter, int batchSize, IPersistenceContext context)
        {
            var ordersWhere = new OrderSearchCriteria();

            priorityFilter(ordersWhere);

            ordersWhere.OrderingPractitioner.EqualTo(practitioner);
            return(context.GetBroker <IOrderBroker>().Find(ordersWhere, new SearchResultPage(0, batchSize)));
        }
Example #29
0
		private static HqlProjectionQuery GetBaseResultRecipientQuery(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria)
		{
			var hqlFrom = new HqlFrom(typeof(Order).Name, "o");
			hqlFrom.Joins.Add(new HqlJoin("o.ResultRecipients", "rr"));

			var query = new HqlProjectionQuery(hqlFrom);
			query.Conditions.AddRange(HqlCondition.FromSearchCriteria("rr", recipientSearchCriteria));
			query.Conditions.AddRange(HqlCondition.FromSearchCriteria("o", orderSearchCriteria));
			return query;
		}
Example #30
0
        public PagedList <Order> PerformSearch(OrderSearchCriteria criteria)
        {
            var orders = orderRepository
                         .GetAll()
                         .ThatMatch(criteria)
                         .ByCreatedDate()
                         .ToPagedList(httpContextService.FormOrQuerystring.PageNumber(), 20);

            return(orders);
        }
Example #31
0
        public ActionResult Index(OrderSearchCriteria orderSearchCriteria)
        {
            orderSearchCriteria = orderSearchCriteria ?? new OrderSearchCriteria();
            var orders = searchService.PerformSearch(orderSearchCriteria);

            return(View("Index", ShopView.Data
                        .WithOrders(orders)
                        .WithOrderStatuses(OrderStatuses())
                        .WithOrderSearchCriteria(orderSearchCriteria)));
        }
		public PagedList<Order> PerformSearch(OrderSearchCriteria criteria)
		{
			var orders = orderRepository
				.GetAll()
				.ThatMatch(criteria)
				.ByCreatedDate()
				.ToPagedList(httpContextService.FormOrQuerystring.PageNumber(), 20);

			return orders;
		}
        public ActionResult Index(OrderSearchCriteria orderSearchCriteria)
        {
			orderSearchCriteria = orderSearchCriteria ?? new OrderSearchCriteria();
			var orders = searchService.PerformSearch(orderSearchCriteria);

            return View("Index", ShopView.Data
                .WithOrders(orders)
				.WithOrderStatuses(OrderStatuses())
                .WithOrderSearchCriteria(orderSearchCriteria));
        }
Example #34
0
        /// <summary>
        /// Applies this filter to the specified criteria object.
        /// </summary>
        /// <param name="criteria"></param>
        /// <param name="wqc"></param>
        public void Apply(OrderSearchCriteria criteria, IWorklistQueryContext wqc)
        {
            if (!this.IsEnabled)
            {
                return;
            }

            criteria.Priority.In(
                CollectionUtils.Map(this.Values,
                                    (OrderPriorityEnum v) => (OrderPriority)Enum.Parse(typeof(OrderPriority), v.Code)));
        }
Example #35
0
        private int GetOrdersCount(DateRange range, string status)
        {
            var criteria = new OrderSearchCriteria
            {
                StartDateUtc = range.StartDate,
                EndDateUtc   = range.EndDate,
                StatusCode   = status
            };

            return(HccApp.OrderServices.Orders.CountByCriteria(criteria));
        }
Example #36
0
		/// <summary>
		/// The specified visit and its associated orders get moved from otherPatient to thisPatient
		/// </summary>
		/// <param name="thisPatient"></param>
		/// <param name="otherPatient"></param>
		/// <param name="visit"></param>
		/// <param name="context"></param>
		static public void MoveVisit(Patient thisPatient, Patient otherPatient, Visit visit, IPersistenceContext context)
		{
			var orderCriteria = new OrderSearchCriteria();
			orderCriteria.Visit.EqualTo(visit);
			var visitOrders = context.GetBroker<IOrderBroker>().Find(orderCriteria);
			foreach (var order in visitOrders)
			{
				order.Patient = thisPatient;
			}

			visit.Patient = thisPatient;
		}
Example #37
0
		public ListOrdersForPatientResponse ListActiveOrdersForPatient(ListOrdersForPatientRequest request)
		{
			var criteria = new OrderSearchCriteria();

			var profile = this.PersistenceContext.Load<PatientProfile>(request.PatientProfileRef);
			criteria.Patient.EqualTo(profile.Patient);
			criteria.Status.In(new[] { OrderStatus.SC, OrderStatus.IP });

			var assembler = new OrderAssembler();
			return new ListOrdersForPatientResponse(
				CollectionUtils.Map<Order, OrderSummary, List<OrderSummary>>(
					this.PersistenceContext.GetBroker<IOrderBroker>().Find(criteria),
					order => assembler.CreateOrderSummary(order, this.PersistenceContext)));
		}
Example #38
0
		public static void All(OrderSearchCriteria ordersWhere)
		{
			// no filters
		}
Example #39
0
			/// <summary>
			/// Reconciles the specified patient to this patient
			/// </summary>
			/// <param name="thisPatient"></param>
			/// <param name="otherPatient"></param>
			/// <param name="workflow"></param>
			private static void Reconcile(Patient thisPatient, Patient otherPatient, IWorkflow workflow)
			{
				if (PatientIdentifierConflictsFound(thisPatient, otherPatient))
					throw new PatientReconciliationException("assigning authority conflict - cannot reconcile");

				// copy the collection to iterate
				var otherProfiles = new List<PatientProfile>(otherPatient.Profiles);
				foreach (var profile in otherProfiles)
				{
					thisPatient.AddProfile(profile);
				}

				// copy the collection to iterate
				var otherNotes = new List<PatientNote>(otherPatient.Notes);
				foreach (var note in otherNotes)
				{
					thisPatient.AddNote(note);
				}

				// copy the collection to iterate
				var otherAttachments = new List<PatientAttachment>(otherPatient.Attachments);
				foreach (var attachment in otherAttachments)
				{
					otherPatient.Attachments.Remove(attachment);
					thisPatient.Attachments.Add(attachment);
				}

				// copy the collection to iterate
				var otherAllergies = new List<Allergy>(otherPatient.Allergies);
				foreach (var allergy in otherAllergies)
				{
					otherPatient.Allergies.Remove(allergy);
					thisPatient.Allergies.Add(allergy);
				}

				var visitCriteria = new VisitSearchCriteria();
				visitCriteria.Patient.EqualTo(otherPatient);
				var otherVisits = workflow.GetBroker<IVisitBroker>().Find(visitCriteria);
				foreach (var visit in otherVisits)
				{
					visit.Patient = thisPatient;
				}

				var orderCriteria = new OrderSearchCriteria();
				orderCriteria.Patient.EqualTo(otherPatient);
				var otherOrders = workflow.GetBroker<IOrderBroker>().Find(orderCriteria);
				foreach (var order in otherOrders)
				{
					order.Patient = thisPatient;
				}
			}
        public void Index_ShouldBuildCriteriaAndExecuteSearch()
        {
			var criteria = new OrderSearchCriteria();
        	var results = new PagedList<Order>(new List<Order>(), 1, 1);
			searchService.Expect(x => x.PerformSearch(criteria)).Return(results);

			orderController.Index(criteria)
				.ReturnsViewResult()
				.ForView("Index")
				.WithModel<ShopViewData>()
				.AssertAreSame(criteria, vd => vd.OrderSearchCriteria)
				.AssertAreSame(results, vd => vd.Orders);

        }
Example #41
0
		public long CountByResultRecipient(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria)
		{
			var query = GetBaseResultRecipientQuery(orderSearchCriteria, recipientSearchCriteria);
			query.Selects.Add(new HqlSelect("count(*)"));
			return ExecuteHqlUnique<long>(query);
		}
Example #42
0
		public static void CompletedRecently(OrderSearchCriteria ordersWhere)
		{
			ordersWhere.Status.EqualTo(OrderStatus.CM);
			ordersWhere.EndTime.MoreThan(Platform.Time.AddDays(-30)); //TODO: define recently
		}
Example #43
0
		public IList<Order> FindByResultRecipient(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria, SearchResultPage page)
		{
			var query = GetBaseResultRecipientQuery(orderSearchCriteria, recipientSearchCriteria);
			query.Page = page;
			return ExecuteHql<Order>(query);
		}
Example #44
0
		public IList<Order> FindByResultRecipient(OrderSearchCriteria orderSearchCriteria, ResultRecipientSearchCriteria recipientSearchCriteria)
		{
			return FindByResultRecipient(orderSearchCriteria, recipientSearchCriteria, new SearchResultPage());
		}
Example #45
0
		public static void InProgress(OrderSearchCriteria ordersWhere)
		{
			ordersWhere.Status.EqualTo(OrderStatus.IP);
		}
Example #46
0
 public ShopViewData WithOrderSearchCriteria(OrderSearchCriteria orderSearchCriteria)
 {
     this.OrderSearchCriteria = orderSearchCriteria;
     return this;
 }
Example #47
0
		public static void Scheduled(OrderSearchCriteria ordersWhere)
		{
			ordersWhere.Status.EqualTo(OrderStatus.SC);
		}