예제 #1
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            var btn  = sender as Button;
            var item = btn.DataContext as StaffInfoModel;

            Action <object, ObservableCollection <ServiceModel> > action = (o, m) =>
            {
                if (item.Services == null)
                {
                    item.Services = new ObservableCollection <ServiceModel>();
                }
                item.Services.Clear();
                foreach (var m1 in m)
                {
                    int index = 0;
                    foreach (var s in item.Services)
                    {
                        if (s.Code.CompareTo(m1.Code) > 0)
                        {
                            break;
                        }
                        else
                        {
                            index++;
                        }
                    }
                    item.Services.Insert(index, m1);
                }
            };
            ServicePopup p = new ServicePopup(action, item.Services);

            p.Show();
        }
예제 #2
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            Action <object, ObservableCollection <ServiceModel> > action = (o, m) =>
            {
                foreach (var m1 in m)
                {
                    if (Serivces.Where(s => s.Code == m1.Code).Count() > 0)
                    {
                        //skip
                    }
                    else
                    {
                        int index = 0;
                        foreach (var s in Serivces)
                        {
                            if (s.Code.CompareTo(m1.Code) > 0)
                            {
                                break;
                            }
                            else
                            {
                                index++;
                            }
                        }

                        Serivces.Insert(index, m1);
                    }
                }
            };
            ServicePopup p = new ServicePopup(action, Serivces);

            p.Show();
        }