private void btnCreateSalarySheet_Click(object sender, RoutedEventArgs e)
        {
            int  year   = (int)cmbYear.SelectedItem;
            int  month  = (int)cmbMonth.SelectedItem;
            Guid DeptId = (Guid)cmbDept.SelectedValue;

            if (SalarySheetDAL.IsExist(year, month, DeptId))
            {
                if (MessageBox.Show("工资表已存在,是否重新生成?", "提示",
                                    MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    SalarySheetDAL.DeleteSalarySheet(year, month, DeptId);
                }
                SalarySheetDAL.Build(year, month, DeptId);
                //MessageBox.Show("生成成功!");
                colEmployee.ItemsSource         = EmployeeDAL.GetEmployeeByDept(DeptId);
                dataGridSalaryItems.ItemsSource = SalarySheetDAL.GetSalarySheetItem(year, month, DeptId);
            }
        }
        private void btnQuery_Click(object sender, RoutedEventArgs e)
        {
            int  year   = Convert.ToInt32(txtYear.Text);
            int  month  = Convert.ToInt32(txtMonth.Text);
            Guid DeptId = (Guid)cmbDept.SelectedValue;

            if (SalarySheetDAL.IsExist(year, month, DeptId) == false)
            {
                MessageBox.Show("还没有生成工资表!");
                return;
            }

            SalarySheetItem[] salarySheetItems = SalarySheetDAL.GetSalarySheetItem(year, month, DeptId);

            SalarySheetItemrpt[] salarySheetItemrpts = new SalarySheetItemrpt[salarySheetItems.Length];

            for (int i = 0; i < salarySheetItems.Length; i++)
            {
                SalarySheetItem    item    = salarySheetItems[i];
                SalarySheetItemrpt itemRpt = new SalarySheetItemrpt();
                itemRpt.BaseSalary = item.BaseSalary;
                itemRpt.Bonus      = item.Bonus;
                itemRpt.Fine       = item.Fine;
                itemRpt.Other      = item.Other;

                itemRpt.EmployeeName   = EmployeeDAL.GetById(item.EmployeeId).Name;
                salarySheetItemrpts[i] = itemRpt;
            }

            SalarySheetItemCrystalReport rpt = new SalarySheetItemCrystalReport();

            rpt.SetDataSource(salarySheetItemrpts);
            rpt.SetParameterValue("年", year);
            rpt.SetParameterValue("月", month);
            rpt.SetParameterValue("部门", cmbDept.Text);

            crystalReportsViewer1.ViewerCore.ReportSource = rpt;
        }