private async void ShowGroups()
        {
            try
            {
                var groupsList = new List <Group>();
                GroupsList.IsRefreshing = true;
                var groups = await GetGroupsAsync();

                GroupsList.EndRefresh();
                if (groups != null)
                {
                    foreach (var group in groups)
                    {
                        groupsList.Add(new Group()
                        {
                            DisplayName = group.DisplayName, Id = group.Id
                        });
                    }
                }
                Groups = new ObservableCollection <Group>(groupsList);
                GroupsList.ItemsSource = Groups;
            }
            catch (Exception e)
            {
                await DisplayAlert("Серверге қосылу мүмкін емес", "Интернет қосылуын тексеріңіз", "OK");

                return;
            }
        }
Example #2
0
        private void BindGroups()
        {
            //Groups Binding
            GroupsList.Items.Clear();

            // Any
//			GroupsList.Items.Add(new ListItem(LocRM.GetString("AllFem"), "1"));

            foreach (DataRow row in SecureGroup.GetListGroupsAsTreeDataTable().Rows)
            {
                string   GroupName = CommonHelper.GetResFileString(row["GroupName"].ToString());
                string   GroupId   = row["GroupId"].ToString();
                ListItem item      = new ListItem(GroupName, GroupId);
                GroupsList.Items.Add(item);
            }

            //Saved Value
            GroupsList.ClearSelection();
            try
            {
                GroupsList.SelectedValue = _pc["MV_Group"];
            }
            catch
            {
                GroupsList.SelectedIndex = 0;
                _pc["MV_Group"]          = GroupsList.SelectedValue;
            }

            //Users Binding
            BindUsers(int.Parse(GroupsList.SelectedValue));
        }
Example #3
0
        private void UpdateQueue()
        {
            var groups = new List <GroupQueueItem>();

            foreach (var group in GroupsList.ToArray())
            {
                var nextGroup = groups.Where(g => g.GroupSize + group.GroupSize <= MaxGroupSize).FirstOrDefault();
                if (nextGroup == null)
                {
                    var newGroup = new GroupQueueItem();
                    newGroup.GroupName = GetGroupName();
                    newGroup.Groups.Add(group);
                    groups.Add(newGroup);
                }
                else
                {
                    nextGroup.Groups.Add(group);
                }
            }
            var groupList = GroupsList.OrderBy(g => g.GroupNumber).ToList();

            GroupsList.Clear();
            GroupsQueue.Clear();
            foreach (var group in groupList)
            {
                GroupsList.Add(group);
            }
            foreach (var group in groups)
            {
                GroupsQueue.Add(group);
            }
        }
Example #4
0
 private void OnRemoveGroupQueueCommand(GroupQueueItem groups)
 {
     foreach (var group in groups.Groups)
     {
         GroupsList.Remove(group);
     }
     UpdateQueue();
 }
Example #5
0
 public Dictionary <IRecord, List <WellRecord> > SetGroupsChildren()
 {
     if (GroupsList != null && GroupsList.Count > 0)
     {
         GroupsList.ForEach(record => GroupsDictionary.Add(record, new List <WellRecord>()));
         AddWellsToGroups();
     }
     return(GroupsDictionary);
 }
Example #6
0
 public void ValidateGroupLocationUniqness()
 {
     if (GroupsList != null && GroupsList.Count > 0)
     {
         List <GroupRecord> localGroupRecords = GroupsList.Distinct(new GroupLocationComparator()).ToList();
         FailedRecords.AddRange(GroupsList.Except(localGroupRecords).ToList());
         GroupsList = localGroupRecords;
     }
 }
Example #7
0
 private void AddGroupButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(NewGroupNameBox.Text))
     {
         var groupName = NewGroupNameBox.Text;
         GroupsList.AddGroup(new Data.CustomGroup()
         {
             Name = groupName
         });
     }
 }
