public ActionResult GetProjectById(int id) { var model = new ProjectDetailViewModel(); if (User.IsInRole("Admin")) { model = projectModel.GetProjectById_Admin(id); } else { model = projectModel.GetProjectById_Manager(id); } model.ProjectInfo = BindProjectModel(model.ProjectInfo); if (User.IsInRole("Admin")) { model.ShowCosting = true; model.ProjectCosting = BindProjectCostingModel(model.ProjectCosting); } else { model.ShowCosting = false; } return(PartialView("_Partial_ProjectAdmin", model)); }
protected async override void OnAppearing() { lblInvasive.IsVisible = App.IsInvasive; base.OnAppearing(); ProjectDetailViewModel vm = ((ProjectDetailViewModel)this.BindingContext); await vm.LoadData(); //if(vm.Project.ProjectType == "Invasive"&&vm.CanInvasiveCreate==true) //{ // btnInvasive.Text = "Refresh"; // btnInvasive.IsVisible = true; //} //if (vm.Project.IsAccess==true) //{ // //btnInvasive.Text = "Refresh"; // btnInvasive.IsVisible = true; //} //if (vm.Project.IsAccess==true&& vm.Project.ProjectType == "Invasive") //{ // btnInvasive.Text = "Refresh"; // btnInvasive.IsVisible = true; //} //else //{ // btnInvasive.Text = "Refresh"; // btnInvasive.IsVisible = true; //} // vm.LoadData(); }
public ActionResult projectdetail(int id) { ProjectDetailViewModel pdvm = new ProjectDetailViewModel(); pdvm.projectinfo = ProjectBusinessLayer.getprojectbyid(id); return(View(pdvm)); }
public void Update(ProjectDetailViewModel Vm) { var data = _mapper.Map <Project>(Vm); _projectRepository.Update(data); SaveChanges(); }
public ProjectDetailViewModel GetById(int id) { var project = _dbContext.Projects .Include(p => p.Client) .Include(p => p.Freelancer) .FirstOrDefault(p => p.Id == id); if (project == null) { return(null); } var projectsDetailViewModel = new ProjectDetailViewModel( project.Id, project.Title, project.Description, project.StartedAt, project.FinishedAt, project.TotalCost, project.Client.FullName, project.Freelancer.FullName ); return(projectsDetailViewModel); }
private async void LoadDataAsync(int projectId) { project = await projectManager.Get(projectId); DescriptionEditor.Text = project.Description; TitleEntry.Text = project.Name; }
public async Task <IActionResult> Edit(ProjectDetailViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var projectId = model.Id; var project = await _projectService.GetByIdAsync(projectId); if (project == null) { ModelState.AddModelError("Error", "Unable to load the project"); return(View(model)); } project.Name = model.Name; project.Description = model.Description; await _projectService.Update(project); model.StatusMessage = $"{project.Name} project has been updated"; return(View(model)); }
public async Task <IActionResult> Detail(int id) { string userId = User.FindFirstValue(ClaimTypes.NameIdentifier); Project projectsFromDb = await _portfolioContext.Projects .Include(project => project.Status) .Include(project => project.ProjectTags) .ThenInclude(projectTag => projectTag.Tag) .FirstOrDefaultAsync(movie => movie.Id == id && movie.ProjectAppUserId == userId); ProjectDetailViewModel movie = new ProjectDetailViewModel() { Name = projectsFromDb.Name, Description = projectsFromDb.Description, PhotoUrl = projectsFromDb.PhotoUrl, ProjectStatusID = projectsFromDb.Status.Id, Tags = projectsFromDb.ProjectTags.Select(projectTag => projectTag.Tag.Name) }; //List<string> tags = new List<string>(); //foreach(var movieTag in movieFromDb.MovieTags) //{ // tags.Add(movieTag.Tag.Name); //} //movie.Tags = tags; return(View(movie)); }
public IActionResult RemoveClient(int id, [Bind("SelectID", "ProjID")] ProjectDetailViewModel project) { if (ModelState.IsValid) { var proj = _context.Projects.SingleOrDefault(c => c.ProjectID == id); var client = _context.Clients.SingleOrDefault(c => c.ID == project.SelectID); var cliToAdd = new ProjectPerson { Project = proj, ProjectID = id, Person = client, PersonID = client.ID }; _context.ProjectPersons.Remove(cliToAdd); _context.SaveChanges(); return(RedirectToRoute(new { controller = "Project", action = "Details", id = id })); } return(NotFound()); }
private ProjectDetailViewModel GetProjectDetailFromEntity(Expression <Func <Project, bool> > ProjectId) { var entity = _repository.GetAll <Project>().FirstOrDefault(ProjectId); //UpdateProjectStatus(entity); //if (entity != default(Models.Project)) //{ var projectdetailVM = new ProjectDetailViewModel() { Category = entity.Category, ProjectStatus = entity.ProjectStatus, ProjectName = entity.ProjectName, CreatorName = entity.CreatorName, FundingAmount = entity.FundingAmount, Fundedpeople = entity.Fundedpeople, ProjectDescription = entity.ProjectDescription, ProjectImgUrl = entity.ProjectImgUrl, ProjectVideoUrl = entity.ProjectVideoUrl, AmountThreshold = entity.AmountThreshold, ProjectFAQList = ConvertProjectFAQList(entity.Project_Question, entity.Project_Answer), //Project_Question = entity.Project_Question, //Project_Answer = entity.Project_Answer, EndDate = entity.EndDate, StartDate = entity.StartDate, ProjectMainUrl = entity.ProjectMainUrl, ProjectId = entity.ProjectId, MemberId = entity.MemberId, ApprovingStatus = entity.ApprovingStatus, }; return(projectdetailVM); }
public async Task <IActionResult> CreateOrEdit(ProjectDetailViewModel model) { if (model == null) { return(View(new ProjectDetailViewModel())); } if (string.IsNullOrEmpty(model.ProjectName)) { model.StatusMessage = "Proje Adı alanı zorunludur"; return(View(model)); } if (model.Id > 0) { var project = await _projectService.GetByIdAsync(model.Id); project.ProjectName = model.ProjectName; await _projectService.Update(project); } else { await _projectService.Add(new Project { ProjectName = model.ProjectName }); } return(RedirectToAction(nameof(Index))); }
// GET: Projects/Details/5 public ActionResult Details(int?id) { ProjectDetailViewModel vm = new ProjectDetailViewModel(); //AdminProjectViewModel vm = new AdminProjectViewModel(); UserRolesHelper helper = new UserRolesHelper(); ProjectsHelper phelper = new ProjectsHelper(); var pSub = phelper.ProjectUsersByRole(id.Value, "Submitter"); var pDev = phelper.ProjectUsersByRole(id.Value, "Developer"); var pms = helper.UsersInRole("ProjectManager"); vm.PMUsers = new SelectList(pms, "Id", "FirstName"); vm.TeamMembers = new SelectList(db.Users, "Id", "FullName"); vm.Developers = pDev; vm.Submitters = pSub; vm.Project = db.Projects.Find(id); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //Project project = db.Projects.Find(id); if (vm.Project == null) { return(HttpNotFound()); } return(View(vm)); }
public ActionResult ProjectDetail(string ID) { if (Session["username"] == null || Session["username"].Equals("")) { return(RedirectToAction("Index", "Session")); } var vm = new ProjectDetailViewModel(); using (var db = new ProjectManagementEntities()) { var result = db.Project.Where(u => u.ID.ToString().Equals(ID.Trim())); if (result.Count() > 0) { var item = result.FirstOrDefault(); vm.ID = item.ID.ToString(); vm.Name = item.Name; vm.Province = item.County.City.Province.Name; vm.City = item.County.City.Name; vm.County = item.County.Name; vm.PartyA = item.PartyAName; vm.PartyB = item.PartyB.Name; vm.ResponsiblePerson = item.ResponsiblePerson; vm.ContactPhone = item.ContactPhone; vm.Money = item.Money.ToString("C"); vm.Date = item.Date.ToString("yyyy-MM-dd"); } else { vm.ID = "错误的查询信息"; } } return(View(vm)); }
public ActionResult Details(int id) { var project = _repo.GetProjectDetail(id); var projectGallery = _repo.GetProjectGallery(project.Id); var similarProjects = _repo.GetProjectsByTypeId(project.ProjectTypeId.Value); // Removing current project from similar projects if (similarProjects.Any()) { similarProjects.Remove(project); } var projectDetailVm = new ProjectDetailViewModel() { Project = project, Gallery = projectGallery, SimilarProjects = similarProjects }; #region BreadCrumb var breadCrumbVm = new List <BreadCrumbViewModel>(); breadCrumbVm.Add(new BreadCrumbViewModel() { Title = "پروژه های فرادید", Href = "/Projects" }); breadCrumbVm.Add(new BreadCrumbViewModel() { Title = project.Title, Href = "#" }); ViewBag.BreadCrumb = breadCrumbVm; #endregion return(View(projectDetailVm)); }
public async Task <MobileResult> PutAsync(ProjectDetailViewModel model) { var client = await GetClient(); var json = await client.PutAsync(Url + "editpproject", new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json")); var result = JsonConvert.DeserializeObject <MobileResult>(await json.Content.ReadAsStringAsync()); return(result); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> internal ProjectDetailViewModel GetProjectById_Manager(int id) { var project = db.Projects.Include("List.Client").Include("List").Include("Priority1").Include("ProjectStatu").FirstOrDefault(x => x.Id == id); var projectInfo = Mapper.Map <Project, ProjectViewModel>(project); projectInfo.ClientId = project.List.ClientId; var tblProjCosting = projectInfo.ProjectCostings.FirstOrDefault(); var model = new ProjectDetailViewModel(); model.ProjectInfo = projectInfo; return(model); }
// GET: Projects/Details/5 (what is the five?) public async Task <IActionResult> Details(string id) { if (id == null) { return(NotFound()); } var project = await _context.Projects .SingleOrDefaultAsync(m => m.ID == id); if (project == null) { return(NotFound()); } var clients = from participant in _context.Clients join projectparticipant in _context.ProjectRoster on participant.ID equals projectparticipant.ProjectParticipantID where project.ID == projectparticipant.ProjectID select participant; var members = from participant in _context.Members join projectparticipant in _context.ProjectRoster on participant.ID equals projectparticipant.ProjectParticipantID where project.ID == projectparticipant.ProjectID select participant; var projectts = from man in _context.Projects select man; foreach (var guy in projectts) { guy.ToString(); Console.WriteLine(guy); } ProjectDetailViewModel pdvm = new ProjectDetailViewModel { TheProject = project, ProjectClients = clients.ToList() ?? null, ProjectMembers = members.ToList() ?? null }; return(View(pdvm)); }
public ActionResult Details(byte teamID, int projectID) { TempData["ProjectID"] = projectID; TempData["TeamID"] = teamID; var viewModel = new ProjectDetailViewModel { Project = _context.Project.Where(p => p.Id == projectID).FirstOrDefault(), Resources = _context.Project.Where(p => p.Id == projectID).SelectMany(r => r.ProjectResource.Select(c => c.Resource)).ToList(), OnsiteResources = _context.Project.Where(p => p.Id == projectID).SelectMany(r => r.ProjectResource.Where(pr => pr.OnSite).Select(c => c.Resource)).ToList() }; return(View(viewModel)); }
public ApiResult PutProject([FromBody] ProjectDetailViewModel model) { try { result.Result = true; _projectService.UpdateProject(new Project { Description = model.Description, Name = model.Name, ProjectId = model.ProjectId, RegisterTime = model.RegisterTime }); result.Data = "Project updated."; result.Message = "Success"; } catch (Exception ex) { result.Result = false; result.Message = $"Error : {ex.Message}"; } return(result); }
public async Task <IActionResult> ProjectNote(ProjectDetailViewModel model, int projectid) { var project = await _projectDataService.GetProjectById(projectid); Note note = new Note { NoteContent = model.Note.NoteContent, CreatedOn = DateTime.Now, CreatedBy = Constants.HardCodedSignedInUser, Project = project }; await _noteDataService.AddNoteAsync(note); return(RedirectToAction("Details", "Projects", new { id = project.ProjectId })); }
private async Task <ProjectDetailViewModel> GetProjectAndReferencesFromSharePoint(string projectId) { ProjectDetailViewModel model = new ProjectDetailViewModel(); ProjectsRepository projectRepository = new ProjectsRepository(); ReferencesRepository referenceRepository = new ReferencesRepository(); int id = -1; if (Int32.TryParse(projectId, out id)) { model.Project = await projectRepository.GetProject(id, String.Empty); model.References = (await referenceRepository.GetReferencesForProject(id)).ToList(); } return(model); }
public async Task <IActionResult> Create(ProjectDetailViewModel model) { if (!ModelState.IsValid) { return(View(model)); } await _projectService.Add(new Project { Name = model.Name, Description = model.Description, CreatedDate = DateTime.Now }); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Detail(int id) { Project project = await _projectDb.Projects.Include(x => x.Status).Include(x => x.ProjectTags).ThenInclude(x => x.Tag).FirstOrDefaultAsync(x => x.Id == id); ProjectDetailViewModel vm = new ProjectDetailViewModel() { Title = project.Title, CompletionDate = project.CompletionDate, Status = project.Status.Description, Tags = project.ProjectTags.Select(x => x.Tag.Description).ToList(), PhotoUrl = project.PhotoUrl, Description = project.Description }; return(View(vm)); }
public async Task <IActionResult> Create(ProjectDetailViewModel model) { if (!ModelState.IsValid) { return(View("Create", model)); } await Mediator.Send(new CreateProjectCommand { DomainName = model.DomainName, Name = model.Name, UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value }); return(RedirectToAction("Index") .WithSuccess("Project", "Created successfully")); }
protected override DriverResult Display(ProjectTitleAndMenuPart part, string displayType, dynamic shapeHelper) { if (!(new string[] { "Detail", "TitleAndMenu", "Planner", "GanttChart" }).Contains(displayType)) { return(null); } var attachToProjectPart = part.As <AttachToProjectPart>(); if (attachToProjectPart == null || attachToProjectPart.Record.Project != null) { var item = this.services.ContentManager.Get <ProjectPart>(attachToProjectPart.Record.Project.Id, VersionOptions.Published); var projectDetailViewModel = new ProjectDetailViewModel { ProjectPart = item, CurrentUserCanChangePermission = this.contentOwnershipService.CurrentUserCanChangePermission(item), CurrentUserCanEdit = this.contentOwnershipService.CurrentUserCanEditContent(item) }; List <DriverResult> shapes = new List <DriverResult>(); var menu = this.extendedProjectService.GetProjectMenuWidget(attachToProjectPart.Record.Project.Id); if (menu != null) { projectDetailViewModel.MenuShape = this.services.ContentManager.BuildDisplay(menu); } shapes.Add(ContentShape("Parts_Project_Menu", () => shapeHelper.Parts_Project_Menu(Model: projectDetailViewModel))); if (part.ContentItem.ContentType == ContentTypes.WikiContentType || part.ContentItem.ContentType == ContentTypes.RootWikiContentType) { shapes.Add(ContentShape("Parts_Wiki_Title", () => shapeHelper.Parts_Wiki_Title(Model: item))); } else { shapes.Add(ContentShape("Parts_Project_Title", () => shapeHelper.Parts_Project_Title(Model: item))); } return(Combined(shapes.ToArray())); } else { return(null); } }
private async void AddButton_Clicked(object sender, EventArgs e) { ProjectDetailViewModel newProject = new ProjectDetailViewModel { Description = DescriptionEditor.Text, Name = TitleEntry.Text, RegisterTime = DateTime.Now, UserId = Constants.userId }; var result = await projectManager.PostAsync(newProject); await Navigation.PopPopupAsync(); if (result.Result) { DependencyService.Get <IMessage>().ShortAlert("New project added."); } else { DependencyService.Get <IMessage>().ShortAlert("Project can not be added."); } }
// GET: Projects/Details/5 public async Task<IActionResult> Details(int? id) { var vm = new ProjectDetailViewModel(); vm.Ticket = _context.Ticket.Include(t => t.Project).Include(t => t.Status).Include(t => t.UserCreated).ToList(); if (id == null) { return NotFound(); } vm.Project = await _context.Projects .FirstOrDefaultAsync(m => m.Id == id); if (vm.Project == null) { return NotFound(); } return View(vm); }
private async void AddButton_Clicked(object sender, EventArgs e) { ProjectDetailViewModel updatedProject = new ProjectDetailViewModel { Description = DescriptionEditor.Text, Name = TitleEntry.Text, ProjectId = project.ProjectId, RegisterTime = project.RegisterTime, UserId = project.UserId }; var result = await projectManager.PutAsync(updatedProject); await Navigation.PopPopupAsync(); if (result.Result) { DependencyService.Get <IMessage>().ShortAlert("Project updated."); } else { DependencyService.Get <IMessage>().ShortAlert("Project can not be updated."); } }
public ApiResult PostProject(ProjectDetailViewModel model) { try { Project project = new Project { Description = model.Description, Name = model.Name }; result.Result = true; _projectService.AddProject(project); _p2uService.AddProjectToUser(new ProjectToUser { Project = project, UserId = model.UserId }); result.Data = "Project added."; result.Message = "Success"; } catch (Exception ex) { result.Result = false; result.Message = $"Error : {ex.Message}"; } return(result); }
// GET: Projects/Details/5 public async Task <IActionResult> Details(int?id) { var view = new ProjectDetailViewModel(); if (id == null) { return(NotFound()); } view.Project = await _projectDataService.GetProjectById(id, "projectNotes"); if (view.Project == null) { return(NotFound()); } view.Project.WorkItems = await _workItemDataService.GetByProjectId(view.Project.ProjectId); return(View(view)); }