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

            if (SMCodes.Where(x => x.IsChecked).Count() > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }

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

                foreach (SMCodeModel pm in deleteditems)
                {
                    SMCodes.Remove(pm);
                }
                deleteditems.Clear();
                CheckValidation();
            }
            msg = null;
        }
Exemplo n.º 2
0
 private void SMCodes_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs e)
 {
     if (e.PropertyName != "IsChecked")
     {
         CheckValidation();
         isdirty = true;
     }
     IsSelected = SMCodes.Where(x => x.IsChecked).Count() > 0;
 }
Exemplo n.º 3
0
        private bool IsDuplicateName()
        {
            var query = SMCodes.GroupBy(x => x.Name.Trim().ToUpper() + "-" + x.IndustryID.ToString())
                        .Where(g => g.Count() > 1)
                        .Select(y => y.Key)
                        .ToList();

            return(query.Count > 0);
        }
Exemplo n.º 4
0
        private void GetSMCodes()
        {
            FullyObservableCollection <SMCodeModel> smcodes = DatabaseQueries.GetSMCodes();

            SMCodes?.Clear();
            foreach (SMCodeModel sm in smcodes)
            {
                if (sm.ID > 0)
                {
                    SMCodes.Add(sm);
                }
            }
            SMCodes.ItemPropertyChanged += SMCodes_ItemPropertyChanged;
        }
Exemplo n.º 5
0
        private void ExecuteAddNew(object parameter)
        {
            SMCodes.Add(new SMCodeModel()
            {
                ID          = 0,
                Name        = string.Empty,
                Description = string.Empty,
                IndustryID  = 0,
                IsChecked   = false,
                IsEnabled   = true
            });

            ScrollToIndex = SMCodes.Count() - 1;
            CheckValidation();
        }
Exemplo n.º 6
0
        private bool IsIndustryMissing()
        {
            int nummissing = SMCodes.Where(x => x.IndustryID == 0).Count();

            return(nummissing > 0);
        }
Exemplo n.º 7
0
        private bool IsDescriptionMissing()
        {
            int nummissing = SMCodes.Where(x => string.IsNullOrEmpty(x.Description.Trim())).Count();

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

            return(nummissing > 0);
        }