private void DeleteScannedData(ScanData data)
        {
            try
            {
                if (User == null)
                {
                    return;
                }
                if (!User.SuperUser)
                {
                    Alert("Uwaga", "Brak uprawnień! Zaloguj się na użytkownika posiadającego prawa administracyjne!", "Ok.");
                    return;
                }

                IsBusy = true;

                if (Delete(data))
                {
                    var items = ReportList.Where(w => w.DataValue == data.DataValue).ToList();
                    foreach (ScanData item in items)
                    {
                        ReportList.Remove(item);
                    }

                    Alert("Sukcess", "Usuwanie zakończone.", "Ok.");
                }
            }
            catch (Exception ex)
            {
                Alert("Błąd", ex.Message, "Ok.");
            }
            finally {
                IsBusy = false;
            }
        }
Beispiel #2
0
 private void OnDeleteReportFromList()
 {
     if (SelectedReport != null)
     {
         ReportList.Remove(SelectedReport);
     }
     if (ReportList.Count == 0)
     {
         DeleteReportFromListE = false;
     }
 }
        private void ReportRemove(ReportVM rvm)
        {
            if (System.Windows.Forms.MessageBox.Show("确定要删除该模板吗", "询问",
                                                     System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (!ReportList.Contains(rvm))
            {
                return;
            }

            ReportList.Remove(rvm);
            File.Delete(rvm.ReportPath);
            File.Delete(rvm.DataPath);
            SaveReportList();

            if (ReportList.Count > 0)
            {
                SelectedReport = ReportList[0];
            }
        }
Beispiel #4
0
 public bool deleteReport(IReport report)
 {
     DataLayer.deleteReportFromDB(report);
     ReportList.Remove(report); //remove object from collection
     return(true);
 }