Ejemplo n.º 1
0
        /// <summary>
        /// 离职天数 未入职天数
        /// </summary>
        /// <param name="accountID"></param>
        /// <param name="startDt"></param>
        /// <param name="endDt"></param>
        public void CalcNotOnDutyDays(int accountID, DateTime startDt, DateTime endDt)
        {
            decimal  _weiRuZhiDay = 0;
            decimal  _liZhiDay    = 0;
            Employee employee     = _GetEmployee.GetEmployeeBasicInfoByAccountID(accountID);

            if (employee != null && employee.EmployeeDetails != null && employee.EmployeeDetails.Work != null)
            {
                var planduty = _PlanDutyDal.GetPlanDutyDetailByAccount(accountID, startDt, endDt);
                List <SpecialDate> specialDateList = _ISpecialDateBll.GetSpecialDateByFromAndToDate(startDt, endDt);
                CalculateDays      calculateDays   = new CalculateDays(specialDateList);
                DateTime           comeDate        = employee.EmployeeDetails.Work.ComeDate.AddDays(-1);
                if (comeDate < startDt)
                {
                    _weiRuZhiDay = 0;
                }
                else
                {
                    calculateDays.StartDate = startDt;
                    calculateDays.EndDate   = comeDate <= endDt ? comeDate : endDt;
                    _weiRuZhiDay            = calculateDays.CountDaySpecial();
                }

                if (employee.EmployeeDetails.Work.DimissionInfo != null)
                {
                    DateTime dimissionDate = employee.EmployeeDetails.Work.DimissionInfo.DimissionDate.AddDays(1);
                    if (dimissionDate > endDt)
                    {
                        _liZhiDay = 0;
                    }
                    else
                    {
                        var startDate = dimissionDate >= startDt ? dimissionDate : startDt;
                        var endDate   = endDt;
                        for (DateTime dt = startDate.Date; dt <= endDate.Date;)
                        {
                            var pd = planduty.Where(x => x.Date.Date == dt.Date).FirstOrDefault();
                            if (!pd.PlanDutyClass.IsWeek)
                            {
                                _liZhiDay++;
                            }
                            dt = dt.AddDays(1);
                        }
                    }
                }
            }
            _BindItemValueCollection.SetBindItemValue(BindItemEnum.NotEntryDays, _weiRuZhiDay);
            _BindItemValueCollection.SetBindItemValue(BindItemEnum.DimissionDays, _liZhiDay);
        }
