Inheritance: MonoBehaviour
        public GroupsResponse Post(Groups request)
        {
            if (request.Group.Id > 0)
              {
            Bm2s.Data.Common.BLL.User.Group item = Datas.Instance.DataStorage.Groups[request.Group.Id];
            item.Code = request.Group.Code;
            item.EndingDate = request.Group.EndingDate;
            item.IsSystem = request.Group.IsSystem;
            item.Name = request.Group.Name;
            item.StartingDate = request.Group.StartingDate;
            Datas.Instance.DataStorage.Groups[request.Group.Id] = item;
              }
              else
              {
            Bm2s.Data.Common.BLL.User.Group item = new Data.Common.BLL.User.Group()
            {
              Code = request.Group.Code,
              EndingDate = request.Group.EndingDate,
              IsSystem = request.Group.IsSystem,
              Name = request.Group.Name,
              StartingDate = request.Group.StartingDate
            };

            Datas.Instance.DataStorage.Groups.Add(item);
            request.Group.Id = item.Id;
              }

              GroupsResponse response = new GroupsResponse();
              response.Groups.Add(request.Group);
              return response;
        }
Esempio n. 2
0
        public GoTop()
        {
            d_boardModel = new BoardModel(19);
            d_groups = new Groups();

            Contract.Ensures(d_groups.count == 0);
        }
Esempio n. 3
0
 internal Factory(Groups groups, Favorites favorites, StoredCredentials credentials,
     PersistenceSecurity persistenceSecurity, DataDispatcher dispatcher)
 {
     this.groups = groups;
     this.favorites = favorites;
     this.credentials = credentials;
     this.persistenceSecurity = persistenceSecurity;
     this.dispatcher = dispatcher;
 }
Esempio n. 4
0
        public Person CreateUser(Guid personId, string login, string password, Groups groupName)
        {
            var group = this.groupRepository.GetEntitiesByQuery(v => v.Name == groupName.GetStringValue()).First();
            var personGroup = this.personGroupFactory.Create(Guid.NewGuid(), personId, group.Id, DateTime.Now);
            this.personGroupRepository.CreateOrUpdateEntity(personGroup);
            var credentials = this.credentialsFactory.Create(Guid.NewGuid(), personId, login, password);
            this.credentialsRepository.CreateOrUpdateEntity(credentials);

            return this.personRepository.GetEntityById(personId);
        }
        public GroupsResponse Delete(Groups request)
        {
            Bm2s.Data.Common.BLL.User.Group item = Datas.Instance.DataStorage.Groups[request.Group.Id];
              item.EndingDate = DateTime.Now;
              Datas.Instance.DataStorage.Groups[item.Id] = item;

              GroupsResponse response = new GroupsResponse();
              response.Groups.Add(request.Group);
              return response;
        }
Esempio n. 6
0
 internal static DbFavorite CreateFavorite(PersistenceSecurity persistenceSecurity, Groups groups,
     StoredCredentials credentials, DataDispatcher dispatcher)
 {
     var favorite = new DbFavorite();
     favorite.Display = new DbDisplayOptions();
     favorite.Security = new DbSecurityOptions();
     favorite.ExecuteBeforeConnect = new DbBeforeConnectExecute();
     favorite.AssignStores(groups, credentials, persistenceSecurity, dispatcher);
     favorite.MarkAsNewlyCreated();
     return favorite;
 }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of <see cref="Workspace"/> for a given <see cref="Token"/> with a given <see cref="ICommunication"/>
        /// </summary>
        /// <param name="token"><see cref="Token">Access token to use</see></param>
        /// <param name="communication"><see cref="ICommunication"/> to use</param>
        public Workspace(Token token, ICommunication communication)
        {
            _communication = communication;

            Groups = new Groups(token, communication);
            Datasets = new Datasets(token, communication);
            Tables = new Tables(token, communication);
            Rows = new Rows(token, communication);
            Dashboards = new Dashboards(token, communication);
            Reports = new Reports(token, communication);
            Tiles = new Tiles(token, communication);
        }
        public ActionResult Create(Guid gid)
        {
            var groups = new Groups();
            var group = groups.GetGroup(gid);

            var model = new TargetDetails()
            {
                Target = new Target() { GroupKey = gid },
                Group = group,
            };

            return View(model);
        }
Esempio n. 9
0
        public ActionResult AddTag(Guid id, string name, string value)
        {
            var groups = new Groups();
            var group = groups.GetGroup(id);
            if (group.Tags.ContainsKey(name))
                throw new HttpException(406, "Tag name already exists");

            group.Tags.Add(name, value);
            groups.UpdateGroup(group);
            if (Request.IsAjaxRequest())
                return Json(null);
            else
                return RedirectToAction("EditTags", new { id = id });
        }
