Esempio n. 1
0
        /// <summary>
        /// This method is used to delete the tax
        /// </summary>
        /// <param name="param"></param>
        void DeleteTax(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            ITaxOperationRepository     taxRepository = new TaxOperationRepository();
            ITaxCodesAndRatesRepository tax           = new TaxCodesAndRatesRepository();
            var taxModel = SelectedTax as TaxModel;

            if (taxModel != null)
            {
                if (taxModel.Predefined == false || taxModel.Predefined == null)
                {
                    MessageBoxResult result = MessageBox.Show("Do you want to delete tax?\n" + "@ Simple Accounting Software Pte Ltd", "Delete Tax", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)

                    {
                        var Check = tax.IsTaxDeleted(taxModel.TaxID);
                        if (Check.Equals("1") && Check != null)
                        {
                            TaxErrors = "# GST Code cannot be deleted because it is used in transaction.";
                        }
                        else
                        {
                            taxRepository.DeleteTax(taxModel.TaxID);
                            SelectedTax = new TaxModel();
                            Tax         = new ObservableCollection <TaxModel>(tax.GetAllTaxes());
                        }
                    }
                }
                else
                {
                    TaxErrors = "# GST Free cannot be deleted.";
                }
            }
            Mouse.OverrideCursor = null;
        }
Esempio n. 2
0
        /// <summary>
        /// This method is used to delete the tax
        /// </summary>
        /// <param name="param"></param>
        void DeleteTax(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            ITaxOperationRepository     taxRepository = new TaxOperationRepository();
            ITaxCodesAndRatesRepository tax           = new TaxCodesAndRatesRepository();
            var taxModel = SelectedTax as TaxModel;

            if (taxModel != null)
            {
                if (taxModel.Predefined == false || taxModel.Predefined == null)
                {
                    MessageBoxResult result = MessageBox.Show("Do you want to delete tax?", "Delete Tax", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        taxRepository.DeleteTax(taxModel.TaxID);
                        SelectedTax = new TaxModel();
                        Tax         = new ObservableCollection <TaxModel>(tax.GetAllTaxes());
                    }
                }
                else
                {
                    TaxErrors = "# GST Free cannot be deleted.";
                }
            }
            Mouse.OverrideCursor = null;
        }