Ejemplo n.º 2
0
        protected override void ExcuteSelf()
        {
            List <Contract> contractList =
                _IContract.GetEmployeeContractByCondition(-1, new DateTime(1900, 1, 1), new DateTime(2999, 12, 31),
                                                          _CurrDate.AddDays(_Days), _CurrDate.AddDays(_Days), -1);

            _MailBodyListToHR = new List <MailBody>();
            foreach (Contract contract in contractList)
            {
                Employee employee = _GetEmployee.GetEmployeeBasicInfoByAccountID(contract.EmployeeID);
                if (employee == null)
                {
                    continue;
                }
                if (employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee ||
                    employee.EmployeeType == EmployeeTypeEnum.BorrowedEmployee)
                {
                    continue;
                }

                StringBuilder emailContentBuilder = new StringBuilder();
                emailContentBuilder.Append(employee.Account.Name);
                emailContentBuilder.Append("的");
                emailContentBuilder.Append(contract.ContractType.ContractTypeName);
                emailContentBuilder.Append(contract.StartDate.ToShortDateString());
                emailContentBuilder.Append("---");
                emailContentBuilder.Append(contract.EndDate.ToShortDateString());
                emailContentBuilder.Append("还有" + _Days + "天即将到期;");
                emailContentBuilder.Append(Environment.NewLine);
                new AutoRemindServerUtility(_GetDiyProcess).CreateHREmail(contract.EmployeeID, _MailBodyListToHR,
                                                                          emailContentBuilder.ToString(),
                                                                          Environment.NewLine);
                employee.EmployeeDetails = null;
            }
            if (_MailBodyListToHR.Count > 0)
            {
                try
                {
                    //发给人事邮件
                    SendEmailToHR(_MailBodyListToHR);
                }
                catch
                {
                    throw new Exception("人力资源部邮件提醒发送失败");
                }
            }
        }
        ///<summary>
        ///</summary>
        ///<param name="from"></param>
        ///<param name="to"></param>
        ///<param name="accountList"></param>
        ///<param name="loginUser"></param>
        public void UpdateAttendanceForOperator(DateTime from, DateTime to,
                                                List <Account> accountList, Account loginUser)
        {
            //UpdateEmployeeAttendance updateEmployeeAttendance = new UpdateEmployeeAttendance(loginUser);

            List <Employee> AllEmployeeList = new List <Employee>();
            GetEmployee     getEmployee     = new GetEmployee();

            foreach (Account account in accountList)
            {
                AllEmployeeList.Add(getEmployee.GetEmployeeBasicInfoByAccountID(account.Id));
            }
            for (int i = 0; i < AllEmployeeList.Count; i++)
            {
                //找前一天数据
                DateTime tempDate = to;
                while (DateTime.Compare(Convert.ToDateTime(from.ToShortDateString()),
                                        Convert.ToDateTime(tempDate.ToShortDateString())) <= 0)
                {
                    AllEmployeeList[i] = _DalEmployee.GetEmployeeByAccountID(AllEmployeeList[i].Account.Id);
                    AllEmployeeList[i].EmployeeAttendance = new Model.EmployeeAttendance.AttendanceStatistics.EmployeeAttendance
                                                                (tempDate.AddDays(-1), tempDate);
                    AllEmployeeList[i].EmployeeAttendance.AttendanceInAndOutRecordList =
                        _DalRecord.GetAttendanceInAndOutRecordByCondition
                            (AllEmployeeList[i].Account.Id, "",
                            Convert.ToDateTime(tempDate.ToShortDateString() + " 00:00:00"),
                            Convert.ToDateTime(tempDate.ToShortDateString() + " 23:59:59"),
                            InOutStatusEnum.All, OutInRecordOperateStatusEnum.All,
                            Convert.ToDateTime("1900-1-1"), Convert.ToDateTime("2900-12-31"));
                    AllEmployeeList[i].EmployeeAttendance.DoorCardNo =
                        _DalEmployee.GetEmployeeBasicInfoByAccountID(AllEmployeeList[i].Account.Id).EmployeeAttendance.
                        DoorCardNo;
                    AllEmployeeList[i].EmployeeAttendance.PlanDutyDetailList =
                        new PlanDutyDal().GetPlanDutyDetailByAccount(
                            AllEmployeeList[i].Account.Id,
                            Convert.ToDateTime(tempDate.ToShortDateString() + " 00:00:00"),
                            Convert.ToDateTime(tempDate.ToShortDateString() + " 23:59:59"));

                    //updateEmployeeAttendance.
                    //    UpdateEmployeeDayAttendance(AllEmployeeList[i], tempDate);
                    tempDate = tempDate.AddDays(-1);
                }
            }
        }