Esempio n. 10
0
        public GroupsResponse Get(Groups request)
        {
            GroupsResponse response = new GroupsResponse();
              List<Bm2s.Data.Common.BLL.User.Group> items = new List<Data.Common.BLL.User.Group>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.Groups.Where(item =>
              (string.IsNullOrWhiteSpace(request.Code) || item.Code.ToLower().Contains(request.Code.ToLower())) &&
              (string.IsNullOrWhiteSpace(request.Name) || item.Name.ToLower().Contains(request.Name.ToLower())) &&
              (!request.IsSystem || item.IsSystem) &&
              (!request.Date.HasValue || (request.Date >= item.StartingDate && (!item.EndingDate.HasValue || request.Date < item.EndingDate.Value)))
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.Groups.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.User.Group()
                        {
                          Code = item.Code,
                          EndingDate = item.EndingDate,
                          Id = item.Id,
                          IsSystem = item.IsSystem,
                          Name = item.Name,
                          StartingDate = item.StartingDate
                        }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.Groups.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.Groups.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.Groups.Count + (collection.Count() % response.Groups.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
Esempio n. 11
0
        private void ReadGroups()
        {
            docNav = new XPathDocument(settings_path);
            nav = docNav.CreateNavigator();
            NodeIter = nav.Select("/serverlists/groups/group");
            
            this._alGroups.Clear();

            while (NodeIter.MoveNext())
            {
                Groups g = new Groups(NodeIter.Current);
                this._alGroups.Add(g);
            }
        }
Esempio n. 12
0
 public ActionResult Delete(Guid id)
 {
     var groups = new Groups();
     try
     {
         groups.DeleteGroup(id);
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Error", ex.Message);
         var model = groups.GetGroup(id);
         return View("ConfirmDelete", model);
     }
 }
Esempio n. 13
0
        public MessengerClient(Credentials credentials)
        {

            @lock = new AsyncReaderWriterLock();

            this.credentials = credentials;

            userCache = new Dictionary<string, WeakReference>();

            privacySettings = new Dictionary<PrivacySetting, string>();
            UserLists = new UserLists(this);
            Groups = new Groups();
            IMSessions = new IMSessions();

        }
Esempio n. 14
0
        public ActionResult ConfirmDelete(Guid id)
        {
            var targets = new Targets();
            var groups = new Groups();

            var target = targets.GetTarget(id);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetDetails()
            {
                Target = target,
                Group = group,
            };

            return View(model);
        }
        //
        // GET: /Instances/Create
        public ActionResult Create(Guid tid)
        {
            var targets = new Targets();
            var groups = new Groups();

            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new InstanceDetails()
            {
                Instance = new Instance(),
                Target = target,
                Group = group,
            };

            return View(model);
        }
Esempio n. 16
0
        public Person Validate(string login, string password, Groups groupName)
        {
            var credentials = this.credentialsRepository.GetEntitiesByQuery(v => v.Login == login && v.Password == password)
                .FirstOrDefault();
            if (credentials == null)
            {
                return null;
            }

            var personGroup = this.personGroupRepository.GetEntitiesByQuery(v => v.PersonId == credentials.PersonId && v.Group.Name == groupName.GetStringValue()).FirstOrDefault();
            if (personGroup == null)
            {
                return null;
            }

            return this.personRepository.GetEntityById(credentials.PersonId);
        }
        //
        // GET: /TargetApps/
        public ActionResult Index(Guid tid, string q = null, int o = 0, int c = 50)
        {
            var targetApps = new TargetApps();
            var targets = new Targets();
            var groups = new Groups();

            var targetAppList = targetApps.SearchTargetApps(tid, q, o, c);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppsIndex()
            {
                TargetAppList = targetAppList,
                Target = target,
                Group = group,
            };
            return View(model);
        }
Esempio n. 18
0
        public ActionResult ConfirmDelete(Guid id)
        {
            var versions = new Versions();
            var apps = new Apps();
            var groups = new Groups();

            var version = versions.GetVersion(id);
            var app = apps.GetApp(version.AppKey);
            var group = groups.GetGroup(app.GroupKey);

            var model = new VersionDetails()
            {
                Version = version,
                App = app,
                Group = group,
            };
            return View(model);
        }
 public override bool tryPartition(IGraph graph, BackgroundWorker bgw, out Groups results)
 {
     ICollection<Motif> oMotifs;
     Groups oGroups;
     int i = 0;
     bool rv = TryCalculateDConnectorMotifs(graph, m_iDMinimum, m_iDMaximum, bgw, out oMotifs);
     if (rv == true)
     {
         oGroups = new Groups(oMotifs.Count);
         foreach (Motif m in oMotifs)
         {
             oGroups.Add(i, (DConnectorMotif)m);
             i++;
         }
     }
     else oGroups = new Groups(1);
     results = oGroups;
     return rv;
 }
        //
        // GET: /Instances/ConfirmDelete/5
        public ActionResult ConfirmDelete(Guid id)
        {
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var instance = instances.GetInstance(id);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new InstanceDetails()
            {
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
        public override bool tryPartition(IGraph graph, BackgroundWorker bgw, out Groups results)
        {
            ICollection<Community> oGraphMetrics;
            Groups oGroups;
            int i = 1;
            bool rv = TryCalculateClustersWakitaTsurumi(graph, bgw, out oGraphMetrics);
            if (rv == true)
            {
                oGroups = new Groups(oGraphMetrics.Count);
                foreach (Community m in oGraphMetrics)
                {
                    oGroups.Add(i, m);
                    i++;
                }
            }
            else oGroups = new Groups(1);
            results = oGroups;
            return rv;

        }
Esempio n. 22
0
        public ActionResult Create(Group postedGroup)
        {
            var newGroup = new Group()
            {
                Name = postedGroup.Name,
            };

            try
            {
                var groups = new Groups();
                groups.CreateGroup(newGroup);
                return RedirectToAction("Details", new { id = newGroup.Key });
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex);
            }

            return View(newGroup);
        }
Esempio n. 23
0
    public bool insertGroup(Groups obj,int uid)
    {
        // create a new base group

        //Groups obj = new Groups();
        int gid=returnGroupId();
        cmd = new SqlCommand("insertGroup", con);
        SqlParameter sp_gid = new SqlParameter("@gid", gid);
        SqlParameter sp_gn = new SqlParameter("@gn", obj.groupName);
        SqlParameter sp_card = new SqlParameter("@card", obj.cardinality);
        SqlParameter sp_gtid = new SqlParameter("@gtid", obj.groupTypeId);
        cmd.Parameters.Add(sp_gid);
        cmd.Parameters.Add(sp_gn);
        cmd.Parameters.Add(sp_card);
        cmd.Parameters.Add(sp_gtid);
        cmd.CommandType = CommandType.StoredProcedure;
        int res1 = cmd.ExecuteNonQuery(); // check for res1

        // now insert the value in Users_Group Table cor cross-referencing.

        return true;
    }
Esempio n. 24
0
        //
        // GET: /Logs/
        public ActionResult Index(Guid iid, string m = null, int c = 50)
        {
            var logs = new Logs();
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var logPage = logs.GetLogEntryPage(iid, m, c);
            var instance = instances.GetInstance(iid);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new LogIndex()
            {
                LogEntryPage = logPage,
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
Esempio n. 25
0
        public ActionResult Details(Guid iid, long t, LogStatus s)
        {
            var logs = new Logs();
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var log = logs.GetLogEntry(iid, new DateTime(t, DateTimeKind.Utc), s);
            var instance = instances.GetInstance(iid);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new LogDetails()
            {
                LogEntry = log,
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
        public ActionResult Version(Guid tid, Guid aid)
        {
            var targetAppVersions = new TargetAppVersions();
            var versions = new Versions();
            var apps = new Apps();
            var targets = new Targets();
            var groups = new Groups();

            Version version;
            var versionKey = targetAppVersions.GetTargetAppVersion(tid, aid);
            if (versionKey.HasValue)
            {
                try
                {
                    version = versions.GetVersion(versionKey.Value);
                }
                catch (Exception)
                {
                    version = null;
                }
            }
            else
            {
                version = null;
            }

            var app = apps.GetApp(aid);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppVersionDetails()
            {
                Version = version,
                App = app,
                Target = target,
                Group = group,
            };
            return View(model);
        }
Esempio n. 27
0
        public ActionResult Create(Guid aid)
        {
            var apps = new Apps();
            var groups = new Groups();

            var app = apps.GetApp(aid);
            var group = groups.GetGroup(app.GroupKey);
            var version = new Version()
            {
                AppKey = aid,
                GroupKey = group.Key,
                VersionNumber = string.Format("{0}.{1}", app.MajorVersion, app.Revision)
            };

            var model = new VersionDetails()
            {
                Version = version,
                App = app,
                Group = group,
            };

            return View(model);
        }
Esempio n. 28
0
 public async Task LeaveGroup(string groupName)
 {
     await Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName);
 }
Esempio n. 29
0
 // Server side methods called from client
 public Task Subscribe(string chatroom)
 {
     return(Groups.Add(Context.ConnectionId, chatroom.ToString()));
 }
 public void JoinGroup(int groupId)
 {
     Groups.Add(Context.ConnectionId, "group_" + groupId.ToString());
 }
Esempio n. 31
0
 public async Task SubscribeToGroupAsync(string groupName, string auth0Id)
 {
     await Groups.AddToGroupAsync(auth0Id, groupName);
 }
Esempio n. 32
0
        public async Task RemoveFromGroup(string groupName)
        {
            await Groups.RemoveFromGroupAsync(Context.ConnectionId, groupName);

            await Clients.Group(groupName).SendAsync("Send", $"{Context.ConnectionId} has left the group {groupName}.");
        }
Esempio n. 33
0
 public Task JoinAdminGroup()
 {
     return(Groups.AddAsync(Context.ConnectionId, ADMIN_GROUP));
 }
Esempio n. 34
0
        // protected readonly MyContext _context;
        // public ChatHub(MyContext context)
        // {
        //     _context = context;
        // }

        public async Task JoinGroupPlace(string groupName)
        {
            await Groups.AddToGroupAsync(Context.ConnectionId, groupName);
        }
Esempio n. 35
0
        public async Task LeaveGroup(string groupName)
        {
            await Groups.RemoveAsync(Context.ConnectionId, groupName);

            await Clients.Group(groupName).Send($"{Context.ConnectionId} left {groupName}");
        }
Esempio n. 36
0
        public void ParsePacket(string data)
        {
            string text = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];

            string text2 = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];

            GameClient client  = null;
            DataRow    dataRow = null;

            string text3 = text.ToLower();

            if (text3 != null)
            {
                if (MusCommands.dictionary_0 == null)
                {
                    MusCommands.dictionary_0 = new Dictionary <string, int>(29)
                    {
                        {
                            "update_items",
                            0
                        },

                        {
                            "update_catalogue",
                            1
                        },

                        {
                            "update_catalog",
                            2
                        },

                        {
                            "updateusersrooms",
                            3
                        },

                        {
                            "senduser",
                            4
                        },

                        {
                            "updatevip",
                            5
                        },

                        {
                            "giftitem",
                            6
                        },

                        {
                            "giveitem",
                            7
                        },

                        {
                            "unloadroom",
                            8
                        },

                        {
                            "roomalert",
                            9
                        },

                        {
                            "updategroup",
                            10
                        },

                        {
                            "updateusersgroups",
                            11
                        },

                        {
                            "shutdown",
                            12
                        },

                        {
                            "update_filter",
                            13
                        },

                        {
                            "refresh_filter",
                            14
                        },

                        {
                            "updatecredits",
                            15
                        },

                        {
                            "updatesettings",
                            16
                        },

                        {
                            "updatepixels",
                            17
                        },

                        {
                            "updatepoints",
                            18
                        },

                        {
                            "reloadbans",
                            19
                        },

                        {
                            "update_bots",
                            20
                        },

                        {
                            "signout",
                            21
                        },

                        {
                            "exe",
                            22
                        },

                        {
                            "alert",
                            23
                        },

                        {
                            "sa",
                            24
                        },

                        {
                            "ha",
                            25
                        },

                        {
                            "hal",
                            26
                        },

                        {
                            "updatemotto",
                            27
                        },

                        {
                            "updatelook",
                            28
                        }
                    };
                }

                int num;

                if (MusCommands.dictionary_0.TryGetValue(text3, out num))
                {
                    uint   num2;
                    uint   uint_2;
                    Room   class4;
                    uint   num3;
                    string text5;

                    switch (num)
                    {
                    case 0:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetItemManager().method_0(class2);
                            goto IL_C70;
                        }

                    case 1:
                    case 2:
                        break;

                    case 3:
                    {
                        Habbo class3 = GoldTree.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                            {
                                class3.method_1(class2);
                                goto IL_C70;
                            }
                        }
                        goto IL_C70;
                    }

                    case 4:
                        goto IL_34E;

                    case 5:
                    {
                        Habbo class3 = GoldTree.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.UpdateRights();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    case 6:
                    case 7:
                    {
                        num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint uint_ = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        int int_ = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[2]);
                        string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);
                        GoldTree.GetGame().GetCatalog().method_7(string_, num2, uint_, int_);
                        goto IL_C70;
                    }

                    case 8:
                        uint_2 = uint.Parse(text2);
                        class4 = GoldTree.GetGame().GetRoomManager().GetRoom(uint_2);
                        GoldTree.GetGame().GetRoomManager().method_16(class4);
                        goto IL_C70;

                    case 9:
                        num3 = uint.Parse(text2.Split(new char[]
                        {
                            ' '
                        })[0]);
                        class4 = GoldTree.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            string string_2 = text2.Substring(num3.ToString().Length + 1);
                            for (int i = 0; i < class4.RoomUsers.Length; i++)
                            {
                                RoomUser class5 = class4.RoomUsers[i];
                                if (class5 != null)
                                {
                                    class5.GetClient().SendNotification(string_2);
                                }
                            }
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 10:
                    {
                        int int_2 = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            Groups.smethod_3(class2, int_2);
                            goto IL_C70;
                        }
                    }

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_602;

                    case 13:
                    case 14:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            ChatCommandHandler.InitWords(class2);
                            goto IL_C70;
                        }

                    case 15:
                        goto IL_633;

                    case 16:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().LoadServerSettings(class2);
                            goto IL_C70;
                        }

                    case 17:
                        goto IL_6F7;

                    case 18:
                        client = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                        if (client != null)
                        {
                            client.GetHabbo().UpdateVipPoints(true, false);
                            goto IL_C70;
                        }
                        goto IL_C70;

                    case 19:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetBanManager().Initialise(class2);
                        }
                        GoldTree.GetGame().GetClientManager().method_28();
                        goto IL_C70;

                    case 20:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            GoldTree.GetGame().GetBotManager().method_0(class2);
                            goto IL_C70;
                        }

                    case 21:
                        goto IL_839;

                    case 22:
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(text2);
                            goto IL_C70;
                        }

                    case 23:
                        goto IL_880;

                    case 24:
                    {
                        ServerMessage Message = new ServerMessage(134u);
                        Message.AppendUInt(0u);
                        Message.AppendString("PHX: " + text2);
                        GoldTree.GetGame().GetClientManager().method_16(Message, Message);
                        goto IL_C70;
                    }

                    case 25:
                    {
                        ServerMessage Message2 = new ServerMessage(808u);
                        Message2.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("mus_ha_title"));
                        Message2.AppendStringWithBreak(text2);
                        ServerMessage Message3 = new ServerMessage(161u);
                        Message3.AppendStringWithBreak(text2);
                        GoldTree.GetGame().GetClientManager().method_15(Message2, Message3);
                        goto IL_C70;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message4 = new ServerMessage(161u);
                        Message4.AppendStringWithBreak(string.Concat(new string[]
                            {
                                GoldTreeEnvironment.GetExternalText("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                GoldTreeEnvironment.GetExternalText("mus_hal_tail")
                            }));
                        Message4.AppendStringWithBreak(text4);
                        GoldTree.GetGame().GetClientManager().BroadcastMessage(Message4);
                        goto IL_C70;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        client = GoldTree.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1");
                        }
                        client.GetHabbo().Figure          = (string)dataRow["look"];
                        client.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        client.GetHabbo().Motto           = GoldTree.FilterString((string)dataRow["motto"]);
                        client.GetHabbo().BlockNewFriends = GoldTree.StringToBoolean(dataRow["block_newfriends"].ToString());
                        ServerMessage Message5            = new ServerMessage(266u);
                        Message5.AppendInt32(-1);
                        Message5.AppendStringWithBreak(client.GetHabbo().Figure);
                        Message5.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                        Message5.AppendStringWithBreak(client.GetHabbo().Motto);
                        client.SendMessage(Message5);
                        if (client.GetHabbo().InRoom)
                        {
                            class4 = GoldTree.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class6   = class4.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message6 = new ServerMessage(266u);
                            Message6.AppendInt32(class6.VirtualId);
                            Message6.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message6.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message6.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message6.AppendInt32(client.GetHabbo().AchievementScore);
                            Message6.AppendStringWithBreak("");
                            class4.SendMessage(Message6, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_C70;
                        }
                        if (text3 == "updatemotto")
                        {
                            client.GetHabbo().MottoAchievementsCompleted();
                            goto IL_C70;
                        }
                        if (text3 == "updatelook")
                        {
                            client.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_C70;
                        }
                        goto IL_C70;
                    }

                    default:
                        goto IL_C70;
                    }
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        GoldTree.GetGame().GetCatalog().method_0(class2);
                    }
                    GoldTree.GetGame().GetCatalog().method_1();
                    GoldTree.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(441u));
                    goto IL_C70;
