コード例 #1
0
        private void ExportCommandFunc()
        {
            if (!SysOperationLogViewModels.Any())
            {
                Messenger.Default.Send(new NotificationMessage("没有数据可以导出!"), Tokens.SysOperationLogPage_ShowNotification);
                return;
            }

            var dt = DataHelper <DeviceTrafficLogViewModel> .ListToDataTable(SysOperationLogViewModels.ToList());

            dt.Columns.Remove("LogID");
            dt.Columns.Remove("DepartmentID");
            dt.Columns.Remove("Remark");
            dt.Columns.Remove("IsInDesignMode");

            dt.Columns["UserID"].ColumnName        = "操作人员ID";
            dt.Columns["UserName"].ColumnName      = "操作人员名称";
            dt.Columns["OperationCode"].ColumnName = "操作代码";
            dt.Columns["OperationName"].ColumnName = "操作名称";
            dt.Columns["Detail"].ColumnName        = "操作详情";
            dt.Columns["CreateDate"].ColumnName    = "操作时间";

            Messenger.Default.Send(new OpenWindowMessage()
            {
                DataContext = dt
            }, Tokens.SysOperationLogPage_OpenExportView);
        }
コード例 #2
0
        private void ProcessQueryPage(int pageIndex)
        {
            try
            {
                var conditions = new Hashtable();
                if (!TryGetConditions(pageIndex, PageSize, out conditions))
                {
                    return;
                }

                DispatcherHelper.CheckBeginInvokeOnUI(async() =>
                {
                    string message = "";

                    var controller = await DialogCoordinator.Instance.ShowProgressAsync(this, "查询数据", "查询数据中,请稍等");
                    controller.SetIndeterminate();

                    await Task.Run(() =>
                    {
                        try
                        {
                            Log.Info("查询数据中..");
                            int totalCount            = 0;
                            SysOperationLogViewModels = QueryData(conditions, out totalCount);
                            if (totalCount % PageSize == 0)
                            {
                                TotalPage = (totalCount / PageSize).ToString();
                            }
                            else
                            {
                                TotalPage = ((totalCount / PageSize) + 1).ToString();
                            }
                            RaisePropertyChanged(null);
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex);
                        }
                    });

                    await controller.CloseAsync();

                    if (!SysOperationLogViewModels.Any())
                    {
                        Messenger.Default.Send(new NotificationMessage("查询数据结果为空"), Tokens.SysOperationLogPage_ShowNotification);
                    }
                });
            }
            catch (Exception ex)
            {
            }
        }