Пример #1
0
        protected override void OpenLine(ReportLineViewModel sltdLine)
        {
            var windowManager = base.GetService <IWindowManager>();

            Predicate <ViewModelBase> predicate = (ViewModelBase wsvm) =>
            {
                if (!(wsvm is OfflineSaleViewModel))
                {
                    return(false);
                }

                OfflineSaleViewModel vm = (OfflineSaleViewModel)wsvm;

                return(vm.SaleId == sltdLine.LineId);
            };

            if (windowManager.Exists(predicate))
            {
                windowManager.Activate(predicate);
            }
            else
            {
                OfflineSaleViewModel vm = new OfflineSaleViewModel(appvm, sltdLine.LineId, OnRemove, null);
                windowManager.ShowChildWindow(vm, this);
            }
        }
        private static int GetSpanKey(ReportLineViewModel line)
        {
            int inMinutes = line.ServiceTime;

            if (inMinutes > 60)
            {
                inMinutes = 65;
            }

            int result = inMinutes == 0 ? 1 : (inMinutes - 1) / 5 + 1;

            return(result);
        }
Пример #3
0
        bool PassesFilter(ReportLineViewModel li)
        {
            //SEARCH TEXT
            if (!string.IsNullOrWhiteSpace(searchText))
            {
                string prefix = searchText.Trim();

                if (li.Product.Name.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) < 0)
                {
                    return(false);
                }
            }
            //TAGS
            if (selectedTag.Id != 0)
            {
                if (!li.TagIds.Contains(selectedTag.Id))
                {
                    return(false);
                }
            }
            //CATEGORY
            if (selectedCategory.Id != 0)
            {
                if (li.CategoryId == 0)
                {
                    return(false);
                }

                //travel up the category tree
                Category cat     = appvm.CategoriesOC.Single(x => x.Id == li.CategoryId);
                bool     success = false;
                do
                {
                    if (cat.Id == selectedCategory.Id)
                    {
                        success = true;
                        break;
                    }
                    cat = cat.ParentCategory;
                } while (cat != null);

                if (!success)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
 protected abstract void OpenLine(ReportLineViewModel sltdLine);
Пример #5
0
 protected override bool LiveFilter(ReportLineViewModel item)
 {
     return(TextCondition(item.Product.Name));
 }
Пример #6
0
 protected override bool LiveFilter(ReportLineViewModel item)
 {
     //no text search
     return(true);
 }
 protected override bool LiveFilter(ReportLineViewModel item)
 {
     //if (SelectedProductId == null) return false;
     return(item.Product.Id == SelectedProductId);
 }