Пример #1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <SalesDivisionModel> deleteditems = new Collection <SalesDivisionModel>();
            IMessageBoxService msg        = new MessageBoxService();
            string             title      = "Deleting Sales Division";
            string             confirmtxt = "Do you want to delete the selected item";

            if (SalesDivisions.Count(x => x.Selected) > 1)
            {
                title      = title + "s";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (SalesDivisionModel si in SalesDivisions)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "SalesDivisions");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (SalesDivisionModel pm in deleteditems)
                {
                    SalesDivisions.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
Пример #2
0
 private void ExecuteAddNew(object parameter)
 {
     SalesDivisions.Add(new SalesDivisionModel()
     {
         ID = 0, Name = string.Empty, OperatingCompanyID = 0
     });
     ScrollToSelectedItem = SalesDivisions.Count - 1;
 }
 private void ExecuteAddNew(object parameter)
 {
     _canexecuteadd = false;
     SalesDivisions.Add(new Models.SalesDivisionModel()
     {
         GOM = new Models.GenericObjModel()
     });
     SalesDivision = SalesDivisions[SalesDivisions.Count - 1];
     SalesDivisions.ItemPropertyChanged += SalesDivisions_ItemPropertyChanged;
     ScrollToSelectedItem = SalesDivisions.Count - 1;
 }
Пример #4
0
 private bool CanExecuteDelete(object obj)
 {
     return(SalesDivisions.Count(x => x.Selected) > 0);
 }