protected override void OnDelete(Entity item, out string message, ref Action <Entity> afterConfirm)
        {
            if (afterConfirm == null)
            {
                throw new ArgumentNullException(nameof(afterConfirm));
            }

            message = ((Tax)item).Description;

            afterConfirm = currentItem =>
            {
                try
                {
                    var deletedItem = (Tax)currentItem;


                    deletedItem.RowStatus = RecordStatus.DeletedRecord;

                    //Save to the Database
                    var dataWriter = new TaxDataWriter(App.CurrentUser.User.Username, deletedItem);
                    dataWriter.SaveChanges();


                    ItemDataCollection.Remove((Tax)currentItem);

                    App.LogAction("Tax Table", "Deleted Tax Code : " + deletedItem.ShortDesc);
                }
                catch (Exception ex)
                {
                    MessageDialog.ShowError(ex, this);
                }
            };
        }
Ejemplo n.º 2
0
        private void Save()
        {
            if (!DataIsValid())
            {
                return;
            }

            //ItemData.Id = int.Parse(txtTaxId.Text.Trim());
            ItemData.ShortDesc   = txtShort.Text.Trim();
            ItemData.Description = txtDescription.Text.Trim();

            ItemData.Dependent = int.Parse(cboDependent.Text.Trim());
            ItemData.Exemption = (int)txtExemption.Value;


            var dataWriter = new TaxDataWriter(App.CurrentUser.User.Username, ItemData);

            dataWriter.SaveChanges();


            DialogResult = DialogResult.OK;
        }