Ejemplo n.º 1
0
        protected override void Validation()
        {
            if (_IAccountBll == null)
            {
                _IAccountBll = BllInstance.AccountBllInstance;
            }
            _ItsAccount = _IAccountBll.GetAccountByName(_EmpName);
            // _ItsEmployee = _EmployeeDal.GetEmployeeByAccountID(account.Id);

            //_ItsEmployee = _EmployeeDal.GetEmployeeByAccountID(_EmpName);
            if (_EmpName == null || _ItsAccount == null)
            {
                BllUtility.ThrowException(BllExceptionConst._Employee_Not_Found);
            }
            if (!IsLoginUserManage(_ItsAccount, _LoginAccount))
            {
                throw new ApplicationException("没有权限访问");
            }
            List <AttendanceBase> allAttendances = _AttendanceDal.GetAttendanceByEmpId(_ItsAccount.Id);

            foreach (AttendanceBase attendance in allAttendances)
            {
                if (IsTheSameAttendanceType(attendance) && AlreadyHaveTheSameDay(attendance))
                {
                    BllUtility.ThrowException(RepetExceptions());
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据员工名字获取所有员工信息
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public Employee GetEmployeeByName(string name)
        {
            Account  account  = _IAccountBll.GetAccountByName(name);
            Employee employee = GetEmployeeByAccountID(account.Id);

            return(employee);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 用于日月试图显示
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="start">开始时间,如月头</param>
        /// <param name="end">结束时间,如月末</param>
        /// <param name="typelist">要查询的类型,如0|2|3,代表查询班别,请假,外出</param>
        /// <returns></returns>
        public List <CalendarADay> GetCalendarADayList(string accountName, DateTime start, DateTime end, string typelist)
        {
            Account account;

            if (accountName == "self" || string.IsNullOrEmpty(accountName))
            {
                account = HttpContext.Current.Session["LoginInfo"] as Account;
            }
            else
            {
                account = _AccountBll.GetAccountByName(accountName);
            }

            List <CalendarADay> items = new CalendarADayList(account.Id, start, end, typelist).GetList();

            return(Merge(items).OrderBy(x => x.Date).ToList());
        }
Ejemplo n.º 4
0
 protected override void Validation()
 {
     _ItsCordinator = _IAccountBll.GetAccountByName(_Course.Coordinator.Name);
     if (_ItsCordinator == null)
     {
         BllUtility.ThrowException(BllExceptionConst._Condinator_Cannot_Find);
     }
     if (_Course.Status == TrainStatusEnum.End || _Course.Status == TrainStatusEnum.Interrupt)
     {
         BllUtility.ThrowException(BllExceptionConst._TrainCourseNew_Cannot_End);
     }
     //if (_Course.Status != TrainStatusEnum.Start)
     //{
     //    BllUtility.ThrowException(BllExceptionConst._TrainCourseNew_Cannot_End);
     //}
     if (!IsLoginUserManage(_ItsCordinator, _LoginUser))
     {
         //throw new ApplicationException("您没有管理该协调员的权限");
         BllUtility.ThrowException(BllExceptionConst._Condinator_NoAuth);
     }
 }
Ejemplo n.º 5
0
        protected override void Validation()
        {
            Course oldcourse = _DalTrain.GetTrainCourseByPKID(_Course.CourseID);

            if (oldcourse == null)
            {
                BllUtility.ThrowException(BllExceptionConst._Skill_Name_NotExist);
            }
            else if (oldcourse.CourseFeedBackPaper.FeedBackPaperId.Equals(_Course.CourseFeedBackPaper.FeedBackPaperId))
            {
                _IsFeedBackPaperUpdate = false;
            }

            if (oldcourse != null)
            {
                switch (oldcourse.Status)
                {
                case TrainStatusEnum.Interrupt:
                    BllUtility.ThrowException(BllExceptionConst._TrainCourse_Interrupt);
                    break;

                case TrainStatusEnum.End:
                    BllUtility.ThrowException(BllExceptionConst._TrainCourse_End);
                    break;
                }
            }
            _ItsCordinator = _IAccountBll.GetAccountByName(_Course.Coordinator.Name);
            if (_ItsCordinator == null)
            {
                BllUtility.ThrowException(BllExceptionConst._Employee_Not_Found);
            }

            if (!IsLoginUserManage(_ItsCordinator, _LoginUser))
            {
                // throw new ApplicationException("您没有管理该协调员的权限");
                BllUtility.ThrowException(BllExceptionConst._Condinator_NoAuth);
            }
        }
Ejemplo n.º 6
0
        public static List <Account> toAccountList(string s)
        {
            List <Account> accounts = new List <Account>();

            if (!string.IsNullOrEmpty(s))
            {
                s.Replace(":", ";");
                s.Replace("£»", ";");
                s.Replace("£º", ";");
                string[] names = s.Split(';');
                if (names.Length > 0)
                {
                    IAccountBll   accountBll = BllInstance.AccountBllInstance;
                    List <string> temp       = new List <string>();
                    for (int i = 0; i < names.Length; i++)
                    {
                        if (!temp.Contains(names[i]))
                        {
                            temp.Add(names[i]);
                        }
                    }
                    foreach (string name in temp)
                    {
                        Account account = accountBll.GetAccountByName(name);
                        if (account == null)
                        {
                            throw new ApplicationException(string.Format("{0}²»´æÔÚ", name));
                        }
                        if (account.Id != Utility.LoginUser.Id)
                        {
                            accounts.Add(account);
                        }
                    }
                }
            }
            return(accounts);
        }
Ejemplo n.º 7
0
        private int ImportDate(DataTable dt)
        {
            List <Employee> employeeList = new List <Employee>();
            DateTime        dt_Now       = DateTime.Now;

            //Employee employee
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                _Name = GetItem(dt, i, _NameColumn);
                if (string.IsNullOrEmpty(_Name))
                {
                    continue;
                }
                Employee employee = employeeList.Find(FindEmployee);
                if (employee == null)
                {
                    Account account = _IAccountBll.GetAccountByName(_Name);
                    //如果系统里没有该员工或者该员工在系统中没有门禁卡卡号
                    if (account == null)
                    {
                        continue;
                    }
                    employee = getEmployee.GetEmployeeAttendenceInfoByAccountID(account.Id);
                    if (employee == null)
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(employee.EmployeeAttendance.DoorCardNo))
                    {
                        continue;
                    }
                    employee.EmployeeAttendance.AttendanceInAndOutRecordList = new List <AttendanceInAndOutRecord>();
                    employeeList.Add(employee);
                }
                AttendanceInAndOutRecord attendanceInAndOutRecord = new AttendanceInAndOutRecord();
                attendanceInAndOutRecord.IOStatus = GetInOutStatusByInOutName(GetItem(dt, i, _InOutColumn));
                try
                {
                    var      date = Convert.ToDateTime(GetItem(dt, i, _DateColumn));
                    DateTime time;
                    if (DateTime.TryParse(GetItem(dt, i, _TimeColumn), out time))
                    {
                        attendanceInAndOutRecord.IOTime = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, time.Second);
                    }
                    else
                    {
                        attendanceInAndOutRecord.IOTime = Convert.ToDateTime(date.ToString("yyyy-MM-dd") + " " + GetItem(dt, i, _TimeColumn));
                    }
                }
                catch
                {
                    continue;
                }
                attendanceInAndOutRecord.OperateStatus = OutInRecordOperateStatusEnum.ImportByOperator;
                attendanceInAndOutRecord.OperateTime   = dt_Now;
                //判断读取中是否有重复记录 add by liudan 2009-09-19
                List <AttendanceInAndOutRecord> sqlRecords =
                    attendanceInAndOutRecordDal.GetAttendanceInAndOutRecordByCondition(employee.Account.Id,
                                                                                       employee.EmployeeAttendance.
                                                                                       DoorCardNo,
                                                                                       Convert.ToDateTime("1900-12-31"),
                                                                                       Convert.ToDateTime("2999-12-31"),
                                                                                       InOutStatusEnum.All,
                                                                                       OutInRecordOperateStatusEnum.All,
                                                                                       Convert.ToDateTime("1900-12-31"),
                                                                                       Convert.ToDateTime("2999-12-31"));
                bool isFind = false;
                foreach (AttendanceInAndOutRecord records in sqlRecords)
                {
                    if (attendanceInAndOutRecord.IOStatus.Equals(records.IOStatus) &&
                        attendanceInAndOutRecord.IOTime.Equals(records.IOTime))
                    {
                        isFind = true;
                    }
                }
                if (!isFind)
                {
                    employee.EmployeeAttendance.AttendanceInAndOutRecordList.Add(attendanceInAndOutRecord);
                    count = count + 1;
                }
            }
            attendanceInAndOutRecordDal.InsertAttendanceInAndOutRecordList(employeeList);
            return(employeeList.Count);
        }
        /// <summary>
        /// 开始更新员工的帐套
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="indexAccountSetName"></param>
        /// <param name="indexEmployeeName"></param>
        private void ToInsertUpdateEmployeeAccountSet(DataTable dt, int indexAccountSetName, int indexEmployeeName)
        {
            List <Account> allAccount = _IAccountBll.GetAllAccount();

            allAccount = Tools.RemoteUnAuthAccount(allAccount, AuthType.HRMIS, _Operator, HrmisPowers.A604);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ModelPayModule.AccountSet accountSet = null;
                //有没有当前账号
                Account account =
                    _IAccountBll.GetAccountByName(dt.Rows[i][indexEmployeeName].ToString().Trim());
                if (account == null || !Tools.ContainsAccountById(allAccount, account.Id))
                {
                    continue;
                }
                //当前账号有没有工资套,如果有则给accountSet赋上当前帐套,以便更新
                bool           IsEmployeeHaveAccountSet = false;
                EmployeeSalary employeeSalary           =
                    new GetEmployeeAccountSet().GetEmployeeAccountSetByEmployeeID(account.Id);
                if (employeeSalary != null && employeeSalary.AccountSet != null)
                {
                    accountSet = employeeSalary.AccountSet;
                    IsEmployeeHaveAccountSet = true;
                }
                //excel是否有帐套名称列,如果有则需要确定是否要更新帐套
                if (indexAccountSetName != -1)
                {
                    ModelPayModule.AccountSet accountSetInExcel =
                        new GetAccountSet().GetAccountSetByName(
                            dt.Rows[i][indexAccountSetName].ToString().Trim());
                    if (accountSetInExcel != null)
                    {
                        //如果accountSet是空,则将accountSetInExcel赋值给accountSet
                        if (accountSet == null)
                        {
                            accountSet = new GetAccountSet().GetWholeAccountSetByPKID(accountSetInExcel.AccountSetID);
                        }
                        //如果accountSet不是空,是否和accountSetInExcel的帐套一致,如果不一致,则要覆盖accountSet,并且做AccountSet信息的数据Merge,保留原有的固定值信息
                        else if (accountSetInExcel.AccountSetID != accountSet.AccountSetID)
                        {
                            accountSet = new GetAccountSet().GetWholeAccountSetByPKID(accountSetInExcel.AccountSetID);
                            if (employeeSalary != null && employeeSalary.AccountSet != null)
                            {
                                //AccountSet信息的数据Merge,保留原有的固定值信息
                                MergeAccountSetData(accountSet, employeeSalary.AccountSet);
                            }
                        }
                    }
                }
                if (accountSet == null)
                {
                    continue;
                }

                BindAccountSetData(dt, i, accountSet);
                if (IsEmployeeHaveAccountSet)
                {
                    new UpdateEmployeeAccountSet(account.Id, accountSet, _Operator.Name,
                                                 DateTime.Now,
                                                 EmployeeAccount_DataString).Excute();
                }
                else
                {
                    new CreateEmployeeAccountSet(account.Id, accountSet, _Operator.Name,
                                                 DateTime.Now,
                                                 EmployeeAccount_DataString).Excute();
                }
            }
        }