Beispiel #1
0
        /// <summary>
        /// 增加一个职员
        /// </summary>
        /// <param name="staffInfo">职员信息</param>
        /// <param name="operatorId">操作员id</param>
        /// <param name="key">秘钥</param>
        /// <param name="originalRoleName">角色名</param>
        /// <returns></returns>
        public async Task AddOneStaff(StaffBsicInfoDto staffInfo, Guid operatorId, string key, string originalRoleName)
        {
            using (IStaffInfoService staffInfoService = new StaffInfoService())
            {
                var staff = new Model.StaffInfo()
                {
                    Name      = staffInfo.Name,
                    Tel       = staffInfo.Tel,
                    Password  = StringEncryptAndDecrypt.AESEncrypt(staffInfo.Tel, key),
                    Email     = staffInfo.Email,
                    Address   = staffInfo.Address,
                    IdCard    = staffInfo.IdCard,
                    ImagePath = staffInfo.ImagePath,
                    SectionId = staffInfo.SectionId,
                    Position  = staffInfo.Position
                };
                await staffInfoService.CreateAsync(staff);

                using (IAccountOperateLogService accountOperateLogService = new AccountOperateLogService())
                {
                    await accountOperateLogService.CreateAsync(new Model.AccountOperateLog()
                    {
                        OperatorId  = operatorId,
                        ModifiedId  = staff.Id,
                        OPerateType = "1"
                    });
                }

                //初始权限
                using (IStaffPowerInfoService staffPowerInfoService = new StaffPowerInfoService())
                {
                    using (IRoleInfoService roleInfoService = new RoleInfoService())
                    {
                        await staffPowerInfoService.CreateAsync(new Model.StaffPowerInfo()
                        {
                            StaffId = staff.Id,
                            RoleId  = (await roleInfoService.GetAll().Where(p => p.Name == "一级权限").FirstAsync()).Id
                        });
                    }
                }
            }
        }
Beispiel #2
0
 public async Task UpdateOneStaffInfo(StaffBsicInfoDto staffInfo, Guid operatorId)
 {
     throw new NotImplementedException();
 }