public void OnSync(Office.IRibbonControl control) { try { OutlookUtils.SelectCalenderModule(); SyncForm form = new SyncForm(); // get calender list and initialize the form ICollection <String> calendars = OutlookUtils.GetCalendarList(config.CalendarName); form.Init(calendars, config); if (form.ShowDialog() == DialogResult.OK) { config.CalendarName = form.SelectedCalendar; //Get by id Release release = NgaUtils.GetSelectedRelease(); //NgaUtils.GetReleaseById(releaseId); EntityListResult <Sprint> sprints = NgaUtils.GetSprintsByRelease(release.Id); OutlookSyncUtils.SyncSprintsToOutlook(config.CalendarName, release, sprints); EntityListResult <Milestone> milestones = NgaUtils.GetMilestonesByRelease(release.Id); OutlookSyncUtils.SyncMilestonesToOutlook(config.CalendarName, release, milestones); String str = String.Format("Sync completed successfully.{0}Summary : {1} sprints and {2} milestones.", Environment.NewLine, sprints.data.Count, milestones.data.Count); MessageBox.Show(str, "Sync completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (ServerUnavailableException) { ShowServerIsNotAvailableMsg(); } catch (Exception e) { String errorMsg = "Sync failed : " + e.Message; MessageBox.Show(errorMsg, "Sync Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void OnMailReport(Office.IRibbonControl control) { try { //Get by id Release release = NgaUtils.GetSelectedRelease(); //NgaUtils.GetReleaseById(releaseId); GroupResult groupResult = NgaUtils.GetAllDefectWithGroupBy(release.Id); GroupResult usGroupResult = NgaUtils.GetAllStoriesWithGroupBy(release.Id); OutlookSyncUtils.getReleaseMailReport(release, groupResult, usGroupResult); } catch (Exception e) { MessageBox.Show("Failed to generate report: " + e.Message + Environment.NewLine + e.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }