private void ExecuteDelete(object parameter)
        {
            IMessageBoxService msg        = new MessageBoxService();
            string             title      = "Deleting Market Segment - Application Category";
            string             confirmtxt = "Do you want to delete the selected item";

            if (MarketSegmentApplicationCategories.Where(x => x.IsChecked).Count() > 1)
            {
                title      = "Deleting Market Segment - Application Categories";
                confirmtxt = confirmtxt + "s";
            }

            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (MarketSegmentApplicationCategoryJoinModel si in MarketSegmentApplicationCategories)
                {
                    if (si.IsChecked)
                    {
                        if (si.ID > 0)
                        {
                            DeleteMarketSegmentApplicationCategory(si.ID);
                        }
                        deleteditems.Add(si);
                    }
                }

                foreach (MarketSegmentApplicationCategoryJoinModel pm in deleteditems)
                {
                    MarketSegmentApplicationCategories.Remove(pm);
                }
                deleteditems.Clear();
                CheckValidation();
            }
            msg = null;
        }
        private bool IsDuplicateName()
        {
            var query = MarketSegmentApplicationCategories.GroupBy(x => x.MarketSegmentID.ToString() + "-" + x.ApplicationCategoryID.ToString())
                        .Where(g => g.Count() > 1)
                        .Select(y => y.Key)
                        .ToList();

            return(query.Count > 0);
        }
 private void MarketSegmentApplicationCategories_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e)
 {
     if (e.PropertyName != "IsChecked")
     {
         CheckValidation();
         isdirty = true;
     }
     IsSelected = MarketSegmentApplicationCategories.Where(x => x.IsChecked).Count() > 0;
 }
        private void ExecuteAddNew(object parameter)
        {
            MarketSegmentApplicationCategories.Add(new MarketSegmentApplicationCategoryJoinModel()
            {
                ID                    = 0,
                Name                  = string.Empty,
                Description           = string.Empty,
                MarketSegmentID       = 0,
                ApplicationCategoryID = 0,
                IsChecked             = false,
                IsEnabled             = true
            });

            ScrollToIndex = MarketSegmentApplicationCategories.Count() - 1;
            CheckValidation();
        }
        private bool IsApplicationCategoryMissing()
        {
            int nummissing = MarketSegmentApplicationCategories.Where(x => x.ApplicationCategoryID == 0).Count();

            return(nummissing > 0);
        }