Esempio n. 1
0
 public void Execute()
 {
     if (viewModel.TracingMode == TracingModeEnum.TracingByNumber)
     {
         var results = repo.GetRecordsByNumber(viewModel.Number, viewModel.StartDate, viewModel.EndDate);
         viewModel.AuditResults = new BindingList <AuditLog>(results);
     }
     else if (viewModel.TracingMode == TracingModeEnum.TracingByUser)
     {
         var results = repo.GetRecordsByUser(viewModel.SelectedUser, viewModel.StartDate, viewModel.EndDate);
         viewModel.AuditResults = new BindingList <AuditLog>(results);
     }
 }
Esempio n. 2
0
        public void Execute()
        {
            if (Prizm.Main.Common.DateExtension.CheckDiapason(viewModel.StartDate, viewModel.EndDate))
            {
                if (viewModel.TracingMode == TracingModeEnum.TracingByNumber)
                {
                    IList <AuditLog> results = new List <AuditLog>();
                    try
                    {
                        results = repo.GetRecordsByNumber(viewModel.Number, viewModel.StartDate, viewModel.EndDate, viewModel.OperationTypes);
                    }
                    catch (RepositoryException ex)
                    {
                        log.Warn("AuditSearchCommandExecute " + ex.ToString());
                        notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
                                           Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
                    }

                    viewModel.AuditResults = new BindingList <AuditLog>(results);
                }
                else if (viewModel.TracingMode == TracingModeEnum.TracingByUser)
                {
                    IList <AuditLog> results = new List <AuditLog>();
                    try
                    {
                        results = repo.GetRecordsByUser(viewModel.SelectedUser, viewModel.StartDate, viewModel.EndDate, viewModel.OperationTypes);
                    }
                    catch (RepositoryException ex)
                    {
                        log.Warn("AuditSearchCommandExecute " + ex.ToString());
                        notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
                                           Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
                    }

                    viewModel.AuditResults = new BindingList <AuditLog>(results);
                }
            }
            else
            {
                notify.ShowInfo(Program.LanguageManager.GetString(StringResources.WrongDate),
                                Program.LanguageManager.GetString(StringResources.Message_ErrorHeader));
                log.Warn("Date limits not valid!" + "Diapason: start date= "
                         + viewModel.StartDate.ToString() + " end date= " + viewModel.EndDate.ToString());
            }
        }