Example #8
0
        private void UpdateGroupsData(IEnumerable <GroupDTO> groups)
        {
            foreach (var groupDTO in groups)
            {
                var groupModel = GroupsList.Union(InvitedGroupList).Where(p => p.Id == groupDTO.Id).FirstOrDefault();
                if (groupModel != null)
                {
                    UpdateGroupModel(groupModel, groupDTO);
                }
            }

            Groups = groups.Union(groups.Where(p => !Groups.Select(x => x.Id).Contains(p.Id)));
        }
Example #9
0
 public void GetGroupsWellsLists()
 {
     Records?.ForEach(record =>
     {
         if (record.GetType() == typeof(GroupRecord))
         {
             GroupsList.Add((GroupRecord)record);
         }
         else
         {
             WellsList.Add((WellRecord)record);
         }
     });
 }
        public static void Init(GameUnit unit)
        {
            var group = unit.Group;
            unit.GroupObj = GroupsList.GetGroupObject(group);

            if (group.Length == 0) return;
            if (GroupList.ContainsKey(group))
            {
                GroupList[group].Add(unit);
            }
            else
            {
                GroupList.Add(group, new List<GameUnit> {unit});
            }
        }
Example #11
0
        /// <summary>
        /// Creates a popup box to allow the user to change the group name and then sends the
        /// updated groupname to the server
        /// </summary>
        public async Task changeGroupNameAsync(GroupsContent groupContent)
        {
            if (App.User != null)
            {
                string currentGroupName     = groupContent.group.Name;
                Tuple <Boolean, String> tup = await createGroupNameInputDialog();

                // User inputs
                Boolean cancelled    = tup.Item1;
                string  newGroupName = tup.Item2;
                if (!cancelled && newGroupName != "")
                {
                    GroupChat updatedGroup = await renameGroupChat(groupContent.group, newGroupName);

                    // Display message to user if the name change failed (no server)
                    if (updatedGroup == null)
                    {
                        ContentDialog noServerDialog = new ContentDialog()
                        {
                            Title             = "Cannot change groupname",
                            Content           = "Is your wifi down?",
                            PrimaryButtonText = "Ok"
                        };
                        await ContentDialogHelper.CreateContentDialogAsync(noServerDialog, true);
                    }
                    else
                    {
                        string members = await getGroupMemberNames(updatedGroup);

                        GroupsContent updatedContent = new GroupsContent(updatedGroup, members);
                        updatedContent.updateCanvasFrom(groupContent);

                        // Preserve ordering
                        int originalIndex = getGroupsContentIndex(groupContent.group.id);
                        GroupsList.Remove(groupContent);
                        GroupsList.Insert(originalIndex, updatedContent);

                        // if the user is currently looking at the group, update the group content message history
                        if (RightFrameNavigator.GetLastContext() != null &&
                            RightFrameNavigator.GetLastContext().Equals(groupContent.messageHistoryViewModel))
                        {
                            RightFrameNavigator.Navigate(typeof(MessageHistoryView), updatedContent.messageHistoryViewModel);
                        }
                    }
                }
            }
        }
Example #12
0
        void Awake()
        {
            CycleSystem.SystemEnabled = CycleSystemCheck;
            StaticMapSize             = MapSize;
            BATYAtrans         = transform;
            StaticSpEnemies    = spEnemies;
            static_vision      = vision;
            staticEnemyCount   = enemyCount;
            staticFogEnabled   = fogEnabled;
            staticFillMap      = fillMap;
            staticFlagsEnabled = flags;


            CreatureGroupManager.ClearGroups();

            GroupsList.PreInit();
        }
