예제 #1
0
        void DoSave(object parameter)
        {
            var ctl = parameter as ContentControl;
            var o   = ctl.Content as BaseObjDto;

            if (o.Id == 0)
            {
                BaseObj objNew = null;
                objNew = ObjFromDto(o, objNew);
                _bll.Add(objNew);
            }
            else
            {
                var objExisting = _bll.GetItemById(o.Id);
                ModuleAModule.TheMapper.Map(o, objExisting);
            }
            _bll.Flush();

            _bll = _container.Resolve <IBLL>(new ResolverOverride[]
            {
                new ParameterOverride("filePath", StoragePath)
            });
            var lst = _bll.GetFiltered("", 10, _currentOffset);

            PopulateFilteredList(lst);
        }
예제 #2
0
        public void TestDelete()
        {
            _bll = GetBLL();
            _bll.Add(new Note
            {
                Name    = "qqq",
                Content = "demo 1"
            });
            _bll.Add(new Note
            {
                Name    = "www",
                Content = "demo 2"
            });
            _bll.Add(new WebAcc
            {
                Name = "www",
                Url  = "www.jdpa.com"
            });
            _bll.Add(new CreditCard
            {
                Name   = "Visa",
                Number = "1111 2222 3333 demo"
            });
            _bll.Add(new CreditCard
            {
                Name    = "Amex",
                Number  = "4444 5555 3333 7777",
                ExpDate = DateTime.UtcNow
            });
            _bll.Flush();

            var bll2 = GetBLL();

            bll2.DeleteById(4);
            var cc2 = bll2.GetItemById(4);

            Assert.IsNull(cc2);
            File.Delete(StoragePath);
        }
예제 #3
0
        public void TestSearch()
        {
            _bll = GetBLL();
            _bll.Add(new Note
            {
                Name    = "qqq",
                Content = "demo 1"
            });
            _bll.Add(new Note
            {
                Name    = "www",
                Content = "demo 2"
            });
            _bll.Add(new WebAcc
            {
                Name = "www",
                Url  = "www.jdpa.com"
            });
            _bll.Add(new CreditCard
            {
                Name   = "Visa",
                Number = "1111 2222 3333 demo"
            });
            _bll.Add(new CreditCard
            {
                Name    = "Amex",
                Number  = "4444 5555 3333 7777",
                ExpDate = DateTime.UtcNow
            });
            _bll.Flush();

            var bll2 = GetBLL();
            var col2 = new List <BaseObj>(bll2.GetFiltered("ww"));

            Assert.IsTrue(col2.Count == 2);
            File.Delete(StoragePath);
        }