Exemplo n.º 1
0
        public void UomQueryContainsWithUpperCase()
        {
            var u   = session.Load <Uom>(IntToGuid <Uom>(1));
            var res = UomQuery.Contains(session)(u.Abbr.ToUpper());

            Assert.IsTrue(res.Contains(u));
        }
Exemplo n.º 2
0
 public async Task <IEnumerable <Uom> > GetAllAsync()
 {
     using (var connection = context.CreateConnection())
     {
         return(await connection.QueryAsync <Uom>(UomQuery.All()));
     }
 }
Exemplo n.º 3
0
 public async Task DeleteAsync(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         await connection.ExecuteAsync(UomQuery.Delete(id));
     }
 }
Exemplo n.º 4
0
        public void UomQueryByAbbrAndType()
        {
            var u   = session.Load <Uom>(IntToGuid <Uom>(1));
            var res = UomQuery.ByAbbrDescrAndTypeName(session)(u.Abbr, u.Description, u.Type.Title);

            Assert.AreEqual(u, res);
        }
Exemplo n.º 5
0
        public async Task <Uom> GetByIdAsync(Guid id)
        {
            using (var connection = context.CreateConnection())
            {
                var query = await connection.QueryAsync <Uom>(UomQuery.ById(id));

                return(query.SingleOrDefault());
            }
        }
Exemplo n.º 6
0
        public async Task <Uom> UpdateAsync(Uom uom)
        {
            using (var connection = context.CreateConnection())
            {
                await connection.ExecuteAsync(UomQuery.Update(uom));

                return(uom);
            }
        }
Exemplo n.º 7
0
        public async Task <Uom> GetAsync(Guid id)
        {
            var query = new UomQuery {
                FilterIds = id.Collect()
            };

            // query.AsLazy();
            return((await _queryInvoker.Execute <UomQuery, Uom>(query)).SingleOrDefault());
        }
Exemplo n.º 8
0
        public Uom Create(Uom uom)
        {
            if (uom.Id == Guid.Empty)
            {
                uom.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(UomQuery.Insert(uom));
                return(uom);
            }
        }
Exemplo n.º 9
0
        public async Task <Uom> CreateAsync(Uom uom)
        {
            if (uom.Id == Guid.Empty)
            {
                uom.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                await connection.ExecuteAsync(UomQuery.Insert(uom));

                return(uom);
            }
        }
Exemplo n.º 10
0
        private List <Uom> LoadUoms(SearchOptionsDTO dto, ISession session, out bool uomsMissed)
        {
            var uomSpecs = dto.MeasuresAll
                           .Union(dto.MeasuresAny)
                           .Where(x => x.UomDescr != null)
                           .Select(x => new { Abbr = x.Abbr, Descr = x.UomDescr, TypeName = x.UomTypeTitle == null ? null : x.UomTypeTitle })
                           .Distinct()
                           .ToList();
            var uoms = uomSpecs
                       .Select(x => UomQuery.ByAbbrDescrAndTypeName(session)(x.Abbr, x.Descr, x.TypeName))
                       .Where(x => x != null)
                       .ToList();

            uomsMissed = uomSpecs.Count != uoms.Count;
            return(uoms);
        }
Exemplo n.º 11
0
        public async Task <IEnumerable <Uom> > GetAsync([FromQuery] string nameLike, [FromQuery] UomType?typeExact,
                                                        int?take, int?skip, string orderBy, string orderMode)
        {
            var query = new UomQuery
            {
                Take            = take,
                Skip            = skip,
                OrderBy         = orderBy,
                OrderMode       = orderMode,
                FilterNameLike  = nameLike,
                FilterTypeExact = typeExact
            };

            //  query.AsLazy();
            return(await _queryInvoker.Execute <UomQuery, Uom>(query));
        }
Exemplo n.º 12
0
        public MeasureEditorViewModel(Measure measure, Word w, bool withCompare)
        {
            this.withCompare = withCompare;

            _uoms = new List <Uom> {
                Uom.Null
            };
            var allUoms = UomQuery.Contains(Session)("");

            _uoms.AddRange(allUoms);

            var view = (ListCollectionView)CollectionViewSource.GetDefaultView(_uoms);

            view.GroupDescriptions.Add(new PropertyGroupDescription("Type"));

            Operator = MeasureOperator.Equal;

            SetupMeasure(measure, w);
            CreateAutocomplete();

            Title          = "Редактирование измерения";
            HelpTopic      = "editmeasure";
            WithHelpButton = false;
        }
Exemplo n.º 13
0
 private void CreateFilter()
 {
     _filter = new FilterViewModel <Uom>(UomQuery.Contains(Session));
 }