IL_34E:
                    num2 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[0]);
                    num3 = uint.Parse(text2.Split(new char[]
                    {
                        ' '
                    })[1]);
                    GameClient class7 = GoldTree.GetGame().GetClientManager().method_2(num2);
                    class4 = GoldTree.GetGame().GetRoomManager().GetRoom(num3);
                    if (class7 != null)
                    {
                        ServerMessage Message7 = new ServerMessage(286u);
                        Message7.AppendBoolean(class4.IsPublic);
                        Message7.AppendUInt(num3);
                        class7.SendMessage(Message7);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                    {
                        GoldTree.GetGame().GetClientManager().method_2(uint_2).GetHabbo().method_0(class2);
                        goto IL_C70;
                    }
IL_602:
                    GoldTree.Close();
                    goto IL_C70;
IL_633:
                    client = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().Credits = int_3;
                        client.GetHabbo().UpdateCredits(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_6F7:
                    client = GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1")[0];
                        }
                        client.GetHabbo().ActivityPoints = int_4;
                        client.GetHabbo().UpdateActivityPoints(false);
                        goto IL_C70;
                    }
                    goto IL_C70;
IL_839:
                    GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text2)).method_12();
                    goto IL_C70;
IL_880:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);
                    ServerMessage Message8 = new ServerMessage(808u);
                    Message8.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("mus_alert_title"));
                    Message8.AppendStringWithBreak(text5);
                    GoldTree.GetGame().GetClientManager().method_2(uint.Parse(text6)).SendMessage(Message8);
                }
            }
