public HttpResponseMessage DeleteEmployeeProjectRoleAssignmnet(int employee_id, int project_id, int role_id) { HttpResponseMessage response = null; try { if (employee_id != 0 && project_id != 0 && role_id != 0) { Project_role project_role = ProjectRepo.GetAssignedEmployeebyid(employee_id, project_id, role_id); if (project_role != null) { ProjectRepo.DeleteEmployeeProjectRoleAssignmnet(project_role); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Employee deleted from the given project", "Employee deleted from the given project")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Failure : check employe id, role id and project id", "Failure : check employe id, role id and project id")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json, Project details and employee status")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public ManagerController(ProjectRepo _projectRepo, UserRepo _userRepo, ManipulateUsers _usersManipulator, NotificationRepo _notificationRepo) { projectRepo = _projectRepo; userRepo = _userRepo; usersManipulator = _usersManipulator; notificationRepo = _notificationRepo; }
public HttpResponseMessage GetAssignedEmployeebyid(int employee_id, int project_id, int role_id) { HttpResponseMessage response = null; try { if (employee_id != 0 && project_id != 0 && role_id != 0) { Project_role project_role = ProjectRepo.GetAssignedEmployeebyid(employee_id, project_id, role_id); if (project_role != null) { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", project_role)); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "failure : Given employee is not specifically assigned to the role in that project", "Given employee is not specifically assigned to the role in that project")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Please check input Json, Project details and employee status", "Please check input Json, Project details and employee status")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public ConfigService(AppConfigRepo appConfigRepo, ProjectsMetadataRepo projectsMetadataRepo, ProjectRepo projectRepo, IMemoryCache memoryCache) { _appConfigRepo = appConfigRepo; _projectsMetadataRepo = projectsMetadataRepo; _projectRepo = projectRepo; _memoryCache = memoryCache; }
public Project GetProjectByID(int Id) { ProjectRepo projectRepository = new ProjectRepo(); Project project = projectRepository.GetProjectById(Id); return(project); }
public ProjectListViewModel(IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IProjectRepository projectRepo = null, IMessenger messenger = null) : base(viewServices, settingsRepo, messenger) { ProjectRepo = projectRepo ?? new ProjectRepository(Session); Projects = new ObservableCollection <ProjectViewModel>(ProjectRepo.GetAll().OrderBy(p => p.Name).Select(p => new ProjectViewModel(p))); var last = Settings.GetById(SettingKeys.LastProject); CurrentProject = Projects.FirstOrDefault(p => p.Model.Id == last.Get <int>()) ?? Projects.FirstOrDefault(); foreach (var proj in Projects) { proj.CurrentChanged += Proj_CurrentChanged; } if (CurrentProject != null) { CurrentProject.IsCurrent = true; } ProjectNames = new List <string>(); Validate(nameof(NewProjectName)).Check(() => !string.IsNullOrWhiteSpace(NewProjectName)).Message(Strings.ProjectMustHaveName); Validate(nameof(NewProjectName)).Check(() => !ProjectNames.Contains(NewProjectName)).Message(Strings.ThisNameIsAlreadyUsed); Reset(); }
public Project GetProjectByProjectname(string ProjectName) { ProjectRepo projectRepository = new ProjectRepo(); Project project = projectRepository.getProjectByProjectname(ProjectName); return(project); }
public List <Project> GetAllProjects() { ProjectRepo projectRepository = new ProjectRepo(); List <Project> projects = projectRepository.GetAllProjects(); return(projects); }
private void DeleteSelectedButton_Click(object sender, EventArgs e) { var checkedProjects = new List <Project>(); foreach (var checkedProjectItem in ProjectListBox.CheckedItems) { checkedProjects.Add(ProjectRepo.GetProjectByName(checkedProjectItem.ToString().GetProjectName())); } if (checkedProjects.Count == 0) { return; } var confirmDeleteProject = new ConfirmForm(); confirmDeleteProject.ShowDialog(); if (!confirmDeleteProject.IsConfirmed) { return; } foreach (var project in checkedProjects) { Delete(project); } RefreshProjectsListBox(); }
private async void ExecuteDeleteProjectCommand(ProjectViewModel arg) { ConfirmationServiceArgs args = new ConfirmationServiceArgs(Strings.Confirm, string.Format(Strings.DoYouReallyWantToDeleteProjectXXX, arg.Model.Name), Strings.Yes, Strings.No); if (!await ViewServices.Execute <IConfirmationService, bool>(args)) { return; } arg.CurrentChanged -= Proj_CurrentChanged; Projects.Remove(arg); ProjectRepo.Delete(arg.Model); if (!Projects.Contains(CurrentProject)) { CurrentProject = Projects.FirstOrDefault(); if (CurrentProject != null) { CurrentProject.IsCurrent = true; } } MessengerInstance.Send(new NotificationMessage(Strings.ProjectDeleted)); }
public HttpResponseMessage EditEmployeeProjectRoleAssignmnet(Project_role project_roles) { HttpResponseMessage response = null; try { if (project_roles != null) { ProjectRepo.EditEmployeeProjectRoleAssignmnet(project_roles); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Employee details assigned to the given project has been changed", "Employee details assigned to the given project has been changed")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Please check input Json, Project details and employee status", "Please check input Json, Project details and employee status")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public async Task <IActionResult> CreateAssetAsync(string id, [FromForm, Required] IFormFile file, [FromForm, Required] string mediaType) { AssetType assetType; switch (mediaType) { case "audio": assetType = AssetType.Audio; break; case "sense-image": assetType = AssetType.Picture; break; default: return(BadRequest()); } if (!(await ProjectRepo.TryGetAsync(id)).TryResult(out LexProject project)) { return(NotFound()); } string relativeFilePath = await _assetService.SaveAssetAsync(project, file, assetType); string relativeDirPath = Path.GetDirectoryName(relativeFilePath).Replace('\\', '/'); string fileName = Path.GetFileName(relativeFilePath); string url = Uri.EscapeUriString("/" + relativeFilePath.Replace('\\', '/')); return(Created(url, new AssetDto { Path = relativeDirPath, FileName = fileName })); }
public HttpResponseMessage AssignEmployeeProjectRole(List <Project_role> project_roles) { HttpResponseMessage response = null; try { if (project_roles != null) { ProjectRepo.ProjectRoleAssignment(project_roles); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Project Role Assigned to the Employee Succesfully", "Project Role Assigned to the Employee Succesfully")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Please check input Json, Project details and employee status", "Please check input Json, Project details and employee status")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public Project Create(Project project) { try { ProjectRepo projectRepository = new ProjectRepo(); if (projectRepository.DoesProjectExist(project.ProjectName)) { throw new ValidationServiceException("Project with this name = " + project.ProjectName + ", already exist in database."); } projectRepository.Create(project); return(project); } catch (ValidationServiceException) { throw; } catch (RepositoryException) { throw; } catch (Exception ex) { throw new ServiceException("User with this Username = "******", already exists in database.", ex); } }
public HttpResponseMessage EditProjectDetails(Project project) { HttpResponseMessage response = null; try { if (project != null) { Project existingInstance = ProjectRepo.GetProjectById(project.id); if (existingInstance != null) { ProjectRepo.EditProject(project); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Project details Updated successfully!", "Project details Updated successfully!")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_204", "Project ID doesnot exists", "Invalid Project ID")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public HttpResponseMessage GetProjectById(int project_id)//p_id project_id { HttpResponseMessage response = null; try { if (project_id != 0) { ProjectModel existinginstance = ProjectRepo.GetProjectDetailsById(project_id); if (existinginstance != null) { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", existinginstance)); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_204", "Project ID doesnot exists", "Project ID doesnot exists")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
protected List <SelectListItem> GetProjectSelectList() { var projects = new ProjectRepo() .GetAll() ; var list = new List <SelectListItem>() { new SelectListItem() { Text = "Üst Projesi yok", Value = "XX" } }; foreach (var project in projects) { if (project.ProjeAdi.Any()) { list.Add(new SelectListItem() { Text = project.ProjeAdi, Value = project.Id.ToString() }); } else { list.Add(new SelectListItem() { Text = project.ProjeAdi, Value = project.Id.ToString() }); } } return(list); }
private void SaveButton_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(NameTextBox.Text)) { NameTextBox.Text = NameTextBox.Text.TrimAndRemoveWhiteSpaces().FirstLetterToUpper(); } foreach (var checkedEmployeeItem in EmployeeListBox.CheckedItems) { _checkedEmployeesOibList.Add(checkedEmployeeItem.ToString().GetOib()); } if (CheckForErrors()) { return; } AddEmployeesToProject(); if (CheckForErrors()) { return; } RemoveUncheckedEmployees(); ProjectRepo.Remove(ProjectRepo.GetProjectByName(OldName)); UpdateProjectName(); ProjectRepo.TryAdd(NameTextBox.Text, StartDatePicker.Value, EndDatePicker.Value); Close(); }
public async Task <IActionResult> GetAsync(string id) { if ((await ProjectRepo.TryGetAsync(id)).TryResult(out LexProject project)) { return(Ok(Map <LexProjectDto>(project))); } return(NotFound()); }
// GET: api/ProjectController/5 public Project Get(int id) { EmpDBContext db = new EmpDBContext(); Project pr = new Project(); pr.proid = id; return(ProjectRepo.SearchProjectsById(pr, db)); }
private static void Delete(Project toDelete) { ProjectRepo.Remove(toDelete); foreach (var employee in RelationProjectEmployeeRepo.GetEmployeesOnProject(toDelete.Name)) { RelationProjectEmployeeRepo.Remove(RelationProjectEmployeeRepo.GetRelation(employee.Oib, toDelete.Name)); } }
public void Reset() { NewProjectName = string.Empty; ProjectNames = ProjectRepo.GetAllNames().ToList(); ClearValidationErrors(); }
private void RefreshProjectsListBox() { ProjectListBox.Items.Clear(); foreach (var project in ProjectRepo.GetProjects()) { ProjectListBox.Items.Add(project); } }
public System_ProjectList getProjectListById(string CODE) { ProjectRepo repo = new ProjectRepo(); System_ProjectList res = repo.GetProjectListByCode(CODE); if (res == null) { throw new iS3Exception("未查询到该工程"); } return(res); }
public Project GetProject(int projectId, bool details) { Project project = ProjectRepo.Read(projectId, details); List <Phase> phases = new List <Phase>(); phases = ProjectRepo.ReadAllPhases(projectId).ToList(); project.Phases = phases; return(project); }
public Project MakeProject(Project project) { Project newProject = ProjectRepo.Create(project); newProject.CurrentPhase = project.CurrentPhase; newProject.CurrentPhase.Project = newProject; ProjectRepo.Create(newProject.CurrentPhase); ProjectRepo.Update(newProject); return(newProject); }
public void Test_Int_InsertProject_Success() { CounterRepo counterRepo = new CounterRepo(db); ProjectRepo projectRepo = new ProjectRepo(db, counterRepo); var project = projectRepo.Insert(new Models.Entity.Project { ProjectDescription = "unitTestProject description", ProjectKey = "unitTestProject" }); Assert.IsNotNull(project); Assert.IsNotNull(project.Id); Assert.IsTrue(project.ProjectNo > 0); }
public async Task <IActionResult> GetEntryAsync(string id, string entryId) { if (!(await ProjectRepo.TryGetAsync(id)).TryResult(out LexProject project)) { return(NotFound()); } IRepository <LexEntry> lexEntryRepo = _lexEntryRepoFactory.Create(project); if (!(await lexEntryRepo.TryGetAsync(entryId)).TryResult(out LexEntry entry)) { return(NotFound()); } return(Ok(Map <LexEntryDto>(entry, RouteNames.LexEntry))); }
[Route("api/v1/entire/project/list/{client_id?}/{status?}")] //entire project list (include active and incative client projects ) public HttpResponseMessage GetEntireProjectList(int client_id = 0, string status = null) //c_id client_id , status project_status { HttpResponseMessage response = null; try { List <ProjectModel> Project_List = ProjectRepo.GetEntireProjectList(client_id, status); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", Project_List)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public HttpResponseMessage GetAssignedProjectRoleList(int employee_id = 0, int project_id = 0, int reportingto_id = 0)//e_id employee_id , p_id project_id { HttpResponseMessage response = null; try { List <Project_role_model> project_role_list = ProjectRepo.GetAssignedProjectRoleList(employee_id, project_id, reportingto_id); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", project_role_list)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }