public ActionResult Administration() { List <TenantUsers> TennantUsersList = GetAdminPageData(); TenantUsers[] tuArray = new TenantUsers[TennantUsersList.Count]; int iCount = 0; foreach (TenantUsers tuSingle in TennantUsersList) { tuArray[iCount] = tuSingle; iCount++; } return(View(tuArray)); }
public ActionResult Administration(FormCollection fc) { string sSubmitButtonId = ""; try { sSubmitButtonId = Request.Params .Cast <string>() .Where(p => p.StartsWith("button_")) .Select(p => p.Substring("button_".Length)) .First(); } catch (Exception ex) { ex.ToString(); sSubmitButtonId = ""; } if (sSubmitButtonId != "") { string sAction = ""; if (sSubmitButtonId.IndexOf("Add_") != -1) { sAction = "Add"; } if (sSubmitButtonId.IndexOf("Delete_") != -1) { sAction = "Delete"; } string sPresenceSystemID = sSubmitButtonId.Replace("Add_", "").Replace("Delete_", ""); // get selected items if any if (sPresenceSystemID != "") { try { string sAllSelectedUsers = fc["LBF_" + sPresenceSystemID].ToString(); string[] sAllSelectedUsersArray = sAllSelectedUsers.Split(','); foreach (string sSelectedUser in sAllSelectedUsersArray) { if (sSelectedUser != "") { string sSelecetedUserPresenceSystemId = sSelectedUser.Split('ђ')[0]; string sSelectedUserFullName = sSelectedUser.Split('ђ')[1]; string sUserPresenceSystemName = sSelectedUser.Split('ђ')[2]; string sSelectedUserId = sSelectedUser.Split('ђ')[3]; } } } catch (Exception ex) { ex.ToString(); } } } List <TenantUsers> TennantUsersList = GetAdminPageData(); TenantUsers[] tuArray = new TenantUsers[TennantUsersList.Count]; int iCount = 0; foreach (TenantUsers tuSingle in TennantUsersList) { tuArray[iCount] = tuSingle; iCount++; } return(View(tuArray)); }
private List <TenantUsers> GetAdminPageData() { Microsoft_Teams_Graph_RESTAPIs_Connect.ImportantFiles.DatabaseService dbService = new Microsoft_Teams_Graph_RESTAPIs_Connect.ImportantFiles.DatabaseService(); string sTenantId = System.Web.HttpContext.Current.Session["TenantId"].ToString(); string sTenantName = System.Web.HttpContext.Current.Session["TenantName"].ToString(); List <string> sAllPresenceSystems = dbService.GetAllPresenceSystems(); List <TenantUsers> TennantUsersList = new List <TenantUsers>(); // tenant users List <string> sAllTenantUsers = dbService.GetAllTenantUsers(sTenantId); List <SelectListItem> TenantUserList = new List <SelectListItem>(); foreach (string sTenantUser in sAllTenantUsers) { if ((sTenantUser != "") && (sTenantUser != "n/a")) { SelectListItem item = new SelectListItem() { Text = sTenantUser.Split(',')[0], Value = "0ђ" + sTenantUser.Split(',')[0] + "ђ" + sTenantName + "ђ" + sTenantUser.Split(',')[1], Selected = false }; TenantUserList.Add(item); } } TenantUsers tuTU = new TenantUsers(); tuTU.userList = TenantUserList; TennantUsersList.Add(tuTU); foreach (string sPresence in sAllPresenceSystems) { if ((sPresence != "") && (sPresence != "n/a")) { string sPresenceSystemId = sPresence.Split(',')[0]; string sPresenceSystemName = sPresence.Split(',')[1]; // system users List <string> sAllSystemUsers = dbService.GetAllSystemUsers(sTenantId, sPresenceSystemId); List <SelectListItem> SystemUserList = new List <SelectListItem>(); foreach (string sSystemUser in sAllSystemUsers) { if ((sSystemUser != "") && (sSystemUser != "n/a")) { SelectListItem item = new SelectListItem() { Text = sSystemUser.Split(',')[0], Value = sPresenceSystemId + "ђ" + sSystemUser.Split(',')[0] + "ђ" + sPresenceSystemName + "ђ" + sSystemUser.Split(',')[3], Selected = false }; SystemUserList.Add(item); } } TenantUsers tuSU = new TenantUsers(); tuSU.userList = SystemUserList; TennantUsersList.Add(tuSU); } } return(TennantUsersList); }