Beispiel #1
0
        private void OnDelete(Dll.SchoolYear.Section item, out string deleteMessage, ref Action <Dll.SchoolYear.Section> afterConfirm)
        {
            if (afterConfirm == null)
            {
                throw new ArgumentNullException(nameof(afterConfirm));
            }

            deleteMessage = item.SectionName;

            afterConfirm = currentItem =>
            {
                try
                {
                    currentItem.RowStatus = RecordStatus.DeletedRecord;

                    //Save to Database
                    var dataWriter = new SectionDataWriter(App.CurrentUser.User.Username, currentItem);
                    dataWriter.SaveChanges();
                }
                catch (Exception ex)
                {
                    MessageDialog.ShowError(ex, this);
                }
            };
        }
Beispiel #2
0
        private void SectionViewer_AfterItemEdit(object sender, Dll.SchoolYear.Section e)
        {
            try
            {
                if (e == null)
                {
                    MessageDialog.ShowValidationError(this, "Similar Record Already Exists!", null, null, 40);
                    return;
                }


                e.RowStatus = RecordStatus.ModifiedRecord;
                SectionViewer.SaveChanges(App.CurrentUser.User.Username);
                App.LogAction("Section", "Updated Section : " + e.SectionName);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowValidationError(this, ex.Message);
            }
        }