Пример #1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <CorporationModel> deleteditems = new Collection <CorporationModel>();
            IMessageBoxService            msg          = new MessageBoxService();
            string title      = "Deleting Corporation";
            string confirmtxt = "Do you want to delete the selected item";

            if (Corporations.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (CorporationModel si in Corporations)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "Corporations");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (CorporationModel pm in deleteditems)
                {
                    Corporations.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
Пример #2
0
 private bool IsDuplicateName(string name)
 {
     return(Corporations.Count(x => x.Name == name) > 1);
 }
Пример #3
0
 private bool CanExecuteDelete(object obj)
 {
     return(Corporations.Count(x => x.Selected) > 0);
 }