private void btnSave_Click(object sender, RoutedEventArgs e) { var name = tbProjectName.Text; var description = tbProjectDescription.Text; var status = cbProjectStatus.SelectedValue as ProjectStatusProxy; var dateStart = dpProjectDateCreated.SelectedDate; var project = currentProject; if (project == null) { project = new ProjectProxy(); project.Name = name; project.Owner = User.Instance.Account; project.Description = description; project.ProjectStatus = status; project.DateStart = dateStart.Value; service.CreateProject(User.Instance.Account.Id, project); } else { project.Name = name; project.Description = description; project.ProjectStatus = status; project.DateStart = dateStart.Value; service.UpdateProject(User.Instance.Account.Id, project); } DialogResult = true; }
private bool ShowCreateProject(ViewType typeView, ProjectProxy project) { var proj = new ProjectWindow(service, project, typeView); proj.Owner = this; return(proj.ShowDialog().Value); }
public List <ProjectProxy> GetProjectsByOwnerId(int ownerId) { using (var db = new DatabaseEntities()) { var projects = db.Projects.Where(p => p.Owner == ownerId).ToList(); return(ProjectProxy.GetListProjectProxy(projects)); } }
public List <ProjectProxy> GetProjectsByStatus(ProjectStatusProxy status) { using (var db = new DatabaseEntities()) { var projects = db.Projects.Where(p => p.ProjectStatusId == status.Id).ToList(); return(ProjectProxy.GetListProjectProxy(projects)); } }
private void lvPrjProjectList_Selected(object sender, RoutedEventArgs e) { selectedProject = (lvPrjProjectList.SelectedItem as ProjectProxy); if (selectedProject == null) { return; } UpdatePrjParticipantList(service.GetAccountListByProjectId(selectedProject.Id)); UpdatePrjTaskList(service.GetTasksByProjectId(selectedProject.Id)); }
public void UpdateProject(int accountId, ProjectProxy project) { dataAccess.UpdateProject(project); dataAccess.AddHistory( new HistoryProxy( 0, DateTime.Now, string.Format("User {0} edited project {1}", dataAccess.GetAccountById(accountId).FullName, project.Name)), dataAccess.GetAccountListByProjectId(project.Id) ); }
private void lvPrjProjectList_Selected(object sender, SelectionChangedEventArgs e) { selectedProject = lvPrjProjectList.SelectedItem as ProjectProxy; btnPrjDeleteProject.IsEnabled = selectedProject != null; btnPrjUpdateProject.IsEnabled = selectedProject != null; if (selectedProject != null) { UpdatePrjTaskList(service.GetTasksByProjectId(selectedProject.Id)); UpdatePrjParticipantList(service.GetAccountListByProjectId(selectedProject.Id)); } }
public void GetHashCodeShouldReturnSameValueForIdenticalObject() { Project p1 = new ProjectProxy(); p1.Id = 1; Project p2 = new ProjectProxy(); p2.Id = 1; int p1Hash = p1.GetHashCode(); int p2Hash = p2.GetHashCode(); Assert.AreEqual(p1Hash,p2Hash); }
public ProjectWindow(ServiceClient service, ProjectProxy project, ViewType typeView) { InitializeComponent(); this.service = service; this.currentProject = project; InitializeProject(typeView); btnTaskEdit.IsEnabled = false; btnTaskDelete.IsEnabled = false; btnParticipantDelete.IsEnabled = false; btnStatusEdit.IsEnabled = false; btnStatusDelete.IsEnabled = false; }
private void UpdateComboBoxStatus(ProjectProxy project) { Task.Run(() => { cbProjectStatus.Dispatcher.Invoke(() => { var statusList = service.GetProjectStatusListByProjectId(project.Id); cbProjectStatus.ItemsSource = statusList; if (project.ProjectStatus != null) { cbProjectStatus.SelectedItem = statusList.FirstOrDefault(p => p.Id == project.ProjectStatus.Id); } }); }); }
public void ProjectShouldBeEqualToProxy() { Project project = new Project { Id = 3, Name = "Test" }; Project projectProxy = new ProjectProxy { Name = "Test", Id = 3 }; Assert.IsTrue(projectProxy.Equals(project)); }
public void UpdateProject(ProjectProxy project) { using (var db = new DatabaseEntities()) { var proj = db.Projects.FirstOrDefault(p => p.Id == project.Id); if (proj == null) { return; } proj.Name = project.Name; proj.Description = project.Description; if (project.ProjectStatus != null) { proj.ProjectStatusId = project.ProjectStatus.Id; } proj.DateStart = project.DateStart; db.SaveChanges(); } }
/// <summary> /// Called when [opened project]. /// </summary> /// <param name="hierarchy">The hierarchy.</param> /// <param name="isNew">if set to <c>true</c> [is new].</param> public void OnOpenedProject(IVsHierarchy hierarchy, bool isNew) { // Visual Studio reports folders as opened projects but without a name var project = hierarchy.ToProject(); if (string.IsNullOrWhiteSpace(project.FullName)) { return; } var projectProxy = new ProjectProxy(project.Name, project); projectProxy.Hierarchy = hierarchy; projectProxy.SolutionProxy = this; projectProxy.RelativePath = project.GetRelativePath(Source); projectProxy.Renamed += ProjectProxy_Renamed; _projectCache.Add(projectProxy); Target.OnOpenedProject(projectProxy.Name); }
public ProjectProxy CreateProject(ProjectProxy project) { using (var db = new DatabaseEntities()) { var proj = new Project() { Name = project.Name, Description = project.Description, DateStart = project.DateStart }; if (project.ProjectStatus != null) { proj.ProjectStatusId = project.ProjectStatus.Id; } if (project.Owner != null) { proj.Owner = project.Owner.Id; } var p = db.Projects.Add(proj); db.SaveChanges(); db.AccountsProjects.Add(new AccountsProject() { Account = project.Owner.Id, Project = p.Id }); var s = db.ProjectStatus.Add(new ProjectStatu() { Name = "Added", Project = p.Id }); db.SaveChanges(); proj.ProjectStatusId = s.Id; db.TaskStatus.Add(new TaskStatu() { Name = "TODO:", Project = p.Id }); db.SaveChanges(); return(GetProjectById(p.Id)); } }
public CreateStatusWindow(ServiceClient service, ProjectProxy project) { InitializeComponent(); this.service = service; this.currentProject = project; }
public ProjectProxy CreateProject(ProjectProxy project) { return(projectControl.CreateProject(project)); }
public void UpdateProject(ProjectProxy project) { projectControl.UpdateProject(project); }
//########################################################### //#################Method with callback###################### //############################################################ public ProjectProxy CreateProject(int accountId, ProjectProxy project) { var proj = dataAccess.CreateProject(project); return(proj); }