IL_C70:
            ServerMessage Message9 = new ServerMessage(1u);

            Message9.AppendString("Hello Housekeeping, Love from GoldTree Emu");
            this.ClientSocket.Send(Message9.GetBytes());
        }
Esempio n. 37
0
        public async Task<IHttpActionResult> PostGroups(GroupsViewModel groups)
        {
            Groups newGroup = new Groups()
            {
                name = groups.name,
                created_at = groups.created_at,
                description = groups.description,
                owner_id = groups.owner_id,
            };

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Groups.Add(newGroup);
            await db.SaveChangesAsync();

            var retGroup = Mapper.Map<GroupsViewModel>(newGroup);
            return CreatedAtRoute("DefaultApi", new { id = newGroup.id }, retGroup);
        }
Esempio n. 38
0
 private string GetGroupName(Groups group)
 {
     string criteria = string.Empty;
     switch (group)
     {
         case Groups.Managers:
             criteria = Messages.Title_SessionManagers;
             break;
         case Groups.Tools:
             criteria = Messages.Title_Tools;
             break;
         case Groups.GlobalTools:
             criteria = Messages.Title_GlobalTools;
             break;
         case Groups.DebugTools:
             criteria = Messages.Title_DebugTools;
             break;
         default:
             Assert.FailOnEnumeration(group);
             break;
     }
     return criteria;
 }
