Exemplo n.º 1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <AssetAreaModel> deleteditems = new Collection <AssetAreaModel>();
            IMessageBoxService          msg          = new MessageBoxService();
            string title      = "Deleting Asset Area";
            string confirmtxt = "Do you want to delete the selected item";

            if (AssetAreas.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (AssetAreaModel si in AssetAreas)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "AssetAreas");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (AssetAreaModel pm in deleteditems)
                {
                    AssetAreas.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
Exemplo n.º 2
0
 private void ExecuteAddNew(object parameter)
 {
     AssetAreas.Add(new AssetAreaModel()
     {
         ID = 0, Name = string.Empty, Prefix = string.Empty
     });
     ScrollToSelectedItem = AssetAreas.Count - 1;
 }
Exemplo n.º 3
0
        private bool IsDuplicateCode(string _name)
        {
            var q = AssetAreas.Count(x => x.Prefix == _name);

            return(q > 1);
        }
Exemplo n.º 4
0
        private bool IsDuplicateName(string _name)
        {
            var q = AssetAreas.Count(x => x.Name == _name);

            return(q > 1);
        }
Exemplo n.º 5
0
 //Delete
 private bool CanExecuteDelete(object obj)
 {
     return(AssetAreas.Count(x => x.Selected) > 0);
 }