control projects

vnext
Paul Schneider 6 years ago
parent bbb750c47a
commit e56547d25f
4 changed files with 52 additions and 102 deletions

@ -19,7 +19,7 @@ namespace Yavsc.Server.Models.IT
[Required] [Required]
public string ProjectName { get; set;} public string ProjectName { get; set;}
[ForeignKey("ProjectName")] [ForeignKey("Name")]
public virtual Project TargetProject { get; set; } public virtual Project TargetProject { get; set; }
} }
@ -33,8 +33,6 @@ namespace Yavsc.Server.Models.IT
public override long Id { get; set ; } public override long Id { get; set ; }
public string OwnerId { get; set; } public string OwnerId { get; set; }
public string LocalRepo { get; set; }
/// <summary> /// <summary>
/// This field is something like a key, /// This field is something like a key,
/// since it is required non null, /// since it is required non null,
@ -65,8 +63,6 @@ namespace Yavsc.Server.Models.IT
return bill; return bill;
} }
public string Description { get; set; } public string Description { get; set; }
public override string GetDescription() public override string GetDescription()

@ -3,9 +3,13 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Extensions.Logging;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Server.Models.IT; using Yavsc.Server.Models.IT;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Yavsc.Server.Helpers;
using Yavsc.Models.Workflow;
using Yavsc.Models.Payment;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -13,10 +17,12 @@ namespace Yavsc.Controllers
public class ProjectController : Controller public class ProjectController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;
ILogger _logger;
public ProjectController(ApplicationDbContext context) public ProjectController(ApplicationDbContext context, ILoggerFactory loggerFactory)
{ {
_context = context; _context = context;
_logger = loggerFactory.CreateLogger<ProjectController>();
} }
// GET: Project // GET: Project
@ -46,11 +52,19 @@ namespace Yavsc.Controllers
// GET: Project/Create // GET: Project/Create
public IActionResult Create() public IActionResult Create()
{ {
ViewData["ClientId"] = new SelectList(_context.ApplicationUser, "Id", "Client");
ViewData["ActivityCode"] = new SelectList(_context.Activities, "Code", "Context"); ViewBag.ClientIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "PerformerProfile"); u => u.Id, u => u.UserName);
ViewData["PaymentId"] = new SelectList(_context.PayPalPayments, "CreationToken", "Regularisation"); ViewBag.OwnerIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
ViewData["Name"] = new SelectList(_context.GitRepositoryReference, "Path", "Repository"); u => u.Id, u => u.UserName);
ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
a => a.Code, a => a.Name);
ViewBag.PerformerIdItems = _context.Performers.CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
return View(); return View();
} }
@ -65,11 +79,19 @@ namespace Yavsc.Controllers
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return RedirectToAction("Index"); return RedirectToAction("Index");
} }
ViewData["ClientId"] = new SelectList(_context.ApplicationUser, "Id", "Client", project.ClientId); ViewBag.ClientIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
ViewData["ActivityCode"] = new SelectList(_context.Activities, "Code", "Context", project.ActivityCode); u => u.Id, u => u.UserName);
ViewData["PerformerId"] = new SelectList(_context.Performers, "PerformerId", "PerformerProfile", project.PerformerId); ViewBag.OwnerIdItems = _context.ApplicationUser.CreateSelectListItems<ApplicationUser>(
ViewData["PaymentId"] = new SelectList(_context.PayPalPayments, "CreationToken", "Regularisation", project.PaymentId); u => u.Id, u => u.UserName);
ViewData["Name"] = new SelectList(_context.GitRepositoryReference, "Path", "Repository", project.Name); ViewBag.ActivityCodeItems = _context.Activities.CreateSelectListItems<Activity>(
a => a.Code, a => a.Name);
ViewBag.PerformerIdItems = _context.Performers.CreateSelectListItems<PerformerProfile>(p => p.PerformerId, p => p.Performer.UserName);
ViewBag.PaymentIdItems = _context.PayPalPayments.CreateSelectListItems<PayPalPayment>
(p => p.OrderReference, p => $"{p.Executor.UserName} {p.PaypalPayerId} {p.OrderReference}");
ViewBag.Status = typeof(Yavsc.QueryStatus).CreateSelectListItems(null);
return View(project); return View(project);
} }

