Beispiel #1
0
        public bool RemoveUser(string userName)
        {
            Member member;

            try
            {
                member = ConnectionStubTemp.getMember(userName);
            }
            catch (WorkShopDbException dbExc)
            {
                throw dbExc;
            }
            catch (Exception ex)
            {
                Logger.Log("event", logLevel.INFO, "Admin fail removed user: "******" user doen't exist");
                throw new Exception(ex.ToString());
            }
            if (member.isStoresManagers())
            {
                int          count = member.storeManaging.Count - 1;
                StoreManager st    = member.storeManaging.ElementAt(count);
                try
                {
                    for (; count > -1; count--, st = member.storeManaging.ElementAt(count))
                    {
                        if (ConnectionStubTemp.getAllOwnersCount(st.store) == 1 /*st.GetFather() == null*/)///change to super father
                        {
                            Store store = st.GetStore();
                            WorkShop.closeStore(store.id, member);
                        }
                        else
                        {
                            StoreManager father = st.GetFather();
                            father.removeManager(st);
                        }
                    }
                } catch (Exception ex)
                {
                }
                ConnectionStubTemp.removeMember(member);
                Logger.Log("event", logLevel.INFO, "Admin succesfully removed user: "******"event", logLevel.INFO, "Admin succesfully removed user: " + userName);
                ConnectionStubTemp.removeMember(member);
                return(ConnectionStubTemp.removeUser(userName, this));
            }
        }