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

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