コード例 #1
0
        private void Btn_LoadData_Click(object sender, EventArgs e)
        {
            if (lc == null)
            {
                lc = new LoadCheck(Doper.Depts, dc, Doper.GetDeptName);
            }
            var checks = lc.GetCheckList(out DateTime beginDate, out DateTime endDate);
            var users  = dc.USERINFO.ToList();
            var Acc    = new AttControlClass(dc);

            Emps = new List <EmpCheckMonth>();
            checks.ForEach(p =>
            {
                var eobj = Emps.Where(o => o.Emp.USERID == p.USERID).SingleOrDefault();

                if (eobj == null)
                {
                    var user = users.Where(u => u.USERID == p.USERID).Single();

                    eobj        = new EmpCheckMonth(user, Acc, new DeptOper(dc).GetDeptName);
                    eobj.Shifts = this.Shifts;
                    eobj.SetDate(beginDate, endDate);
                    Emps.Add(eobj);
                }
                eobj.Add(p);
            });
            Emps.ForEach(p => p.SetShifts());
            var list = Emps.OrderByDescending(p => p.DeptName).ThenBy(p => p.EmpId).ToList();

            empCheckMonthBindingSource.DataSource = new BindingCollection <EmpCheckMonth>(list);
            YearHoliday.Value = 0;
        }
コード例 #2
0
ファイル: EmpCheckMonth.cs プロジェクト: whj998013/attEDit
        public EmpCheckMonth(USERINFO emp, AttControlClass attControl, GetDeptNameDelgate GetDeptName)
        {
            Emp        = emp;
            DeptName   = GetDeptName((short)emp.DEFAULTDEPTID);
            AttControl = attControl;
            GetDayType = AttControl.GetDayType;
            EmpNote    = AttControl.GetEmpNoteInfoByByte(emp.Notes);

            if (EmpNote == null)
            {
                EmpNote            = new EmpNoteInfo();
                EmpNote.EmpPyName  = PinyinHelper.PinyinString(emp.Name);
                EmpNote.IsHaveNote = true;
                AttControl.UpDateEmpNoteInfo(emp.USERID, EmpNote);
            }
        }
コード例 #3
0
        /// <summary>
        /// 载入考勤
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="BeginDate"></param>
        /// <param name="EndDate"></param>
        public void LoadCheck(string Name, DateTime BeginDate, DateTime EndDate)
        {
            var user = ac.USERINFO.FirstOrDefault(p => p.Name.Contains(Name) && p.DEFAULTDEPTID >= 0);

            if (user != null)
            {
                var getday = new AttControlClass(ac);
                Ecm        = new EmpCheckMonth(user, getday, new DeptOper(ac).GetDeptName);
                Ecm.Shifts = this.shifts;
                Ecm.SetDate(BeginDate, EndDate);
                EndDate = EndDate.AddDays(2);
                var clist = ac.CHECKINOUT.Where(p => p.USERID == user.USERID && p.CHECKTIME >= BeginDate && p.CHECKTIME < EndDate).ToList();
                clist.ForEach(p =>
                {
                    Ecm.Add(p);
                });

                Ecm.SetShifts();
            }
        }