Ejemplo n.º 4
0
        protected override void ExcuteSelf()
        {
            _MailBodyListToHR = new List <MailBody>();
            List <ApplyAssessCondition> applyAssessConditions = _IContract.GetApplyAssessConditionByCurrDate(_CurrDate);

            if (_CurrDate.Month == 12 && _CurrDate.Day == 1)
            {
                applyAssessConditions = applyAssessConditions ?? new List <ApplyAssessCondition>();
                var contracts = _IContract.GetEmployeeContractByContractTypeId(5);
                if (contracts != null)
                {
                    foreach (var contract in contracts)
                    {
                        applyAssessConditions.Add(new ApplyAssessCondition(0)
                        {
                            EmployeeContractID = contract.ContractID, ApplyAssessCharacterType = AssessCharacterType.Annual, AssessScopeFrom = new DateTime(_CurrDate.Year, 1, 1), AssessScopeTo = new DateTime(_CurrDate.Year, 12, 31)
                        });
                    }
                }
            }


            foreach (ApplyAssessCondition conditionItem in applyAssessConditions)
            {
                Contract contract = _IContract.GetEmployeeContractByContractId(conditionItem.EmployeeContractID);
                Employee employee = _GetEmployee.GetEmployeeBasicInfoByAccountID(contract.EmployeeID);
                if (employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee ||
                    employee.EmployeeType == EmployeeTypeEnum.BorrowedEmployee)
                {
                    continue;
                }
                Model.AssessActivity assessActivityItem = new Model.AssessActivity();
                assessActivityItem.AssessCharacterType = conditionItem.ApplyAssessCharacterType;
                assessActivityItem.ScopeFrom           = conditionItem.AssessScopeFrom;
                assessActivityItem.ScopeTo             = conditionItem.AssessScopeTo;
                assessActivityItem.ItsEmployee         = employee;
                assessActivityItem.EmployeeDept        = employee.Account.Dept.DepartmentName;
                assessActivityItem.AssessProposerName  = "系统自动发起";
                assessActivityItem.Reason = WriteEmailContent(assessActivityItem, contract);
                //新增考核活动
                _ManualAssess = new ManualAssess(assessActivityItem);
                try
                {
                    _ManualAssess.Excute();
                }
                catch (Exception ex)
                {
                    new AutoRemindServerUtility(_GetDiyProcess).CreateHREmail(employee.Account.Id,
                                                                              _MailBodyListToHR,
                                                                              "系统自动发起的" + employee.Account.Name +
                                                                              "绩效考核失败,失败原因:" + ex.Message + "(相关参考信息:" +
                                                                              assessActivityItem.Reason + ")",
                                                                              Environment.NewLine);
                }
                employee.EmployeeDetails = null;
            }
            if (_MailBodyListToHR.Count > 0)
            {
                try
                {
                    //发给人事邮件
                    SendEmailToHR(_MailBodyListToHR);
                }
                catch
                {
                    throw new Exception("人力资源部邮件提醒发送失败");
                }
            }
        }
Ejemplo n.º 5
0
        protected override void ExcuteSelf()
        {
            List <Model.Vacation> vacations = _Dal.GetAllVacation();
            string employeeNameFailEmail    = "";
            string hrFailEmail = "";

            _MailBodyListToHR = new List <MailBody>();
            foreach (Model.Vacation vacation in vacations)
            {
                if (DateTime.Compare(vacation.VacationEndDate, _CurrDate.AddDays(_Days)) == 0)
                {
                    Employee employee = _GetEmployee.GetEmployeeBasicInfoByAccountID(vacation.Employee.Account.Id);
                    if (employee == null)
                    {
                        continue;
                    }
                    if (employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee ||
                        employee.EmployeeType == EmployeeTypeEnum.BorrowedEmployee)
                    {
                        continue;
                    }
                    //年假到期前_Days提醒个人
                    try
                    {
                        SendEmailToEmployee(vacation.Employee.Account.Id);
                    }
                    catch
                    {
                        //拼接邮件发送失败人员姓名
                        if (string.IsNullOrEmpty(employeeNameFailEmail))
                        {
                            employeeNameFailEmail = vacation.Employee.Account.Name;
                        }
                        else
                        {
                            employeeNameFailEmail += "," + vacation.Employee.Account.Name;
                        }
                    }
                    //年假到期_Days提醒人事
                    new AutoRemindServerUtility(_GetDiyProcess).CreateHREmail(vacation.Employee.Account.Id,
                                                                              _MailBodyListToHR,
                                                                              vacation.Employee.Account.Name, ",");
                    employee.EmployeeDetails = null;
                }
            }
            if (_MailBodyListToHR.Count > 0)
            {
                try
                {
                    //发给人事邮件
                    SendEmailToHR(_MailBodyListToHR);
                }
                catch
                {
                    hrFailEmail = "人力资源部邮件提醒发送失败;";
                }
            }
            string throwmessage = "";

            if (!string.IsNullOrEmpty(hrFailEmail))
            {
                throwmessage += hrFailEmail;
            }
            if (!string.IsNullOrEmpty(employeeNameFailEmail))
            {
                throwmessage += "发送邮件失败。以下" + employeeNameFailEmail.Split(',').Length + "位员工没有获得系统提醒:" +
                                employeeNameFailEmail;
            }
            if (!string.IsNullOrEmpty(throwmessage))
            {
                throw new Exception(throwmessage);
            }
        }