Example #13
0
        public void OnMembershipsDataUpdate(object data)
        {
            Memberships = (IEnumerable <MembershipDTO>)data;
            List <int> missingGroups = new List <int>();

            GroupsList.Clear();
            InvitedGroupList.Clear();

            foreach (var membership in Memberships)
            {
                GroupModel groupModel;
                if (membership.Status == 0)
                {
                    groupModel = new GroupModel(OnGroupAccept, OnGroupDecline);
                }
                else
                {
                    groupModel = new GroupModel(OnGroupEnter, null);
                }

                GroupDTO groupDTO = Groups.Where(p => p.Id == membership.GroupId).FirstOrDefault();
                if (groupDTO != null)
                {
                    UpdateGroupModel(groupModel, groupDTO);
                }
                else
                {
                    missingGroups.Add(membership.GroupId);
                }

                if (membership.Status == 0)
                {
                    InvitedGroupList.Add(groupModel);
                }
                else
                {
                    GroupsList.Add(groupModel);
                }
            }

            if (missingGroups.Count > 0)
            {
                DataManager.GetData(DataManager.DataType.Groups, OnGroupsDataUpdate);
            }
        }
Example #14
0
        private void BuildUserGroups(int?userId)
        {
            GroupsList.Items.Clear();

            if (userId.HasValue)
            {
                GroupDa  da         = new GroupDa();
                DataView groupsList = da.GetGroupsByUser(userId.Value).DefaultView;
                groupsList.Sort = BOL.Group.GroupName + " ASC";

                // build list of avialble groups
                // groupsList.RowFilter = BOL.UserGroup.UserGroupId + " IS NULL";
                GroupsList.DataSource = groupsList;
                GroupsList.DataBind();
                SetGroupCheckBox(GroupsList, groupsList.Table);

                // build list of current groups
                groupsList.RowFilter             = BOL.UserGroup.UserGroupId + " IS NOT NULL";
                UserGroupsPanel.Visible          = true;
                CurrentUserGroupsRptr.DataSource = groupsList;
                CurrentUserGroupsRptr.DataBind();

                BuildUserAttributes(userId.Value);

                AddUserGroupText.Visible = true;
            }
            else
            {
                DataView groupsList = BOL.BusinessObject.GetAllAsDataView <BOL.Group>();
                groupsList.Sort = BOL.Group.GroupName + " ASC";

                // build list of avialble groups
                GroupsList.DataSource = groupsList;
                GroupsList.DataBind();

                // build list of current groups (empty)
                UserGroupsPanel.Visible          = false;
                CurrentUserGroupsRptr.DataSource = null;
                CurrentUserGroupsRptr.DataBind();

                AddUserGroupText.Visible = false;
            }
        }
Example #15
0
 private void OnAddGroupCommand()
 {
     TotalGroups++;
     TotalPeople += CurrentGroupSize;
     AverageSize  = Math.Round(((double)TotalPeople) / ((double)TotalGroups), 2);
     GroupsList.Add(new Group()
     {
         GroupNumber = CurrentGroupNumber,
         GroupSize   = CurrentGroupSize,
     });
     CurrentGroupSize      = 0;
     CurrentGroupSizeStr   = "";
     CurrentGroupNumber    = 0;
     CurrentGroupNumberStr = "";
     RaiseChanged(nameof(CurrentGroupSize), nameof(CurrentGroupNumber),
                  nameof(TotalGroups), nameof(TotalPeople), nameof(AverageSize));
     OnSetGroupNumberCommand();
     UpdateQueue();
 }
Example #16
0
        public void RemoveGroupsIntersections()
        {
            if (GroupsList != null && GroupsList.Count > 0)
            {
                List <IRecord> intersectingFailedRecords = new List <IRecord>();

                for (int i = 0; i < GroupsList.Count - 1; i++)
                {
                    GroupRecord group1 = GroupsList[i];
                    for (int j = i + 1; j < GroupsList.Count; j++)
                    {
                        GroupRecord group2 = GroupsList[j];
                        if (intersectingFailedRecords.Count == 0 || !intersectingFailedRecords.Contains(group2))
                        {
                            double distance = CalculateDistance(group1.LocationX, group1.LocationY, group2.LocationX,
                                                                group2.LocationY);

                            if (distance > group1.Radius + group2.Radius)
                            {
                                //not intersecting, leave group
                            }
                            else if ((distance <= group1.Radius + group2.Radius) || distance <
                                     Math.Abs(group1.Radius - group2.Radius) ||
                                     (distance == 0 &&
                                      group1.Radius == group2.Radius))
                            {
                                intersectingFailedRecords.Add(group2);
                            }
                            else
                            {
                                intersectingFailedRecords.Add(group2);
                            }
                        }
                    }
                }

                FailedRecords.AddRange(intersectingFailedRecords);
                List <GroupRecord> groups = intersectingFailedRecords.Cast <GroupRecord>().ToList();
                GroupsList = GroupsList.Except(groups).ToList();
            }
        }
