Exemplo n.º 1
0
        private void ExecuteDelete(object parameter)
        {
            IMessageBoxService msg        = new MessageBoxService();
            string             title      = "Deleting New Business Category";
            string             confirmtxt = "Do you want to delete the selected item";

            if (NewBusinessCategories.Where(x => x.IsChecked).Count() > 1)
            {
                title      = "Deleting New Business Categories";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (ModelBaseVM si in NewBusinessCategories)
                {
                    if (si.IsChecked)
                    {
                        if (si.ID > 0)
                        {
                            DeleteNewBusinessCategory(si.ID);
                        }
                        deleteditems.Add(si);
                    }
                }

                foreach (ModelBaseVM pm in deleteditems)
                {
                    NewBusinessCategories.Remove(pm);
                }
                deleteditems.Clear();
                CheckValidation();
            }
            msg = null;
        }
Exemplo n.º 2
0
 private void NewBusinessCategories_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e)
 {
     if (e.PropertyName != "IsChecked")
     {
         CheckValidation();
         isdirty = true;
     }
     IsSelected = NewBusinessCategories.Where(x => x.IsChecked).Count() > 0;
 }
Exemplo n.º 3
0
 private void ExecuteAddNew(object parameter)
 {
     NewBusinessCategories.Add(new ModelBaseVM()
     {
         Name = string.Empty, IsEnabled = true, IsChecked = false
     });
     ScrollToIndex = NewBusinessCategories.Count() - 1;
     CheckValidation();
 }
Exemplo n.º 4
0
        private bool IsDuplicateName()
        {
            var query = NewBusinessCategories.GroupBy(x => x.Name.Trim().ToUpper())
                        .Where(g => g.Count() > 1)
                        .Select(y => y.Key)
                        .ToList();

            return(query.Count > 0);
        }
Exemplo n.º 5
0
        private bool IsNameMissing()
        {
            int nummissing = NewBusinessCategories.Where(x => string.IsNullOrEmpty(x.Name.Trim())).Count();

            return(nummissing > 0);
        }