示例#1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <SpecificationPropertyModel> deleteditems = new Collection <SpecificationPropertyModel>();
            IMessageBoxService msg        = new MessageBoxService();
            string             title      = "Deleting Specification Property";
            string             confirmtxt = "Do you want to delete the selected item";

            if (SpecificationProperties.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (SpecificationPropertyModel si in SpecificationProperties)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "SpecificationPropertyUnits");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (SpecificationPropertyModel pm in deleteditems)
                {
                    SpecificationProperties.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
示例#2
0
 private bool CanExecuteDelete(object obj)
 {
     return(SpecificationProperties.Count(x => x.Selected) > 0);
 }