private IList <BugViewModel> GetProjectBugs() { var data = new List <Bug>(); int myId = _Service.GetMyUser().Id; data = _Service.SearchAllProjectBugsAttributes(_ActiveProject.ToProjectModel(), SearchText); switch (SelectedFilter) { case "Assigned To Me": if (data.Count > 0) { data = data.Where(p => p.AssignedUser != null && p.AssignedUser.Id == myId).ToList(); } break; case "Open": if (data.Count > 0) { data = data.Where(p => p.Status == "Open").ToList(); } break; case "Closed": if (data.Count > 0) { data = data.Where(p => p.Status == "Closed").ToList(); } break; case "In Progress": if (data.Count > 0) { data = data.Where(p => p.Status == "In Progress").ToList(); } break; } IList <BugViewModel> vmList = new List <BugViewModel>(); data.ForEach(p => vmList.Add(new BugViewModel(p))); return(vmList); }
/// <summary> /// Stores references to dependencies and initialises the /// username field by retrieving currents user from service. /// </summary> /// <param name="comm">Messenger to communciate with other view models.</param> /// <param name="svc">Web service allowing remote procedures to be called.</param> /// <param name="ctrlfactory">Factory to create controls on the main window.</param> public MainWindowViewModel(IMessenger comm, ITrackerService svc, IWindowFactory winfactory, IControlFactory ctrlfactory) { _Messenger = comm; _Service = svc; _ControlFactory = ctrlfactory; _WindowFactory = winfactory; _CurrentUser = _Service.GetMyUser(); InitialiseActiveProject(); ListenForMessages(); }
/// <summary> /// Stores references to dependencies and initialses object fields. /// </summary> /// <param name="loader">The window loader.</param> /// <param name="svc">The registration web service.</param> public AccountSettingsViewModel(ITrackerService svc, IMessenger mess, IGrowlNotifiactions notifier) { _Service = svc; _Messenger = mess; _Notifier = notifier; User myUser = _Service.GetMyUser(); _FirstName = myUser.FirstName; _LastName = myUser.Surname; _FirstAndLastName = _FirstName + " " + _LastName; _Email = myUser.Username; _Password = myUser.Password; }
private bool IsManagerOfProject(ProjectViewModel project) { User myUser = _Service.GetMyUser(); IList <int> idList = _Service.GetProjectsManagedBy(myUser).Select(p => p.Id).Distinct().ToList(); if (idList != null && idList.Contains(project.Id)) { return(true); } else { return(false); } }
/// <summary> /// Stores references to dependencies and initialses object fields. /// </summary> /// <param name="loader">The window loader.</param> /// <param name="svc">The registration web service.</param> public AccountSettingsViewModel(ITrackerService svc, IMessenger mess, IGrowlNotifiactions notifier) { _Service = svc; _Messenger = mess; _Notifier = notifier; User myUser = _Service.GetMyUser(); _FirstName = myUser.FirstName; _LastName = myUser.Surname; _FirstAndLastName = _FirstName + " " + _LastName; _Email = myUser.Username; _Password = myUser.Password; }
/// <summary> /// Attempts to register a new user and organisation with the service /// using form data. /// </summary> private void SaveCredentials() { IsSaveButtonEnabled = false; if (CanSave()) { try { User user = new User { Id = _Service.GetMyUser().Id, FirstName = this.FirstName, Surname = this.LastName, Password = this.Password, Username = this.Email, }; // Execute registration operation concurrently _Service.SaveUserCredentials(user); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_TICK, Title = "Saved!", Message = "Your account settings have been saved." }); IsSaveButtonEnabled = false; } catch (FaultException e) { IsSaveButtonEnabled = true; MessageBox.Show(e.Message); } } else { IsSaveButtonEnabled = true; } }
private void RequestJoinProject() { if (InputIsValidated()) { User myUser = _Service.GetMyUser(); try { _Service.RequestProjectAssignment(Code, myUser, SelectedRole); _Notifier.AddNotification(new Notification { ImageUrl = Notification.ICON_NOTIFICATION, Title = "Request Sent!", Message = "Your request to join this project has been sent." }); } catch (Exception e) { MessageBox.Show(e.Message); } Code = ""; } }
public JoinProjectPanelViewModel(ITrackerService svc, IGrowlNotifiactions notifier) { _Service = svc; _Notifier = notifier; _User = svc.GetMyUser(); }
public JoinProjectPanelViewModel(ITrackerService svc, IGrowlNotifiactions notifier) { _Service = svc; _Notifier = notifier; _User = svc.GetMyUser(); }