Esempio n. 39
0
 /// <summary>
 /// Check that the requirements for running the game in a live virtual environment are met
 /// </summary>
 ///
 /// <exception cref="GroupsSetupException">Thrown if a groups setup requirement wasn't met</exception>
 protected void CheckVeRequirements()
 {
     Groups.CheckForRequiredSetup();
 }
Esempio n. 40
0
        protected override void Serialize(IDictionary <string, object> json)
        {
            if (Transport.Read.Url == null)
            {
                // If Url is not set assume the current url (used in server binding)
                Transport.Read.Url = "";
            }

            var transport = Transport.ToJson();

            if (transport.Keys.Any())
            {
                json["transport"] = transport;
            }

            if (PageSize > 0)
            {
                json["pageSize"] = PageSize;
                json["page"]     = Page;
                json["total"]    = Total;
            }

            if (ServerPaging)
            {
                json["serverPaging"] = ServerPaging;
            }

            if (ServerSorting)
            {
                json["serverSorting"] = ServerSorting;
            }

            if (ServerFiltering)
            {
                json["serverFiltering"] = ServerFiltering;
            }

            if (ServerGrouping)
            {
                json["serverGrouping"] = ServerGrouping;
            }

            if (ServerAggregates)
            {
                json["serverAggregates"] = ServerAggregates;
            }

            if (Type != null)
            {
                json["type"] = "aspnetmvc-" + Type.ToString().ToLower();
            }

            if (OrderBy.Any())
            {
                json["sort"] = OrderBy.ToJson();
            }

            if (Groups.Any())
            {
                json["group"] = Groups.ToJson();
            }

            if (Aggregates.Any())
            {
                json["aggregate"] = Aggregates.SelectMany(agg => agg.Aggregates.ToJson());
            }

            if (Filters.Any() || ServerFiltering)
            {
                json["filter"] = Filters.OfType <FilterDescriptorBase>().ToJson();
            }

            if (Events.Keys.Any())
            {
                json.Merge(Events);
            }

            json["schema"] = Schema.ToJson();

            if (Batch)
            {
                json["batch"] = Batch;
            }

            if (IsClientOperationMode && RawData != null)
            {
                json["data"] = new Dictionary <string, object>()
                {
                    { Schema.Data, SerializeDataSource(RawData) },
                    { Schema.Total, Total }
                };
            }
            else if (Type == DataSourceType.Ajax && !IsClientOperationMode && Data != null)
            {
                json["data"] = new Dictionary <string, object>()
                {
                    { Schema.Data, SerializeDataSource(Data) },
                    { Schema.Total, Total }
                };
            }
        }
