
* jquery-latest.js: * IITContent.cs: * ITContent.csproj: * YavscModel.csproj: * Write.aspx: * jquery.tablesorter.min.js: * AssemblyInfo.cs: * NewEstimateEvenArgs.cs: * jquery.metadata.js: ajax call Write * jquery.tablesorter.js: Estimate table sorting * Catalog.cs: Find a product by reference * NpgsqlContentProvider.cs: Npgsql provider could not get the Postgresql data type "money" * Yavsc.sln: Removing an empty project * MyClass.cs: implements IModule * fortune.csproj: uses Configuration * FrontOfficeApiController.cs: Url: GetEstimate/5 * WorkFlowController.cs: debugging ajax call * RemoveUserQuery.aspx: no more "head" place holder * Estimate.aspx: Ajax call to add a line to estimates * Web.config: using the "Deploy" target * IModule.cs: Install & uninstall using a System.Data.IDbConnection * IContentProvider.cs: refactoring * WorkFlowManager.cs: an event at creating an estimate (NewOrder) * Writting.cs: ProductReference is a string
74 lines
1.7 KiB
C#
74 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
using System.Web.Http;
|
|
using WorkFlowProvider;
|
|
using Yavsc.Model.WorkFlow;
|
|
using System.Web.Http.Controllers;
|
|
using System.Web.Security;
|
|
|
|
namespace Yavsc.ApiControllers
|
|
{
|
|
//[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
|
public class WorkFlowController : ApiController
|
|
{
|
|
string adminRoleName="Admin";
|
|
|
|
protected override void Initialize (HttpControllerContext controllerContext)
|
|
{
|
|
// TODO move it in a module initialization
|
|
base.Initialize (controllerContext);
|
|
if (!Roles.RoleExists (adminRoleName)) {
|
|
Roles.CreateRole (adminRoleName);
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public long CreateEstimate (string title)
|
|
{
|
|
return WorkFlowManager.CreateEstimate (
|
|
Membership.GetUser().UserName,title);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void DropWritting(long wrid)
|
|
{
|
|
WorkFlowManager.DropWritting (wrid);
|
|
}
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void UpdateWritting(Writting wr)
|
|
{
|
|
WorkFlowManager.UpdateWritting (wr);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public void DropEstimate(long estid)
|
|
{
|
|
WorkFlowManager.DropEstimate (estid);
|
|
}
|
|
|
|
[HttpGet]
|
|
[Authorize]
|
|
public object Index()
|
|
{
|
|
// TODO inform user on its roles and alerts
|
|
string username = Membership.GetUser ().UserName;
|
|
return new { test=string.Format("Hello {0}!",username) };
|
|
}
|
|
|
|
[HttpGet]
|
|
[HttpPost]
|
|
[Authorize]
|
|
public long Write (long estid, string desc, decimal ucost, int count, string productid) {
|
|
// TODO ensure estid owner matches the current one
|
|
return WorkFlowManager.Write(estid, desc, ucost, count, productid);
|
|
}
|
|
}
|
|
}
|