public ActionResult GenerateReport(int selectedGroup, int selectedtype, int selectedstatus) { List <ChatGroup> grouplist = new List <ChatGroup>(); if (selectedGroup == 0) { if (selectedstatus == 0) { grouplist = new ChatGroup().GetAllChatGroups(); } else if (selectedstatus == 1) { grouplist = new ChatGroup().GetActiveChatGroups(); } else { grouplist = new ChatGroup().GetInActiveChatGroups(); } return(performActionForReportType(selectedtype, grouplist)); } else { List <ChatGroupParticipant> chatgroupparticipants; ChatGroup chatgroup = _context.ChatGroups.Find(selectedGroup); if (selectedstatus == 0) { chatgroupparticipants = chatgroup.GetAssociatedChatGroupParticipants(); } else if (selectedstatus == 1) { chatgroupparticipants = chatgroup.GetAssociatedActiveChatGroupParticipants(); } else { chatgroupparticipants = chatgroup.GetAssociatedInActiveChatGroupParticipants(); } return(performActionForReportTypeForGroupUser(selectedtype, chatgroupparticipants)); } }
public ActionResult Result(int currentrecord) { ChatGroup currentGroup = null; List <int> participantsIds = null; if (currentrecord != 0) { currentGroup = _context.ChatGroups.Find(currentrecord); participantsIds = currentGroup.GetAssociatedChatGroupParticipants().Select(x => x.USERID).ToList(); } List <MyNode> nodes = new List <MyNode>(); foreach (MyOrganisation @org in new MyOrganisation().GetAllOrganisations()) { List <MyFacility> facilities = @org.GetAllMatchingFacilities(); MyNode orgNode = new MyNode { text = org.Name, value = org.Value, icon = "glyphicon glyphicon-home", backColor = "#ffffff", color = "#428bca", //state = new state() { @checked = true, disabled = false, expanded = true, selected = false }, nodetype = MyNodeType.Organisation }; if (facilities != null && facilities.Count > 0) { orgNode.nodes = new List <MyNode>(); foreach (MyFacility @fac in facilities) { MyNode facNode = new MyNode { parent = orgNode.value, text = fac.Name, value = fac.Value, icon = "glyphicon glyphicon-th-list", backColor = "#ffffff", color = "#66512c", //state = new state() { @checked = true, disabled = false, expanded = true, selected = false }, nodetype = MyNodeType.Facility }; List <MyUser> users = @fac.GetAllMatchingUsers(); if (users != null && users.Count > 0) { facNode.nodes = new List <MyNode>(); foreach (MyUser @user in users) { MyNode userNode = new MyNode { parent = facNode.value, text = user.Name, value = user.Value, icon = "glyphicon glyphicon-user", backColor = "#ffffff", color = "#31708f", nodetype = MyNodeType.User }; if (currentGroup != null) { if (CheckIfMatchingMyUserExists(participantsIds, userNode) != null) { userNode.state = new state() { @checked = true, disabled = false, expanded = true, selected = false }; } } facNode.nodes.Add(userNode); } } if (users.Count > 0) { orgNode.nodes.Add(facNode); } } } if (facilities.Count > 0 && orgNode.nodes.Count > 0) { nodes.Add(orgNode); } } return(Json(nodes, JsonRequestBehavior.AllowGet)); }