Esempio n. 41
0
 /// <summary>
 /// Returns the selected groups.
 /// </summary>
 /// <param name="currentSchedule">The current schedule.</param>
 /// <returns></returns>
 public List <CheckInGroup> SelectedGroups(CheckInSchedule currentSchedule)
 {
     return((currentSchedule != null && currentSchedule.Schedule != null) ?
            Groups.Where(g => g.SelectedForSchedule.Contains(currentSchedule.Schedule.Id)).ToList() :
            Groups.Where(g => g.Selected).ToList());
 }
Esempio n. 42
0
 public void Join(string roomID)
 {
     Groups.Add(Context.ConnectionId, "Room_" + roomID);
 }
Esempio n. 43
0
 public Task JoinGroup(string group)
 {
     return(Groups.AddToGroupAsync(Context.ConnectionId, group));
 }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room     room     = Session.GetHabbo().CurrentRoom;
            RoomData roomData = room.RoomData;

            if ((room != null) && room.CheckRights(Session, true))
            {
                int           num     = Event.PopWiredInt32();
                string        str     = Essential.FilterString(Event.PopFixedString());
                string        str2    = Essential.FilterString(Event.PopFixedString());
                int           num2    = Event.PopWiredInt32();
                string        str3    = Essential.FilterString(Event.PopFixedString());
                int           num3    = Event.PopWiredInt32();
                int           id      = Event.PopWiredInt32();
                int           num5    = Event.PopWiredInt32();
                List <string> tags    = new List <string>();
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < num5; i++)
                {
                    if (i > 0)
                    {
                        builder.Append(",");
                    }
                    string item = Essential.FilterString(Event.PopFixedString().ToLower());
                    tags.Add(item);
                    builder.Append(item);
                }
                int  num7  = Event.PopWiredInt32();
                bool k     = Event.PopWiredBoolean();
                bool flag2 = Event.PopWiredBoolean();
                bool flag3 = Event.PopWiredBoolean();
                bool flag4 = Event.PopWiredBoolean();
                int  num8  = Event.PopWiredInt32();
                int  num9  = Event.PopWiredInt32();
                if ((num8 < -2) || (num8 > 1))
                {
                    num8 = 0;
                }
                if ((num9 < -2) || (num9 > 1))
                {
                    num9 = 0;
                }
                if (((str.Length >= 1) && ((num2 >= 0) && (num2 <= 2))) && ((num3 >= 10) && (num3 <= 500)))
                {
                    FlatCat flatCat = Essential.GetGame().GetNavigator().GetFlatCat(id);
                    if (flatCat != null)
                    {
                        if (flatCat.MinRank > Session.GetHabbo().Rank)
                        {
                            Session.SendNotification("Du hast nicht die dafür vorgegebene Rechte!");
                            id = 0;
                        }
                        room.AllowPet                  = k;
                        room.AllowPetsEating           = flag2;
                        room.AllowWalkthrough          = flag3;
                        room.Hidewall                  = flag4;
                        room.RoomData.AllowPet         = k;
                        room.RoomData.AllowPetsEating  = flag2;
                        room.RoomData.AllowWalkthrough = flag3;
                        room.RoomData.Hidewall         = flag4;
                        room.Name                 = str;
                        room.State                = num2;
                        room.Description          = str2;
                        room.Category             = id;
                        room.Password             = str3;
                        room.RoomData.Name        = str;
                        room.RoomData.State       = num2;
                        room.RoomData.Description = str2;
                        room.RoomData.Category    = id;
                        room.RoomData.Password    = str3;
                        room.Tags.Clear();
                        room.Tags.AddRange(tags);
                        room.UsersMax = num3;
                        room.RoomData.Tags.Clear();
                        room.RoomData.Tags.AddRange(tags);
                        room.RoomData.UsersMax   = num3;
                        room.Wallthick           = num8;
                        room.Floorthick          = num9;
                        room.RoomData.Wallthick  = num8;
                        room.RoomData.Floorthick = num9;
                        string str5 = "open";
                        if (room.State == 1)
                        {
                            str5 = "locked";
                        }
                        else if (room.State > 1)
                        {
                            str5 = "password";
                        }
                        using (DatabaseClient adapter = Essential.GetDatabase().GetClient())
                        {
                            adapter.AddParamWithValue("caption", room.Name);
                            adapter.AddParamWithValue("description", room.Description);
                            adapter.AddParamWithValue("password", room.Password);
                            adapter.AddParamWithValue("tags", builder.ToString());
                            adapter.ExecuteQuery(string.Concat(new object[] {
                                "UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '", id, "', state = '", str5, "', tags = @tags, users_max = '", num3, "', allow_pets = '", (k ? 1 : 0), "', allow_pets_eat = '", (flag2 ? 1 : 0), "', allow_walkthrough = '", (flag3 ? 1 : 0), "', allow_hidewall = '", (room.Hidewall ? 1 : 0), "', floorthick = '", room.Floorthick,
                                "', wallthick = '", room.Wallthick, "' WHERE id = ", room.Id
                            }));
                        }

                        ServerMessage UpdateRoomOne = new ServerMessage(Outgoing.UpdateRoomOne);
                        UpdateRoomOne.AppendInt32(room.Id);
                        Session.SendMessage(UpdateRoomOne);

                        ServerMessage WallAndFloor = new ServerMessage(Outgoing.ConfigureWallandFloor);
                        WallAndFloor.AppendBoolean(room.Hidewall);
                        WallAndFloor.AppendInt32(room.Wallthick);
                        WallAndFloor.AppendInt32(room.Floorthick);
                        Session.GetHabbo().CurrentRoom.SendMessage(WallAndFloor, null);

                        RoomData data2 = room.RoomData;

                        ServerMessage RoomDataa = new ServerMessage(Outgoing.RoomData);
                        RoomDataa.AppendBoolean(false);
                        RoomDataa.AppendInt32(room.Id);
                        RoomDataa.AppendString(room.Name);
                        RoomDataa.AppendBoolean(true);
                        RoomDataa.AppendInt32(room.OwnerId);
                        RoomDataa.AppendString(room.Owner);
                        RoomDataa.AppendInt32(room.State);
                        RoomDataa.AppendInt32(room.UsersNow);
                        RoomDataa.AppendInt32(room.UsersMax);
                        RoomDataa.AppendString(room.Description);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32((room.Category == 0x34) ? 2 : 0);
                        RoomDataa.AppendInt32(room.Score);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(room.Category);

                        if (room.RoomData.GuildId == 0)
                        {
                            RoomDataa.AppendInt32(0);
                            RoomDataa.AppendInt32(0);
                        }
                        else
                        {
                            GroupsManager guild = Groups.GetGroupById(room.RoomData.GuildId);
                            RoomDataa.AppendInt32(guild.Id);
                            RoomDataa.AppendString(guild.Name);
                            RoomDataa.AppendString(guild.Badge);
                        }

                        RoomDataa.AppendString("");
                        RoomDataa.AppendInt32(room.Tags.Count);

                        foreach (string str6 in room.Tags)
                        {
                            RoomDataa.AppendString(str6);
                        }

                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendBoolean(true);
                        RoomDataa.AppendBoolean(true);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendBoolean(false);
                        RoomDataa.AppendBoolean(false);
                        RoomDataa.AppendBoolean(false);

                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendInt32(0);
                        RoomDataa.AppendBoolean(false);
                        RoomDataa.AppendBoolean(true);
                        Session.GetHabbo().CurrentRoom.SendMessage(RoomDataa, null);
                    }
                }
            }
        }
