Esempio n. 1
0
        private async Task RefreshAsync()
        {
            Log("Refreshing data...");

            var items = await Task.Run(() => _uow.Chapels.GetAll());

            DataItemList.Clear();
            foreach (var item in items)
            {
                DataItemList.Add(item);
            }

            Log("Loaded");
        }
Esempio n. 2
0
        public void Refresh()
        {
            // 清除原有資料
            DataItemList.Clear();
            Random fooRM = new Random();

            // 隨機新增多筆新的資料
            for (int i = 0; i < fooRM.Next(20, 100); i++)
            {
                DataItemList.Add(new DataItem
                {
                    DataVale = $"多奇數位創意有限公司 {fooRM.Next(9999)}",
                });
            }
        }
        private async Task RefreshAsync()
        {
            Log("Refreshing data...");

            using (var uow = _uowFactory.CreateNew())
            {
                var dbManagers = await Task.Run(() => uow.Managers.GetAll());

                DataItemList.Clear();
                foreach (var item in dbManagers)
                {
                    DataItemList.Add(item);
                }
                _persons = await Task.Run(() => uow.Persons.GetUnemployeedPersons());

                addBtn.IsEnabled = _persons.Any();
            }
            Log("Loaded");
        }
        private async Task RefreshAsync()
        {
            Log("Refreshing data...");

            using (var uow = _uowFactory.CreateNew())
            {
                var dbDeathRecords = await Task.Run(() => uow.DeathRecords.GetAll());

                DataItemList.Clear();
                foreach (var item in dbDeathRecords)
                {
                    DataItemList.Add(item);
                }
                _alivePersons = await Task.Run(() => uow.Persons.GetAlivePersons());

                addBtn.IsEnabled = _alivePersons.Any();
            }
            Log("Loaded");
        }
Esempio n. 5
0
        private void Accumulate(List <DataItemList> works)
        {
            // TODO: BeginTransaction

            foreach (var work in works)
            {
                foreach (var dataItem in work)
                {
                    if (_isDisposing)
                    {
                        var method = MethodBase.GetCurrentMethod();
                        Debug.WriteLine(string.Format("{0}.{1}: Breaked.", method.DeclaringType, method.Name));
                        return;
                    }

                    _accumulatedItems.Add(dataItem);
                    Thread.Sleep(200);
                }
            }

            // TODO: Commit
        }
Esempio n. 6
0
        public static DataItemReport CaptureToReport(
            this ISectionHeader section, IScreenLoc Start, ScreenContent Content)
        {
            var report = new DataItemReport();
            var row    = new DataItemList();

            // capture item data from each item of the section that is marked for capture.
            // ( by default, all ScreenField items are captured. )
            foreach (var item in section.Items)
            {
                var rv         = item.CaptureReport(Start, Content);
                var dataItem   = rv.Item1;
                var itemReport = rv.Item2;

                if (dataItem != null)
                {
                    report.Columns.Add(dataItem.ToColumnDefn());
                    row.Add(dataItem);
                }

                // this item is a section. The capture function returned a DataItemReport
                // contains the data of the report. Join that report with what has been
                // captured up to this point.
                if (itemReport != null)
                {
                    var comboReport = DataItemReport.CombineHorizontally(report, itemReport);
                    report = comboReport;
                }
            }

            if (row.Count > 0)
            {
                report.Rows.Add(row);
            }

            return(report);
        }
Esempio n. 7
0
        private async Task RefreshAsync()
        {
            Log("Refreshing data...");

            using (var uow = _uowFactory.CreateNew())
            {
                var contracts = await Task.Run(() => uow.Contracts.GetAll());

                DataItemList.Clear();
                foreach (var item in contracts)
                {
                    DataItemList.Add(item);
                }

                _managers = await Task.Run(() => uow.Managers.GetAll());

                _familyMembers = await Task.Run(() => uow.FamilyMembers.GetAll());

                _chapels = await Task.Run(() => uow.Chapels.GetAll());

                addBtn.IsEnabled = _familyMembers.Any() && _managers.Any() && _chapels.Any();
            }
            Log("Loaded");
        }