private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (lcv.CanAddNewItem)
            {
                foreach (EmployeeInfo info in dataManager.AllEmployeeList)
                {
                    //离职的不允许添加
                    if (info.StatusID == 0)
                    {
                        continue;
                    }

                    appLog.Info("Add Employee,ID = " + info.ID);
                    lcv.AddNewItem(new SalaryInfo
                    {
                        Year       = (int)(YearComboBox.SelectedItem),
                        Month      = (int)(MonthComboBox.SelectedItem),
                        EmployeeID = info.ID,
                        SelectionEmployeeInfoList   = dataManager.AllEmployeeList.ToList(),
                        SelectionDepartmentInfoList = dataManager.AllDepartmentList.ToList(),
                        SelectionWorkStatusInfoList = AlgorithmClass.GetWorkStatusList()
                    });

                    lcv.CommitNew();
                }
            }
        }
Ejemplo n.º 2
0
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            if (lcv.CanAddNewItem)
            {
                lcv.AddNewItem(new EmployeeInfo
                {
                    EmployeeSex                 = EmployeeSexType.boy,
                    StatusID                    = 1,
                    DepartmentID                = (DepartmentComboBox.SelectedItem as DepartmentInfo).ID,
                    PostID                      = 1,
                    SelectionPostInfoList       = dataManager.AllPostList.ToList(),
                    SelectionDepartmentInfoList = dataManager.AllDepartmentList.ToList(),
                    SelectionWorkStatusInfoList = AlgorithmClass.GetWorkStatusList()
                });

                lcv.CommitNew();
            }
        }
        private void InitUIList()
        {
            appLog.Info("InitUIList...");

            needAddList    = new ObservableCollection <SalaryInfo>();
            needUpdateList = new ObservableCollection <SalaryInfo>();
            //添加雇员选择列表
            appLog.Info("Add EmployeeList...");
            AlgorithmClass.InitSalarySelectionList(dataManager.AllSalaryList, dataManager.AllEmployeeList, dataManager.AllDepartmentList, AlgorithmClass.GetWorkStatusList());
            AllSalaryList = AlgorithmClass.DeepClone <ObservableCollection <SalaryInfo> >(dataManager.AllSalaryList);
            lcv           = new ListCollectionView(AllSalaryList);
            lcv.GroupDescriptions.Add(new PropertyGroupDescription("DepartmentName"));
            lcv.Filter = Fitter_TextChanged;
            lcv.Refresh();
            //刷新当前页面上的所有收支
            // FlushCurrentViewAllCommission();
            AddBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv
            });
            ClearBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            SaveBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            RestoreBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            ViewBSBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            PrintBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            FlushAllBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });

            SalaryDataGrid.ItemsSource = lcv;
        }
Ejemplo n.º 4
0
        private void InitUIList()
        {
            needAddList    = new ObservableCollection <EmployeeInfo>();
            needUpdateList = new ObservableCollection <EmployeeInfo>();
            //添加职务、部门及在职状态选择列表
            AlgorithmClass.InitEmployeeSelectionList(dataManager.AllEmployeeList, dataManager.AllPostList, dataManager.AllDepartmentList, AlgorithmClass.GetWorkStatusList());
            AllEmployeeList = AlgorithmClass.DeepClone <ObservableCollection <EmployeeInfo> >(dataManager.AllEmployeeList);
            lcv             = new ListCollectionView(AllEmployeeList);
            lcv.Filter      = Fitter_TextChanged;
            lcv.Refresh();

            SaveBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            RestoreBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            PrintBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });

            EmployeeDataGrid.ItemsSource = lcv;
        }