Esempio n. 45
0
 public async Task UnsubscribeFromGroupAsync(string groupName, string auth0Id)
 {
     await Groups.RemoveFromGroupAsync(auth0Id, groupName);
 }
Esempio n. 46
0
 public void ResetGroup()
 {
     Group = (dynamic)originalValues["Group"];
 }
 public void LeaveGroup(int groupId)
 {
     Groups.Remove(Context.ConnectionId, "group_" + groupId.ToString());
 }
Esempio n. 48
0
    protected void btn_insert_update_Click(object sender, EventArgs e)
    {
        #region Image
        string vimg       = "";
        string vimg_thumb = "";
        if (flimg.PostedFile.ContentLength > 0)
        {
            string filename = flimg.FileName;
            string fileex   = filename.Substring(filename.LastIndexOf("."));
            string path     = Request.PhysicalApplicationPath + "/" + pic + "/";
            if (ImagesExtension.ValidType(fileex))
            {
                string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1));
                if (fileNotEx.Length > 9)
                {
                    fileNotEx = fileNotEx.Remove(9);
                }
                string ticks = DateTime.Now.Ticks.ToString();
                #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không.
                //Kiểm tra xem có tạo ảnh nhỏ hay ko
                //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng
                //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng
                //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu:   tên_tệp_HasThumb_Thumb.phần_mở_rộng
                //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc
                //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi ImagesExtension.GetImage, lập trình không cần làm gì thêm.
                if (cbTaoAnhNho.Checked)
                {
                    vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex;
                }
                else
                {
                    vimg = fileNotEx + "_" + ticks + fileex;
                }
                flimg.SaveAs(path + vimg);
                #endregion
                #region Hạn chế kích thước
                if (cbHanCheKichThuoc.Checked)
                {
                    ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text);
                }
                #endregion
                #region Đóng dấu ảnh
                if (cbDongDauAnh.Checked)
                {
                    ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value);
                }
                #endregion
                #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu
                if (cbTaoAnhNho.Checked)
                {
                    vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex;
                    ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text);
                }
                #endregion
            }
        }
        #endregion
        #region Status
        string status = "0";
        if (chk_status.Checked == true)
        {
            status = "1";
        }
        #endregion

        #region Seo
        if (textLinkRewrite.Text.Trim().Equals(""))
        {
            textLinkRewrite.Text = txt_title_modul.Text;
        }
        if (textTagTitle.Text.Trim().Equals(""))
        {
            textTagTitle.Text = txt_title_modul.Text;
        }
        if (textTagKeyword.Text.Trim().Equals(""))
        {
            textTagKeyword.Text = txt_title_modul.Text;
        }
        if (textTagDescription.Text.Trim().Equals(""))
        {
            textTagDescription.Text = txtDesc.Text;
        }
        #endregion

        #region Insert
        if (insert)
        {
            Groups.InsertGroups(language, app, DdlGroupProduct.SelectedValue, txt_title_modul.Text, txtDesc.Text, "", textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", vimg, ddlType.SelectedValue, "", txt_ordermodul.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status);
        }
        #endregion
        #region Update
        else
        {
            if (vimg.Equals(""))
            {
                vimg = hd_img.Value;
            }
            else
            {
                ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value);
            }
            Groups.UpdateGroups(language, app, txt_title_modul.Text, txtDesc.Text, "", textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", vimg, ddlType.SelectedValue, "", txt_ordermodul.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status, igid);
            if (DdlGroupProduct.SelectedValue != hd_parent)
            {
                Groups.UpdateParentOfGroups(igid, DdlGroupProduct.SelectedValue);
            }
        }
        #endregion

        #region Continue Insert
        if (ckbContinue.Checked == true)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000, 'Đã tạo: " + txt_title_modul.Text + "');", true);
            ResetControls();
            //Lấy lại danh sách danh mục
            GetGroupsInDdl();
        }
        else
        {
            Response.Redirect(LinkRedrect());
        }
        #endregion
    }