Ejemplo n.º 6
0
        protected override void ExcuteSelf()
        {
            List <Model.Reimburse> reimburseList = _IReimburse.GetReimburseByDateTime();

            foreach (Model.Reimburse reimburse in reimburseList)
            {
                if (reimburse.ReimburseStatus != ReimburseStatusEnum.Reimbursing)
                {
                    continue;
                }
                Employee employee = _GetEmployee.GetEmployeeBasicInfoByAccountID(reimburse.ApplierID);
                if (employee == null)
                {
                    continue;
                }
                if (employee.EmployeeType == EmployeeTypeEnum.DimissionEmployee ||
                    employee.EmployeeType == EmployeeTypeEnum.BorrowedEmployee)
                {
                    continue;
                }
                Account  temp     = _AccountBll.GetAccountById(reimburse.ApplierID);
                MailBody mailBody = new MailBody();
                mailBody.MailTo  = RequestUtility.GetMail(temp);
                mailBody.Subject = "请尽快将以下提交的报销单送往财务处,谢谢。";
                StringBuilder emailContentBuilder = new StringBuilder();
                emailContentBuilder.Append(temp.Name + ",您好!");
                emailContentBuilder.Append("<br/>");
                emailContentBuilder.Append("您有一张报销单未送达财务处,请速将您的报销类型为:");
                emailContentBuilder.Append(reimburse.ReimburseCategoriesEnum.Name);
                emailContentBuilder.Append("消费时间:");
                emailContentBuilder.Append(reimburse.ConsumeDateFrom.ToShortDateString());
                emailContentBuilder.Append("日");
                emailContentBuilder.Append(reimburse.ConsumeDateFrom.Hour.ToString());
                emailContentBuilder.Append("时");
                emailContentBuilder.Append(reimburse.ConsumeDateFrom.Minute.ToString());
                emailContentBuilder.Append("分");
                emailContentBuilder.Append("---");
                emailContentBuilder.Append(reimburse.ConsumeDateTo.ToShortDateString());
                emailContentBuilder.Append("日");
                emailContentBuilder.Append(reimburse.ConsumeDateTo.Hour.ToString());
                emailContentBuilder.Append("时");
                emailContentBuilder.Append(reimburse.ConsumeDateTo.Minute.ToString());
                emailContentBuilder.Append("分");
                emailContentBuilder.Append("、");
                emailContentBuilder.Append("总额:");
                emailContentBuilder.Append(reimburse.TotalCost);
                emailContentBuilder.Append("元");
                emailContentBuilder.Append("的报销单送达财务处,谢谢。");
                emailContentBuilder.Append(Environment.NewLine);
                mailBody.Body = emailContentBuilder.ToString();
                try
                {
                    //发给员工邮件
                    _IMailGateWay.Send(mailBody);
                }
                catch
                {
                    throw new Exception("员工邮件提醒发送失败");
                }
                employee.EmployeeDetails = null;
            }
        }