コード例 #1
0
        /// <summary>
        /// 撤销离职
        /// </summary>
        /// <returns></returns>
        public JsonResult CancelRetire()
        {
            string listIDs = Request["ListIDs"];

            string[] idArray = listIDs.Split(',');
            foreach (string id in idArray)
            {
                S_HR_Employee model = this.ComprehensiveDbContext.Set <S_HR_Employee>().Find(id);
                if (model.EmployeeState == EmployeeState.ReEmployDimission.ToString())
                {
                    model.EmployeeState = EmployeeState.ReEmploy.ToString();
                }
                else
                {
                    model.EmployeeState = EmployeeState.Incumbency.ToString();
                }

                model.IsDeleted  = "0";
                model.DeleteTime = null;
            }
            this.ComprehensiveDbContext.SaveChanges();
            //恢复系统账号状态
            EmployeeFo fo = new EmployeeFo();

            fo.ResetSysUserState(listIDs);
            return(Json(""));
        }
コード例 #2
0
        public override JsonResult Save()
        {
            S_HR_EmployeeRetired model = UpdateEntity <S_HR_EmployeeRetired>();
            var employee = this.ComprehensiveDbContext.Set <S_HR_Employee>().Find(model.EmployeeID);

            if (employee == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("找不到该员工!");
            }
            employee.IsDeleted = "1";
            if (model.Type == "退休")
            {
                employee.EmployeeState = EmployeeState.Retire.ToString();
            }
            else if (employee.EmployeeState == EmployeeState.ReEmploy.ToString())
            {
                employee.EmployeeState = EmployeeState.ReEmployDimission.ToString();
            }
            else
            {
                employee.EmployeeState = EmployeeState.Dimission.ToString();
            }
            employee.DeleteTime = DateTime.Now;
            this.ComprehensiveDbContext.SaveChanges();
            //同步到系统用户表
            EmployeeFo fo = new EmployeeFo();

            fo.EmployeeDeleteToUser(employee);
            return(Json(new { ID = model.ID }));
            //return base.Save();
        }
コード例 #3
0
        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            var employee = ComprehensiveDbContext.Set <S_HR_Employee>().Find(dic.GetValue("EmployeeID"));
            var fo       = new EmployeeFo();

            fo.SyncDeptByJob(employee);
            //base.AfterSave(dic, formInfo, isNew);
        }
コード例 #4
0
        public override JsonResult Delete()
        {
            string listIDs = Request["ListIDs"];

            string[] idArray = listIDs.Split(',');
            ComprehensiveDbContext.Set <S_HR_Employee>().Where(c => idArray.Contains(c.ID)).Update(c =>
            {
                c.IsDeleted  = "1";
                c.DeleteTime = DateTime.Now;
            });
            ComprehensiveDbContext.SaveChanges();
            EmployeeFo fo = new EmployeeFo();

            fo.EmployeeDeleteToUser(listIDs);
            return(Json(""));
            //return base.Delete();
        }
コード例 #5
0
        public override JsonResult Delete()
        {
            string ids = Request["ListIDs"];

            string[] idArray    = ids.Split(',');
            string   employeeID = GetQueryString("EmployeeID");

            ComprehensiveDbContext.Set <S_HR_EmployeeJob>().Delete(c => idArray.Contains(c.ID));
            ComprehensiveDbContext.SaveChanges();

            var employee = ComprehensiveDbContext.Set <S_HR_Employee>().Find(employeeID);
            var fo       = new EmployeeFo();

            fo.SyncDeptByJob(employee);

            return(Json(""));
        }
コード例 #6
0
        /// <summary>
        /// 返聘
        /// </summary>
        /// <returns></returns>
        public JsonResult ReEmployee()
        {
            string listIDs = Request["ListIDs"];

            string[] idArray  = listIDs.Split(',');
            string   reEmploy = EmployeeState.ReEmploy.ToString();

            this.ComprehensiveDbContext.Set <S_HR_Employee>().Where(c => idArray.Contains(c.ID)).Update(c =>
            {
                c.IsDeleted     = "0";
                c.EmployeeState = reEmploy;
                c.DeleteTime    = null;
            });
            this.ComprehensiveDbContext.SaveChanges();
            //恢复系统账号状态
            EmployeeFo fo = new EmployeeFo();

            fo.ResetSysUserState(listIDs);
            return(Json(""));
        }
コード例 #7
0
        public JsonResult SyncSystemUser()
        {
            string Ids = Request["IDs"];

            if (string.IsNullOrWhiteSpace(Ids))
            {
                return(Json(""));
            }
            BaseEntities         baseEntities = FormulaHelper.GetEntities <BaseEntities>();
            EmployeeFo           fo           = new EmployeeFo();
            List <S_HR_Employee> employeeList = this.ComprehensiveDbContext.Set <S_HR_Employee>().Where(c => c.IsHaveAccount == "1" && Ids.Contains(c.ID)).ToList();

            if (employeeList == null || employeeList.Count == 0)
            {
                return(Json(""));
            }
            foreach (S_HR_Employee employee in employeeList)
            {
                if (string.IsNullOrEmpty(employee.UserID))
                {
                    fo.EmployeeAddToUser(employee, FormsAuthentication.HashPasswordForStoringInConfigFile(employee.Code.ToLower(), "SHA1"));
                }
                else
                {
                    var user = baseEntities.Set <S_A_User>().Find(employee.UserID);
                    if (user == null)
                    {
                        fo.EmployeeAddToUser(employee, FormsAuthentication.HashPasswordForStoringInConfigFile(employee.Code.ToLower(), "SHA1"));
                    }
                    else if (employee.IsDeleted == "0") //Update
                    {
                        fo.EmployeeUpdateToUser(employee);
                    }
                    else
                    {
                        fo.EmployeeDeleteToUser(employee);//Delete
                    }
                }
            }
            return(Json(JsonAjaxResult.Successful()));
        }