Пример #1
0
        public Result CreateApplyOfJob(ApplyJobDto applyJobDto, string account)
        {
            Worker     worker   = _ctx.Worker.SingleOrDefault(w => w.Account.Equals(account));
            int        informId = 0;
            ApplyFoJob apply    = new ApplyFoJob()
            {
                Content     = applyJobDto.Content,
                Type        = applyJobDto.Type,
                CreateTime  = DateTime.Now.ToFileTime(),
                WorkerId    = worker.Id,
                DeparmentId = worker.DepartmentId,
                CompanyId   = worker.CompanyId,
            };

            _ctx.ApplyFoJob.Add(apply);
            _ctx.SaveChanges();
            informId = AddInform(apply.Id, apply.WorkerId, "Job");
            Result result = new Result()
            {
                IsSuccess = true,
                Message   = "添加成功!",
                Id        = informId
            };

            return(result);
        }
Пример #2
0
        private void CheckApply(Worker worker, CheckDto checkDto)
        {
            string     state     = "";
            ApplyFoJob apply     = _ctx.ApplyFoJob.Find(checkDto.ApplicationId);
            string     stateName = _ctx.State.Find(worker.StateId).Name;

            apply.HandlerId = worker.Id;
            apply.HandlTime = DateTime.Now.ToFileTime();
            apply.Result    = checkDto.IsAgree;
            _ctx.SaveChanges();
            state = checkDto.IsAgree && apply.Type == "correction" ? "在职" : stateName;
            state = checkDto.IsAgree && apply.Type == "separation" ? "离职" : stateName;
            bool isDelete = checkDto.IsAgree ? false : true;

            UpdateUserState(apply.CompanyId, apply.WorkerId, state, isDelete);
        }