Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Login lg = new Login();
            //if (lg.ShowDialog() != true)
            //{
            //    Application.Current.Shutdown();
            //}

            this.Title = SettingDAL.GetValue("公司名称") + "人事管理系统";

            //查询是否有员工过生日

            int month = DateTime.Now.Month;
            int day   = DateTime.Now.Day;

            if (SettingDAL.GetBoolValue("启用生日提醒"))
            {
                List <Employee> list = EmployeeDAL.ListAll().ToList();
                foreach (Employee item in list)
                {
                    int empMonth = item.BirthDay.Month;
                    int empDay   = item.BirthDay.Day;
                    if (month == empMonth && empDay == day)
                    {
                        MessageBox.Show("今天是你的同事" + item.Name + "的生日,赶快送上祝福吧!");
                        continue;
                    }

                    if (month == empMonth && (empDay - day) <= SettingDAL.GetIntValue("生日提醒天数") && (empDay - day) > 0)//有人要过生日
                    {
                        MessageBox.Show("还有" + (empDay - day) + "天是你的同事" + item.Name + "的生日,赶快送上祝福吧!");
                        continue;
                    }
                }
            }
        }