Esempio n. 1
0
        private void btnGenerateSheet_Click(object sender, RoutedEventArgs e)
        {
            int            year   = (int)cmbYear.SelectedValue;
            int            month  = (int)cmbMonth.SelectedValue;
            Guid           deptId = (Guid)cmbDepartment.SelectedValue;
            SalarySheetDAL dal    = new SalarySheetDAL();

            if (dal.IsExisted(year, month, deptId))
            {
                if (MessageBoxResult.Yes == MessageBox.Show("SalarySheet is already existed. Do you want to gernerate one again?",
                                                            "Warning", MessageBoxButton.YesNo))
                {
                    dal.Clear(year, month, deptId);
                    dal.Generate(year, month, deptId);
                    //MessageBox.Show("Successful Generating!");
                    colEmployee.ItemsSource = new EmployeeDAL().SearchByDpt(deptId);
                    datagrid.ItemsSource    =
                        new SalarySheetItemDAL().GetItemsByDate(year, month, deptId);
                }
                else
                {
                    return;
                }
            }
            else
            {
                dal.Generate(year, month, deptId);
                colEmployee.ItemsSource = new EmployeeDAL().SearchByDpt(deptId);
                datagrid.ItemsSource    =
                    new SalarySheetItemDAL().GetItemsByDate(year, month, deptId);
            }
        }
Esempio n. 2
0
        private void btnCreateSalarySheet_Click(object sender, RoutedEventArgs e)
        {
            int            year   = (int)cmbYear.SelectedValue;
            int            month  = (int)cmbMonth.SelectedValue;
            Guid           deptId = (Guid)cmbDept.SelectedValue;
            SalarySheetDAL dal    = new SalarySheetDAL();

            if (dal.IsExists(year, month, deptId))
            {
                if (MessageBox.Show("工资单已经生成,是否重新生成?",
                                    "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    dal.Clear(year, month, deptId);
                }
            }
            dal.Build(year, month, deptId);

            colEmployee.ItemsSource = new EmployeeDAL().ListByDepment(deptId);

            datagridItems.ItemsSource = new SalarySheetDAL().GetSalarySheetItems(
                year, month, deptId);
        }