Esempio n. 49
0
 public Task Unsubscribe(string chatroom)
 {
     return(Groups.Remove(Context.ConnectionId, chatroom.ToString()));
 }
Esempio n. 50
0
        public async Task LeaveChannel(string channelName)
        {
            await Groups.RemoveFromGroupAsync(Context.ConnectionId, channelName);

            await Clients.Group(channelName).SendAsync("ReceiveMessage", $"{Context.ConnectionId} has left the channel {channelName}");
        }
Esempio n. 51
0
 public void Start()
 {
     Groups.Add(Context.ConnectionId, Context.User.Identity.GetUserId());
     _push.ExecuteQuery();
 }
Esempio n. 52
0
        public async Task JoinChannel(string channelName)
        {
            await Groups.AddToGroupAsync(Context.ConnectionId, channelName);

            await Clients.Group(channelName).SendAsync("ReceiveMessage", $"{Context.ConnectionId} has joined the channel {channelName}");
        }
Esempio n. 53
0
        //public async Task SendMessage(string user, string message)
        //{
        //    await Clients.All.SendAsync("ReceiveMessage", user, message);
        //}

        public async Task EnterGroup(string groupName)
        {
            await Groups.AddToGroupAsync(Context.ConnectionId, groupName);
        }
Esempio n. 54
0
        public Task Leave(int groupId)
        {
            var groupName = groupId.ToString();

            return(Groups.Remove(Context.ConnectionId, groupName));
        }
Esempio n. 55
0
 public Task JoinRoom(string roomId)
 {
     return(Groups.Add(Context.ConnectionId, roomId));
 }
Esempio n. 56
0
        public void Process(DataSourceRequest request, bool processData)
        {
            RawData = Data;

            if (request.Sorts == null)
            {
                request.Sorts = OrderBy;
            }
            else if (request.Sorts.Any())
            {
                OrderBy.Clear();
                OrderBy.AddRange(request.Sorts);
            }
            else
            {
                OrderBy.Clear();
            }

            if (request.PageSize == 0)
            {
                request.PageSize = PageSize;
            }

            PageSize = request.PageSize;

            if (request.Groups == null)
            {
                request.Groups = Groups;
            }
            else if (request.Groups.Any())
            {
                Groups.Clear();
                Groups.AddRange(request.Groups);
            }
            else
            {
                Groups.Clear();
            }

            if (request.Filters == null)
            {
                request.Filters = Filters;
            }
            else if (request.Filters.Any())
            {
                Filters.Clear();
                Filters.AddRange(request.Filters);
            }
            else
            {
                Filters.Clear();
            }

            if (!request.Aggregates.Any())
            {
                request.Aggregates = Aggregates;
            }
            else if (request.Aggregates.Any())
            {
                Aggregates.Clear();
                Aggregates.AddRange(request.Aggregates);
            }
            else
            {
                Aggregates.Clear();
            }

            if (Groups.Any() && Aggregates.Any())
            {
                Groups.Each(g => g.AggregateFunctions.AddRange(Aggregates.SelectMany(a => a.Aggregates)));
            }

            if (Data != null)
            {
                if (processData)
                {
                    var result = Data.AsQueryable().ToDataSourceResult(request);

                    Data = result.Data;

                    Total = result.Total;

                    AggregateResults = result.AggregateResults;
                }
                else
                {
                    var wrapper = Data as IGridCustomGroupingWrapper;
                    if (wrapper != null)
                    {
                        RawData = Data = wrapper.GroupedEnumerable.AsGenericEnumerable();
                    }
                }
            }

            Page = request.Page;

            if (Total == 0 || PageSize == 0)
            {
                TotalPages = 1;
            }
            else
            {
                TotalPages = (Total + PageSize - 1) / PageSize;
            }
        }
Esempio n. 57
0
 public Task LeaveRoom(string roomId)
 {
     return(Groups.Remove(Context.ConnectionId, roomId));
 }
Esempio n. 58
0
        public async Task JoinGroup(string groupName)
        {
            await Groups.AddAsync(Context.ConnectionId, groupName);

            await Clients.Group(groupName).Send($"{Context.ConnectionId} joined {groupName}");
        }
Esempio n. 59
0
        public async Task<IHttpActionResult> CreateGroup([FromBody]CreateGroupViewModel group)
        {
            var owner = await db.Users.FirstOrDefaultAsync(u => u.username == group.ownerName);
            if (owner == null)
                return BadRequest("User can not be found!");
            var newGroup = new Groups()
            {
                name = group.name,
                created_at = group.createdAt,
                description = group.description,
                owner_id = owner.id,
            };

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Groups.Add(newGroup);
            await db.SaveChangesAsync();
            //add user to db
            newGroup.GroupDetails.Add(new GroupDetails()
            {
                user_id = owner.id,
                group_id = newGroup.id
            });
            await db.SaveChangesAsync();
            var retGroup = Mapper.Map<GroupsViewModel>(newGroup);
            return Ok(retGroup);
        }
Esempio n. 60
0
 public void AddToGroups()
 {
     Groups.Add(Context.ConnectionId, "foo");
     Groups.Add(Context.ConnectionId, "bar");
     Clients.Caller.groupAdded();
 }