Example #17
0
        public async void deleteGroup(GroupsContent groupContent)
        {
            int     numMembers         = groupContent.group.GroupMembers.Count;
            Boolean leaveOrDeleteGroup = false;

            // If there are more than 1 members in this group, we leave the chat
            if (numMembers > 1)
            {
                leaveOrDeleteGroup = await createLeaveGroupWarningDialog();
            }
            // If you are the last member in the group, we delete the group
            else
            {
                leaveOrDeleteGroup = await createDeleteGroupWarningDialog();
            }
            // Make rest call and refresh gui
            if (leaveOrDeleteGroup)
            {
                var res = await deleteGroupChat(groupContent.group);

                GroupsList.Remove(groupContent);

                // clear the right frame if the user is currently looking at the deleted group
                if (RightFrameNavigator.GetLastContext() != null &&
                    RightFrameNavigator.GetLastContext().Equals(groupContent.messageHistoryViewModel))
                {
                    RightFrameNavigator.Navigate(typeof(MessageHistoryView));
                }
            }
            // refresh gui
            else
            {
                // Preserve ordering
                int originalIndex = getGroupsContentIndex(groupContent.group.id);
                GroupsList.Remove(groupContent);
                GroupsList.Insert(originalIndex, groupContent);
                //retrieveGroupsFromServer();
            }
        }
Example #18
0
 // GET: PagedGroups/Details/5
 public ActionResult FilterGroups(GroupsList groupList, string request)
 {
     try {
         if (request.Equals("Create"))
         {
             storage.CreateGroup(groupList.CurrentGroup.Name);
         }
         else if (request.Equals("Edit"))
         {
             storage.UpdateGroup(groupList.CurrentGroup);
         }
         else if (request.Equals("Delete"))
         {
             storage.DeleteGroup(groupList.CurrentGroup);
         }
         return(RedirectToAction("Index", new { page = groupList.Page }));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Index", new { page = 1, errMsg = ex.Message }));
     }
 }
