Ejemplo n.º 1
0
        private bool Confirm()
        {
            var w = new DeleteConfirmation();

            if (w.ShowDialog() == true)
            {
                canDelete = w.CanDelete;
            }
            return(canDelete);
        }
Ejemplo n.º 2
0
        private void DeleteWordCardBtn_Click(object sender, RoutedEventArgs e)
        {
            WordCard wc    = UnSerializeXmlElement <WordCard>(listViewWordCards.SelectedItem as XmlElement);
            int      index = listViewWordCards.SelectedIndex;

            DeleteConfirmation deleteDialog = new DeleteConfirmation(wc.Word);

            deleteDialog.Owner = Window.GetWindow(this);
            deleteDialog.ShowDialog();
            if (deleteDialog.GetResult())
            {
                DictionaryLoader.ActiveDictionary.Dictionary.RemoveAt(index);
                DictionaryLoader.ActiveDictionary.UpdateDictionaryXml();
                LoadXmlWithWordCards(); // update output
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentBusinessPartner == null)
            {
                MainWindow.WarningMessage = "Morate odabrati firmu za brisanje!";
                return;
            }

            SirmiumERPVisualEffects.AddEffectOnDialogShow(this);

            // Create confirmation window
            DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("firma", CurrentBusinessPartner.Name + CurrentBusinessPartner.Code);
            var showDialog = deleteConfirmationForm.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                BusinessPartnerResponse response = businessPartnerService.Delete(CurrentBusinessPartner.Identifier);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Greška kod brisanja sa servera!";
                    SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);
                    return;
                }

                response = new BusinessPartnerSQLiteRepository().Delete(CurrentBusinessPartner.Identifier);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Greška kod lokalnog brisanja!";
                    SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);
                    return;
                }

                MainWindow.SuccessMessage = "Firma je uspešno obrisana!";

                Thread displayThread = new Thread(() => PopulateData());
                displayThread.IsBackground = true;
                displayThread.Start();
            }

            // Remove blur effects
            SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);

            dgBusinessPartners.Focus();
        }
Ejemplo n.º 4
0
        private void DeleteDictionaryMenu_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxDictionaries.SelectedItem as XmlElement != null)
            {
                DictionaryNameAndAmount d             = UnSerializeXmlElement <DictionaryNameAndAmount>(listBoxDictionaries.SelectedItem as XmlElement);
                DeleteConfirmation      dialogConfirm = new DeleteConfirmation(d.Name);

                dialogConfirm.Owner = Window.GetWindow(this);
                dialogConfirm.ShowDialog();
                if (dialogConfirm.GetResult())
                {
                    DictionaryLoader.DeleteDictionary(d);
                }

                string      path = @"data/users/" + DictionaryLoader.ActiveUser + @"/system.xml";
                XmlDocument doc  = new XmlDocument();
                doc.Load(path);
                xmlDataProvider.Document = doc;
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            // Check if any data is selected for delete
            if (CurrentIndividual == null)
            {
                MainWindow.ErrorMessage = ("Morate odabrati radnika za brisanje!");
                return;
            }

            // Show blur effects
            SirmiumERPVisualEffects.AddEffectOnDialogShow(this);

            // Create confirmation window
            DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("radnika", CurrentIndividual.Name);

            var showDialog = deleteConfirmationForm.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                // Delete business partner
                IndividualResponse response = individualService.Delete(CurrentIndividual.Id);

                // Display data and notifications
                if (response.Success)
                {
                    MainWindow.SuccessMessage = ("Podaci su uspešno obrisani!");
                    Thread displayThread = new Thread(() => PopulateData());
                    displayThread.IsBackground = true;
                    displayThread.Start();
                }
                else
                {
                    MainWindow.ErrorMessage = (response.Message);
                }
            }

            // Remove blur effects
            SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);

            dgIndividuals.Focus();
        }
Ejemplo n.º 6
0
        private void btnDeleteCity_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentCity == null)
            {
                MainWindow.WarningMessage = "Morate odabrati grad za brisanje!";
                return;
            }

            SirmiumERPVisualEffects.AddEffectOnDialogShow(this);

            // Create confirmation window
            DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("grad", CurrentCity.Name);
            var showDialog = deleteConfirmationForm.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                CityResponse response = cityService.Delete(CurrentCity.Identifier);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Greška kod brisanja sa servera!";
                    SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);
                    return;
                }

                response = new CitySQLiteRepository().Delete(CurrentCity.Identifier);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Greška kod lokalnog brisanja!";
                    SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);
                    return;
                }

                MainWindow.SuccessMessage = "Grad je uspešno obrisan!";

                Thread displayThread = new Thread(() => DisplayData());
                displayThread.IsBackground = true;
                displayThread.Start();
            }

            SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this);
        }