示例#1
0
        //private ICommand _cmdDeleteTimeTable;

        //public ICommand CmdDeleteTimeTable
        //{
        //    get
        //    {
        //        if (_cmdDeleteTimeTable == null) _cmdDeleteTimeTable = new RelayCommand(ExCmdDeleteTimeTable);
        //        return _cmdDeleteTimeTable;
        //    }
        //}

        private void ExCmdDeleteTimeTable()
        {
            if (this.TimeTables.Contains(CurrentSelectItem))
            {
                TimeTables.Remove(CurrentSelectItem);
            }
        }
示例#2
0
 private void DeleteTimeTable(object obj)
 {
     if (MessageBox.Show("Are you Sure You want to Delete this Record?", "Pinna Fitness", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         try
         {
             SelectedTimeTable.Enabled = false;
             var stat = _timeTableService.Disable(SelectedTimeTable);
             if (stat == string.Empty)
             {
                 TimeTables.Remove(SelectedTimeTable);
             }
             else
             {
                 MessageBox.Show("Can't Delete, may be the data is already in use..."
                                 + Environment.NewLine + stat, "Can't Delete",
                                 MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Can't Delete, may be the data is already in use..."
                             + Environment.NewLine + ex.Message + Environment.NewLine + ex.InnerException, "Can't Delete",
                             MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }