public void Install(Int32 accountId, Int32 appId, Int32 deskNum)
        {
            var accountResult = GetAccountInfoService(accountId);

            var realDeskId = GetRealDeskIdService(deskNum, accountResult.Config);

            var appResult = Query.FindOne(FilterFactory.Create<App>(app => app.AppAuditState == AppAuditState.Pass && app.AppReleaseState == AppReleaseState.Release && app.Id == appId));

            if (appResult == null)
            {
                throw new BusinessException($"应用添加失败,请刷新重试");
            }

            var newMember = new Member(appResult.Name, appResult.IconUrl, appResult.AppUrl, appResult.Id, appResult.Width, appResult.Height, appResult.IsLock, appResult.IsMax, appResult.IsFull, appResult.IsSetbar, appResult.IsOpenMax, appResult.IsFlash, appResult.IsDraw, appResult.IsResize);

            foreach (var desk in accountResult.Config.Desks)
            {
                if (desk.Id != realDeskId)
                {
                    continue;
                }

                desk.Members.Add(newMember);
                Repository.Create<Desk>().Update(desk);

                appResult.AddUseCount();
                Repository.Create<App>().Update(appResult);

                break;
            }
        }
        public void ModifyMemberInfo(Int32 accountId, Member member)
        {
            var accountResult = GetAccountInfoService(accountId);

            foreach (var desk in accountResult.Config.Desks)
            {
                var memberResult = InternalDeskMember(member.Id, desk);

                if (memberResult != null)
                {
                    memberResult.ModifyIcon(member.IconUrl)
                    .ModifyName(member.Name)
                    .ModifyWidth(member.Width)
                    .ModifyHeight(member.Height)
                    .ModifyIsResize(member.IsResize)
                    .ModifyIsOpenMax(member.IsOpenMax)
                    .ModifyIsFlash(member.IsFlash);

                    Repository.Create<Desk>().Update(desk);

                    break;
                }
            }

        }
Esempio n. 3
0
        public void AddMember(Member member)
        {
            if (member == null)
            {
                throw new ArgumentNullException($"{nameof(member)}不能为空");
            }

            Members.Add(member);
        }