public ActionResult ImpersonatedAccountFolderListView(long AccID) { //TempData["SelectedMenu"] = "AccImpersontation"; ImpersonateAccountsSysAdminModel model = new ImpersonateAccountsSysAdminModel(); var AccountsInfo = CCAccRepository.Accounts.Where(A => A.ID == AccID).FirstOrDefault(); model.SelectedAccountInfo = AccountsInfo; model.SelectedAccountFolderList = new List<FolderListDetails>(); var folderList = CCFolderRepository.CCFolders.Where(F => F.AccountGUID == AccountsInfo.AccountGUID).ToList(); foreach(var fold in folderList) { FolderListDetails FLD = new FolderListDetails(); FLD.FolderDetails = fold; FLD.ItemCount = CCItemRepository.CCContacts.Where(I => I.FolderID == fold.FolderID).Count(); model.SelectedAccountFolderList.Add(FLD); } return View(model); }
public ActionResult ImpersonatedAccount(long AccID) { if (Session["SysAdminDetails"] != null) { TempData["SelectedMenu"] = "AccImpersontation"; var userObj = CCUserRepository.GetUserByEmailAddress(CCUserRepository.Users.First(U => U.AccountID == AccID).Email); Session["user"] = userObj; var accountObj = CCAccRepository.Accounts.FirstOrDefault(x => x.ID == userObj.AccountID); Session["account"] = accountObj; var timeZone = CCAccRepository.Accounts.Where(aid => aid.ID == userObj.AccountID).FirstOrDefault().TimeZone; Session["timeZone"] = timeZone; var folders = CCFolderRepository.CCFolders.Where(guid => guid.AccountGUID == accountObj.AccountGUID).ToList(); Session["folderss"] = folders; List<NotificationListViewModel> notificationList = new List<NotificationListViewModel>(); CronJobController CJC = new CronJobController(); Session["account"] = CJC.checkAccountTrialExpiryForAccount(accountObj); HelperFunctions HF = new HelperFunctions(); notificationList = HF.generateNotificationList(accountObj); HF.CheckAcccountStatus(accountObj); if (notificationList.Count > 0) Session["notifications"] = notificationList; else Session["notifications"] = null; if (((DateTime)(accountObj.TrialEnds) - (DateTime)(DateTime.Now.Date)).TotalDays < CCGlobalValues.trialPeriod) { TrialDataModel trialObj = new TrialDataModel(); trialObj.hasPurchased = accountObj.HasPurchased; trialObj.createdDate = accountObj.CreatedDate; trialObj.trialEndDate = accountObj.TrialEnds; trialObj.showPurchaseOptions = true; Session["trialData"] = trialObj; } ImpersonateAccountsSysAdminModel model = new ImpersonateAccountsSysAdminModel(); var AccountsInfo = CCAccRepository.Accounts.Where(A => A.ID == AccID).FirstOrDefault(); model.SelectedAccountInfo = AccountsInfo; model.FolderCount = CCFolderRepository.CCFolders.Where(F => F.AccountGUID == AccountsInfo.AccountGUID).Count(); model.ConnectionCount = CCConnectionRepository.CCSubscriptions.Where(C => C.AccountGUID == AccountsInfo.AccountGUID).Count(); model.UserCount = CCUserRepository.Users.Where(U => U.AccountID == AccountsInfo.ID).Count(); model.SubscriptionCount = 0; model.ItemsCount = CCItemRepository.CCContacts.Where(I => I.AccountGUID == AccountsInfo.AccountGUID).Count(); model.SelectedAccountOwner = CCUserRepository.Users.First(U => U.AccountID == AccountsInfo.ID).FullName; //Sync Graph Data List<string> SyncDates = new List<string>(); List<double> SyncDateUsage = new List<double>(); DateTime startDate = DateTime.Now.Date.AddDays(-1); for (int i = 6; i > -1; i--) { SyncDates.Add((startDate.AddDays(-i)).ToShortDateString()); } for (int i = 0; i < SyncDates.Count(); i++) { DateTime syncDateStart = DateTime.Parse(SyncDates[i]); DateTime syncDateEnd = syncDateStart.AddHours(23).AddMinutes(59); SyncDateUsage.Add(CCSyncItemsRepository.CCSyncItems.Where(SI => SI.LastUpdated >= syncDateStart && SI.LastUpdated <= syncDateEnd).Count()); } model.SyncDates = SyncDates; model.SyncDateUsage = SyncDateUsage; return View(model); } else { return RedirectToAction("Login", "Login"); } }
public ActionResult ImpersonatedAccountConnectionListView(long AccID) { TempData["SelectedMenu"] = "AccImpersontation"; ImpersonateAccountsSysAdminModel model = new ImpersonateAccountsSysAdminModel(); return View(model); }
public ActionResult ImpersonateAccount() { if (Session["SysAdminDetails"] != null) { TempData["SelectedMenu"] = "AccImpersontation"; var adminUser = (User)Session["SysAdminDetails"]; var userObj = CCUserRepository.GetUserByEmailAddress(adminUser.Email); Session["user"] = userObj; //Session["account"] = ""; //Session["timeZone"] = ""; var accountObj = CCAccRepository.Accounts.FirstOrDefault(x => x.ID == userObj.AccountID); Session["account"] = accountObj; var timeZone = CCAccRepository.Accounts.Where(aid => aid.ID == userObj.AccountID).FirstOrDefault().TimeZone; Session["timeZone"] = timeZone; ImpersonateAccountsSysAdminModel model = new ImpersonateAccountsSysAdminModel(); var AccountsList = CCAccRepository.Accounts.ToList(); foreach (var acc in AccountsList) { try { AccountDetails AD = new AccountDetails(); AD.AccountID = acc.ID; AD.AccountGUID = acc.AccountGUID; AD.AccountName = acc.AccountName; AD.DateCreated = "Coming Soon..."; AD.Email = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID).Email; AD.Usgae = "Coming Soon..."; model.listOfAccounts.Add(AD); } catch (Exception ex) { } } return View(model); } else { return RedirectToAction("Login", "Login"); } }