Ejemplo n.º 1
0
        /// <summary>
        /// 批量移动员工到指定组织机构
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">员工主键数组</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <returns>影响行数</returns>
        public int BatchMoveTo(UserInfo userInfo, string[] ids, string organizeId)
        {
            int returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.StaffService_BatchMoveTo);

            ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider =>
            {
                var manager  = new PiStaffOrganizeManager(dbProvider, userInfo);
                returnValue += ids.Sum(t => manager.SetProperty(PiStaffOrganizeTable.FieldStaffId, t, PiStaffOrganizeTable.FieldOrganizeId, organizeId));
            });

            return(returnValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除标志
        ///
        /// 删除员工时,需要把用户也给删除掉
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>影响行数</returns>
        public int SetDeleted(string id)
        {
            int returnValue = 0;
            // 先把用户设置为删除标记
            string userId = this.GetProperty(id, PiStaffTable.FieldUserId);

            if (!String.IsNullOrEmpty(userId))
            {
                PiUserManager userManager = new PiUserManager(DBProvider, UserInfo);
                returnValue += userManager.SetDeleted(userId);
            }

            PiStaffOrganizeManager staffOrganizeManager = new PiStaffOrganizeManager(DBProvider, UserInfo);

            returnValue += staffOrganizeManager.SetProperty(PiStaffOrganizeTable.FieldStaffId, id, BusinessLogic.FieldDeleteMark, "1");

            // 再把员工设置为删除标记
            returnValue += this.SetProperty(BusinessLogic.FieldId, id, BusinessLogic.FieldDeleteMark, "1");

            return(returnValue);
        }