@ -11,39 +11,17 @@
<h4>Project</h4> <h4>Project</h4>
<hr /> <hr />
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div> <div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
<div class="form-group"> <div class="form-group">
<label asp-for="ActivityCode" class="col-md-2 control-label"></label> <label asp-for="ActivityCode" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<select asp-for="ActivityCode" class ="form-control"></select> <select asp-for="ActivityCode" class ="form-control" asp-items="@ViewBag.ActivityCodeItems" ></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="ClientId" class="col-md-2 control-label"></label> <label asp-for="ClientId" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<select asp-for="ClientId" class ="form-control"></select> <select asp-for="ClientId" class ="form-control" asp-items="@ViewBag.ClientIdItems"></select>
</div> </div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Consent" />
<label asp-for="Consent"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="DateCreated" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="DateCreated" class="form-control" />
<span asp-validation-for="DateCreated" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="DateModified" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="DateModified" class="form-control" />
<span asp-validation-for="DateModified" class="text-danger" />
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="Description" class="col-md-2 control-label"></label> <label asp-for="Description" class="col-md-2 control-label"></label>
@ -52,38 +30,26 @@
<span asp-validation-for="Description" class="text-danger" /> <span asp-validation-for="Description" class="text-danger" />
</div> </div>
</div> </div>
<div class="form-group">
<label asp-for="LocalRepo" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="LocalRepo" class="form-control" />
<span asp-validation-for="LocalRepo" class="text-danger" />
</div>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Name" class="col-md-2 control-label"></label> <label asp-for="Name" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<select asp-for="Name" class ="form-control"></select> <input asp-for="Name" class ="form-control" aria-required="true" ></input>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="OwnerId" class="col-md-2 control-label"></label> <label asp-for="OwnerId" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<input asp-for="OwnerId" class="form-control" /> <select asp-for="OwnerId" asp-items="@ViewBag.OwnerIdItems" class="form-control" >
</select>
<span asp-validation-for="OwnerId" class="text-danger" /> <span asp-validation-for="OwnerId" class="text-danger" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="PaymentId" class="col-md-2 control-label"></label>
<div class="col-md-10">
<select asp-for="PaymentId" class ="form-control"></select>
</div>
</div>
<div class="form-group">
<label asp-for="PerformerId" class="col-md-2 control-label"></label> <label asp-for="PerformerId" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<select asp-for="PerformerId" class ="form-control"></select> <select asp-for="PerformerId" class ="form-control" asp-items="@ViewBag.PerformerId"></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="Previsional" class="col-md-2 control-label"></label> <label asp-for="Previsional" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
@ -91,47 +57,11 @@
<span asp-validation-for="Previsional" class="text-danger" /> <span asp-validation-for="Previsional" class="text-danger" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="Rejected" />
<label asp-for="Rejected"></label>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="RejectedAt" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="RejectedAt" class="form-control" />
<span asp-validation-for="RejectedAt" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="Status" class="col-md-2 control-label"></label> <label asp-for="Status" class="col-md-2 control-label"></label>
<div class="col-md-10"> <div class="col-md-10">
<select asp-for="Status" class="form-control"></select> <select asp-for="Status" class="form-control" asp-items="@ViewBag.Status" ></select>
<span asp-validation-for="Status" class="text-danger" /> <span asp-validation-for="Status" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="UserCreated" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="UserCreated" class="form-control" />
<span asp-validation-for="UserCreated" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="UserModified" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="UserModified" class="form-control" />
<span asp-validation-for="UserModified" class="text-danger" />
</div>
</div>
<div class="form-group">
<label asp-for="ValidationDate" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ValidationDate" class="form-control" />
<span asp-validation-for="ValidationDate" class="text-danger" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

@ -11,8 +11,10 @@
@using System.Security.Claims; @using System.Security.Claims;
@using System.Web.Optimization; @using System.Web.Optimization;
@using Yavsc; @using Yavsc;
@using Yavsc.Helpers; @using Yavsc.Helpers;
@using Yavsc.Server.Helpers;
@using Yavsc.Models; @using Yavsc.Models;
@using Yavsc.Models.Access; @using Yavsc.Models.Access;
@using Yavsc.Models.Auth; @using Yavsc.Models.Auth;

Loading…