Exemplo n.º 1
0
        public static void UpdateData()
        {
            //using (var dbContext = new HrManagerContext()) {
            //    dbContext.Database.CreateIfNotExists();
            //}

            Employees           = new EntityCollection <Employee>(new EmployeeControl());
            Departments         = new EntityCollection <Department>(new DepartmentControl());
            OperatingPosts      = new EntityCollection <OperatingPost>(new OperatingPostControl());
            Dormitories         = new EntityCollection <Dormitory>(new DormitoryControl());
            EmployeePostAdjusts = new EntityCollection <EmployeePostAdjust>(new EmployeePostAdjustControl());


            ArrangeWorks        = new EntityCollection <ArrangeWork>(new ArrangeWorkControl());
            AsignedArrangeWorks = new EntityCollection <ArrangeWork>(new ArrangeWorkControl(), w => !w.IsCommonDefine);
            DefinedArrangeWorks = new EntityCollection <ArrangeWork>(new ArrangeWorkControl(), w => w.IsCommonDefine);

            VacationPlans        = new EntityCollection <VacationPlan>(new VacationPlanControl());
            AsignedVacationPlans = new EntityCollection <VacationPlan>(new VacationPlanControl(), w => !w.IsCommonDefine);
            DefVacationPlans     = new EntityCollection <VacationPlan>(new VacationPlanControl(), w => w.IsCommonDefine);

            AskLeaves     = new EntityCollection <AskLeave>(new AskLeaveControl());
            BusinessTrips = new EntityCollection <BusinessTrip>(new BusinessTripControl());
            ReSignIns     = new EntityCollection <ReSignIn>(new ReSignInControl());
            OverWorks     = new EntityCollection <OverWork>(new OverWorkControl());

            SystemArguments   = new EntityCollection <SystemArgument>(new SystemArgumentControl());
            AskLeaveTypes     = new EntityCollection <AskLeaveType>(new AskLeaveTypeControl());
            CardFillRecords   = new EntityCollection <CardFillRecord>(new CardFillRecordControl());
            Attendances       = new ObservableCollection <Attendance>(HrManagerContext.GetInstance().Attendances.ToList());
            AttendanceResults = new EntityCollection <AttendanceResult>(new AttendanceResultControl());
            TiaoXius          = new EntityCollection <TiaoXiu>(new TiaoXiuControl());
            SalaryDetails     = new EntityCollection <WageDetail>(new WageDetailControl());

            AttArgControl     = new AttendanceArguControl();
            BaseSalaryControl = new BaseSalaryControl();
            TaxControl        = new TaxControl();

            SystemRoles = new EntityCollection <SystemRole>(new SystemRoleControl());
            if (!SystemRoles.ToList().Exists(s => s.IsDefaultRole))
            {
                SystemRoles.AddWithEntity(SystemRole.Default);
            }

            SystemUsers = new EntityCollection <SystemUser>(new SystemUserControl());
            if (!SystemUsers.ToList().Exists(s => s.IsDefaultUser))
            {
                SystemUsers.AddWithEntity(SystemUser.DefaultAdmin);
            }

            Couples = new EntityCollection <Couple>(new CoupleControl());

            WorkAreaHeight  = System.Windows.SystemParameters.WorkArea.Height;
            WorkAreaWidth   = System.Windows.SystemParameters.WorkArea.Width;
            TipWidth        = 300;
            TipHeight       = 200;
            ExpectedTipLeft = WorkAreaWidth - TipWidth;
            ExpectedTipTop  = WorkAreaHeight - TipHeight;
        }