Example #19
0
 private void OnRemoveGroupCommand(Group group)
 {
     GroupsList.Remove(group);
     UpdateQueue();
 }
        public SubGroupEditingViewModel(int subjectId, int groupId = 0)
        {
            var groups = GroupManagementService.GetGroups(new Query <Group>(e => e.SubjectGroups.Any(x => x.SubjectId == subjectId)).Include(e => e.Students));

            FillGroupsList(groups);

            if (groupId == 0)
            {
                groupId = int.Parse(GroupsList.FirstOrDefault().Value);
            }

            GroupId = groupId.ToString(CultureInfo.InvariantCulture);

            var subGroups = SubjectManagementService.GetSubGroups(subjectId, groupId);

            if (subGroups.Any())
            {
                FillSubGroupsList(subGroups);
                StudentGroupList = new List <SelectListItem>();

                foreach (var student in groups.FirstOrDefault(e => e.Id == groupId).Students)
                {
                    var studentId = student.Id.ToString(CultureInfo.InvariantCulture);

                    if (!SubGroupsFirstList.Any() && !SubGroupsTwoList.Any())
                    {
                        StudentGroupList.Add(new SelectListItem
                        {
                            Selected = false,
                            Text     = student.FullName,
                            Value    = studentId
                        });
                    }
                    else
                    {
                        if (SubGroupsFirstList.Any(e => e.Value == studentId) ||
                            SubGroupsTwoList.Any(e => e.Value == studentId))
                        {
                        }
                        else
                        {
                            StudentGroupList.Add(new SelectListItem
                            {
                                Selected = false,
                                Text     = student.FullName,
                                Value    = studentId
                            });
                        }
                    }
                }
            }
            else
            {
                SubGroupsFirstList = new List <SelectListItem>();
                SubGroupsTwoList   = new List <SelectListItem>();
                StudentGroupList   = groups.FirstOrDefault(e => e.Id == groupId).Students.Select(e => new SelectListItem
                {
                    Text     = e.FullName,
                    Value    = e.Id.ToString(CultureInfo.InvariantCulture),
                    Selected = false
                }).ToList();
            }
        }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Global.CurrentPerson == null || string.IsNullOrEmpty(Request.QueryString["Series"]))
                {
                    Response.Redirect("Index.aspx");
                }

                SeriesId            = long.Parse(Request.QueryString["Series"]);
                SeriesIdField.Value = SeriesId.ToString();

                DataTable                  eventTable    = new DataTable();
                List <Models.Event>        eventModel    = new List <Models.Event>();
                DataTable                  requestsTable = new DataTable();
                List <Models.GroupRequest> requestsModel = new List <Models.GroupRequest>();

                using (OracleConnection objConn = new OracleConnection(Global.ConnectionString))
                {
                    // Set up the getEvent command
                    var eventCommand = new OracleCommand("TICKETS_QUERIES.getEvent", objConn)
                    {
                        BindByName = true, CommandType = CommandType.StoredProcedure
                    };
                    eventCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue);
                    eventCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input);

                    // Set up the getGroupRequestsForEvent command
                    var requestsCommand = new OracleCommand("TICKETS_QUERIES.getGroupRequestsForEvent", objConn)
                    {
                        BindByName = true, CommandType = CommandType.StoredProcedure
                    };
                    requestsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue);
                    requestsCommand.Parameters.Add("p_SeriesId", OracleDbType.Int64, SeriesId, ParameterDirection.Input);
                    requestsCommand.Parameters.Add("p_PersonId", OracleDbType.Int64, Global.CurrentPerson.person_id, ParameterDirection.Input);

                    try
                    {
                        // Execute the queries and auto map the results to models
                        objConn.Open();
                        var eventAdapter = new OracleDataAdapter(eventCommand);
                        eventAdapter.Fill(eventTable);
                        eventModel = Mapper.DynamicMap <IDataReader, List <Models.Event> >(eventTable.CreateDataReader());

                        var requestsAdapter = new OracleDataAdapter(requestsCommand);
                        requestsAdapter.Fill(requestsTable);
                        requestsModel = Mapper.DynamicMap <IDataReader, List <Models.GroupRequest> >(requestsTable.CreateDataReader());
                    }
                    catch (Exception)
                    {
                        Response.Redirect("EventSignup.aspx?Series=" + SeriesId);
                    }

                    objConn.Close();
                }

                if (eventModel.Any())
                {
                    var currentEvent = eventModel.FirstOrDefault();
                    EventName.InnerHtml   = currentEvent.name;
                    EventDescription.Text = currentEvent.description;
                    EventLocation.Text    = currentEvent.building;

                    EventDateList.DataSource = eventModel;
                    EventDateList.DataBind();
                }

                if (requestsModel.Any())
                {
                    if (requestsModel.Any(r => r.requested_id == Global.CurrentPerson.person_id && r.has_accepted == 1))
                    {
                        Response.Redirect("AcceptedGroup.aspx?Series=" + SeriesId);
                    }

                    List <Group> groups = requestsModel.GroupBy(distinctGroup => distinctGroup.group_id).Select(group => new Group
                    {
                        group_id = group.First().group_id,
                        group_leader_firstname = group.First().group_leader_firstname,
                        group_leader_lastname  = group.First().group_leader_lastname,
                        group_requests         = requestsModel.Where(r => r.group_id == group.First().group_id).ToList(),
                        guests = group.First().guest_tickets
                    }).ToList();

                    GroupsList.DataSource = groups;
                    GroupsList.DataBind();
                }
                else
                {
                    Response.Redirect("EventSignup.aspx?Series=" + SeriesId);
                }
            }
        }