private ProjectMilestoneList CreateListViewModel() { IList<Project> projects = FogBugzGateway.GetProjects(); IList<FixFor> milestones = FogBugzGateway.GetMilestones(); IList<Case> subProjectParentCases = FogBugzGateway.GetSubProjectParentCases(); var projectMilestoneList = new ProjectMilestoneList(UserContext.FogBugzUrl); projectMilestoneList.GetList(projects, milestones, subProjectParentCases, DefaultNumOfThreads); return projectMilestoneList; }
private void RunTest(IList<Project> projects, IList<FixFor> milestones, IList<Case> parentCases, int threadsCount) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); var projectMilestoneList = new ProjectMilestoneList(Login.Url); projectMilestoneList.GetList(projects, milestones, parentCases, threadsCount); stopwatch.Stop(); Console.WriteLine("Thread: " + threadsCount + ", Duration: " + stopwatch.ElapsedMilliseconds); Console.WriteLine("========================================================================="); //Assert.IsNotNull(projectMilestoneList.Items); }
public ActionResult SendDailyDigestEmails(string guid) { HttpContext.Server.ScriptTimeout = 600; Verify.Argument.IsNotEmpty(guid, "guid"); var accountGuid = Guid.Parse(guid); var fbAccount = DbContext.FbAccounts .Include("Settings") .SingleOrDefault(a => a.Settings.Guid == accountGuid); if (fbAccount != null) { object projects = null; object milestones = null; object subProjectParentCases = null; //Getting projects and milestones var cacheKey = MsCacheKey.Gen(MsCacheDataType.TR_Projects, fbAccount.Url); MsCache.TryGet(cacheKey, ref projects); cacheKey = MsCacheKey.Gen(MsCacheDataType.TR_Milestones, fbAccount.Url); MsCache.TryGet(cacheKey, ref milestones); if (projects == null || milestones == null) { var client = new FogBugzClientEx(); client.LogOn(fbAccount.Url + "/api.asp", fbAccount.Token); XCallContextUtils.SetData("FogBugzClient", client); UserContext.FbAccountId = fbAccount.Id; UserContext.IsLoggedIn = true; FbAccountContext.GetContextFbAccountIdMethod(); projects = FogBugzGateway.GetProjects(); milestones = FogBugzGateway.GetMilestones(); subProjectParentCases = FogBugzGateway.GetSubProjectParentCases(); } var projectMilestoneList = new ProjectMilestoneList(UserContext.FogBugzUrl); projectMilestoneList.GetList((List<Project>)projects, (List<FixFor>)milestones, (List<Case>)subProjectParentCases, 20); //getting statuses object storedObect = null; cacheKey = MsCacheKey.Gen(MsCacheDataType.ProjectsStatuses, fbAccount.Url); Dictionary<ProjectStatusListItem, ProjectStatus> result = null; if (MsCache.TryGet(cacheKey, ref storedObect)) { var statuses = (Dictionary<ProjectStatusListItem, ProjectStatusEx>) storedObect; result = statuses.Select(s => new KeyValuePair<ProjectStatusListItem, ProjectStatus>(s.Key, new ProjectStatus(){Status = s.Value.Status, StatusValue = s.Value.StatusValue})) .ToDictionary((keyItem) => keyItem.Key, (valueItem) => valueItem.Value); ; } else { var projectStatusesLoader = new ProjectStatusListLoader(fbAccount.Url); result = projectStatusesLoader.GetProjectStatuses(projectMilestoneList.Items); } //sending emails var emails = fbAccount.Settings.SendDailyDigestEmailsTo.Split(','); foreach (var email in emails) { var dailyDigest = new DailyDigest(projectMilestoneList, result, fbAccount.Settings.AllowSubProjects, email); dailyDigest.Send(); } } return View(); }