예제 #1
0
 public ProjectResponse GetProjectByCode(ProjectRequest request)
 {
     var response = new ProjectResponse();
     if (request.ProjectCode != string.Empty)
     {
         var projectFound = Olympus._Enterprise.Projects.Where(x => x.Code == request.ProjectCode).SingleOrDefault();
         if (projectFound != null)
         {
             //response.Project = MapperPaths.Map(projectFound);
             response.Project = Mapper.Map<ProjectDto>(projectFound);
         }
     }
     return response;
 }
예제 #2
0
 public ActionResult CreateProjectInform(string projectCode = "")
 {
     // Security needed
     if (projectCode != string.Empty)
     {
         var request = new ProjectRequest() { ProjectCode = projectCode };
         var response = new ProjectFactory().GetProjectByCode(request);
         if(response.Project != null)
         {
             var model = new ProjectInformModel();
             model.Project = response.Project;
             model.DateCreated = DateTime.Now;
             model.DateModified = DateTime.Now;
             model.InspectorName = SessionManager.FullName;
             return View(model);
         }
     }
     return View();
 }
예제 #3
0
        public ProjectResponse UpdateInventoyOutputs(ProjectRequest request)
        {
            var inventoryOutputs = GetInventoryOutputs(request.Project.Code);
            var response = new ProjectResponse();

            foreach(var tmpTask in request.Project.Tasks)
            {
                var taskOutputs = inventoryOutputs.Where(x => x.idTask.Equals(tmpTask)).ToList(); //Salidas de la tarea que se analiza

                //Se sacan los recursos de las salidas que pertenecen a una tarea especifica
                var resources = new List<SAL_DETALLE>();
                foreach(var tmpOutput in taskOutputs)
                    resources.AddRange(tmpOutput.SAL_DETALLE);

                //Se suman las salidas de cada recurso y se le asigna a lo real usado
                foreach(var tmpResource in tmpTask.Resources)
                {
                    tmpResource.RealUsed = resources.Where(x => x.INV_Codigo.Equals(tmpResource.Code)).Sum(y => y.SAL_Cantidad);
                }
            }
            response.Project = request.Project;
            return response;
        }
예제 #4
0
 private void Search(string query)
 {
     var request = new ProjectRequest {SearchProjectQuery = query};
     ShowSearchResults(new ProjectFactory().SearchProject(request).ProjectList);
 }
예제 #5
0
        public ProjectResponse CopyProject(ProjectRequest request)
        {
            var response = new ProjectResponse {Project = CopyProject(request.Project)};

            return response;
        }
예제 #6
0
        public ProjectResponse SearchProject(ProjectRequest request)
        {
            var response = new ProjectResponse {ProjectList = new List<ProjectDto>()};

            var projectsFound = Olympus._Enterprise.Projects
                                      .Where(x => x.Name.Contains(request.SearchProjectQuery) ||
                                                  x.Customer.Name.Contains(request.SearchProjectQuery) ||
                                                  x.Code.Contains(request.SearchProjectQuery) &&
                                                  x.StateId == 1)
                                      .OrderBy(y => y.Code)
                                      .Take(Convert.ToInt32(Properties.Resources.MaximunResultRows))
                                      .ToList();

            foreach (var project in projectsFound)
            {
                var tmpResourceType = Mapper.Map<ProjectDto>(project);
                response.ProjectList.Add(tmpResourceType);
            }
            return response;
        }
예제 #7
0
        public ProjectResponse SaveProject(ProjectRequest request)
        {
            var budgetAdapter = new BudgetAdapter();

            var response = new ProjectResponse();

            if (request.Project != null)
            {
                Project project = null;
                // Check if Edit or Add
                if (request.Project.Id > 0)
                {   // Edit
                    project = Olympus._Enterprise.Projects.Where(x => x.Id == request.Project.Id).SingleOrDefault();
                    Mapper.Map(request.Project, project);
                    if (request.Project.Tasks != null)
                        SaveTasks(request.Project.Tasks, project);
                }
                else
                {   // Add
                    if (request.Project.Code != null)
                    {   // Check some info from AlienDB
                        project = new Project();
                        Mapper.Map(request.Project, project);
                        if (request.Project.Tasks != null)
                            SaveTasks(request.Project.Tasks, project);
                        Olympus._Enterprise.Projects.AddObject(project);
                    }
                }
                Olympus._Enterprise.SaveChanges();

                if (project != null) //Save the Budget in DIALCOM
                {
                    response.ProjectId = project.Id;
                    var tmpTaskList = SearchTask(project.Id).TaskList;
                    request.ProjectId = project.Id;
                    var tmpProject = GetProject(request).Project;
                    budgetAdapter.SaveBudget(tmpProject, tmpTaskList);
                }
            }
            return response;
        }
예제 #8
0
 public ProjectResponse SearchProject(ProjectRequest request)
 {
     return _projectService.SearchProject(request);
 }
예제 #9
0
 public ProjectResponse GetProjectByCode(ProjectRequest request)
 {
     return _projectService.GetProjectByCode(request);
 }
예제 #10
0
 public ProjectResponse CopyProject(ProjectRequest request)
 {
     return _projectService.CopyProject(request);
 }
예제 #11
0
        private void SaveProject()
        {
            var request = new ProjectRequest();

            _project.Tasks = GetTask();
            request.Project = _project;

            var id = new ProjectFactory().SaveProject(request).ProjectId;
            _project = new ProjectFactory().GetProject( new ProjectRequest { ProjectId = id}).Project;
        }
예제 #12
0
        private void CopyProject()
        {
            var request = new ProjectRequest();
            _project.Tasks = GetTask();
            request.Project = _project;

            var newProject = new ProjectFactory().CopyProject(request).Project;
            newProject.Name = @"Copia de " + newProject.Name;

            var projectManager = new ProjectManager { MdiParent = ParentForm};
            projectManager.Show();
            projectManager.LoadProject(newProject);
        }