* Web.csproj:
* 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
This commit is contained in:
parent
886bb31882
commit
f157c6edb9
25 changed files with 1569 additions and 167 deletions
|
|
@ -71,9 +71,9 @@ namespace Yavsc.ApiControllers
|
|||
/// </summary>
|
||||
/// <returns>The estimate.</returns>
|
||||
/// <param name="estid">Estid.</param>
|
||||
public Estimate GetEstimate (long estid)
|
||||
public Estimate GetEstimate (long Id)
|
||||
{
|
||||
Estimate est = WorkFlowManager.ContentProvider.GetEstimate (estid);
|
||||
Estimate est = WorkFlowManager.ContentProvider.GetEstimate (Id);
|
||||
return est;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using System.Web.Security;
|
|||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
||||
//[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
||||
public class WorkFlowController : ApiController
|
||||
{
|
||||
string adminRoleName="Admin";
|
||||
|
|
@ -63,8 +63,9 @@ namespace Yavsc.ApiControllers
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public long Write (long estid, string desc, decimal ucost, int count, long productid=0) {
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
<%@ Page Title="User removal" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
|
||||
<asp:Content ContentPlaceHolderID="head" ID="headContent" runat="server">
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="header" ID="headerContent" runat="server">
|
||||
<h2>Suppression d'un utilisateur</h2>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<div>
|
||||
<%= Html.ValidationSummary() %>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
<%@ Page Title="Devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Estimate>" MasterPageFile="~/Models/App.master" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<script type="text/javascript" src="/js/jquery-latest.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery.tablesorter.js"></script>
|
||||
<%= Html.ValidationSummary("Devis") %>
|
||||
<% using (Html.BeginForm("Estimate","FrontOffice")) { %>
|
||||
<%= Html.LabelFor(model => model.Title) %>:<br/>
|
||||
<%= Html.TextBox( "Title" ) %>
|
||||
<%= Html.LabelFor(model => model.Title) %>:<%= Html.TextBox( "Title" ) %>
|
||||
<%= Html.ValidationMessage("Title", "*") %>
|
||||
<% if (Model.Id > 0) { %>
|
||||
<br/>
|
||||
|
|
@ -16,27 +17,129 @@
|
|||
<%= Html.LabelFor(model => model.Id) %>:<%=Model.Id%>
|
||||
<%= Html.Hidden( "Id" ) %>
|
||||
<br/>
|
||||
|
||||
<% if (Model.Lines ==null || Model.Lines.Length == 0) { %>
|
||||
<i>Pas de ligne.</i>
|
||||
<%
|
||||
} else { %>
|
||||
<ul>
|
||||
<% foreach (Writting wr in Model.Lines) { %>
|
||||
<li><%=wr.Count%>/<%=wr.Id%>/<%=wr.ProductReference%>/<%=wr.UnitaryCost%>/<%=wr.Description%></li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% if (Model.Id==0) { %>
|
||||
<input type="submit" name="submit" value="Create"/>
|
||||
<% } else { %>
|
||||
<input type="submit" name="submit" value="Update"/>
|
||||
<% }
|
||||
%>
|
||||
|
||||
<script type="text/javascript" >
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} );
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<% } %>
|
||||
<% if (Model.Lines ==null || Model.Lines.Length == 0) { %>
|
||||
<i>Pas de ligne.</i>
|
||||
<%
|
||||
} else { %>
|
||||
|
||||
<table class="tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Description</th>
|
||||
<th>Product Reference</th>
|
||||
<th>Count</th>
|
||||
<th>Unitary Cost</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="wrts">
|
||||
<% foreach (Writting wr in Model.Lines) { %>
|
||||
<tr>
|
||||
<td><%=wr.Id%></td>
|
||||
<td><%=wr.Description%></td>
|
||||
<td><%=wr.ProductReference%></td>
|
||||
<td><%=wr.Count%></td>
|
||||
<td><%=wr.UnitaryCost%></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
|
||||
<script type="text/javascript" >
|
||||
function ShowHideBtn(btn,id)
|
||||
{
|
||||
var shdiv = document.getElementById(id);
|
||||
var wanit = shdiv.style.display == "none"; // switch button
|
||||
shdiv.style.display = wanit ? "block" : "none";
|
||||
btn.value = wanit ? "-" : "+";
|
||||
}
|
||||
</script>
|
||||
|
||||
<form id="writeform">
|
||||
<input type="button" onclick="ShowHideBtn(this,'writearea');" value="+"/>
|
||||
<div id="writearea" style="display:none;">
|
||||
<input type="hidden" name="estid" id="estid" value="<%=Model.Id%>"/>
|
||||
<label for="desc">Description:</label>
|
||||
<input type="text" name="desc" id="desc" />
|
||||
<label for="ucost">Prix unitaire:</label>
|
||||
<input type="number" name="ucost" id="ucost"/>
|
||||
<label for="count">Quantité:</label>
|
||||
<input type="number" name="count" id="count"/>
|
||||
<label for="productid">Référence du produit:</label>
|
||||
<input type="text" name="productid" id="productid"/>
|
||||
<input type="button" name="btnapply" id="btnapply" value="Écrire"/>
|
||||
<input type="hidden" name="wrid" id="wrid" />
|
||||
<tt id="dbgv"></tt>
|
||||
<input type="button" name="btnview" id="btnview" value="View Values"/>
|
||||
|
||||
<script>
|
||||
|
||||
jQuery.support.cors = false;
|
||||
function GetWritting () {
|
||||
var estid = parseInt($("#estid").val());
|
||||
var ucost = Number($("#ucost").val());
|
||||
var count = parseInt($("#count").val());
|
||||
var desc = $("#desc").val();
|
||||
var productid = $("#productid").val();
|
||||
return {
|
||||
estid:estid,
|
||||
desc:desc,
|
||||
ucost:ucost,
|
||||
count:count,
|
||||
productid:productid
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#btnapply").click(function () {
|
||||
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/WorkFlow/Write",
|
||||
type: "Get",
|
||||
dataType: "json",
|
||||
data: GetWritting(),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function (data) {
|
||||
$("#wrid").val(data);
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$("#dbgv").text(xhr.status+" : "+xhr.responseText);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#btnview").click(function () {
|
||||
$("#dbgv").text(JSON.stringify(GetWritting()));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</form>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
|
|
|
|||
14
web/Views/FrontOffice/Write.aspx
Normal file
14
web/Views/FrontOffice/Write.aspx
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<%@ Page Title="Ligne de devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Writting>" MasterPageFile="~/Models/App.master" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<%= Html.ValidationSummary("Ligne de devis") %>
|
||||
<% using (Html.BeginForm("Write","WorkFlow")) { %>
|
||||
<%= Html.LabelFor(model => model.Id) %>:<%=Model.Id%>
|
||||
<%= Html.Hidden( "Id" ) %>
|
||||
<%= Html.Hidden( "EstimateId", (long) ViewData["EstimateId"]) %>
|
||||
|
||||
<%= Html.LabelFor(model => model.UnitaryCost) %>:<%= Html.TextBox( "UnitaryCost" ) %>
|
||||
<%= Html.ValidationMessage("UnitaryCost", "*") %>
|
||||
|
||||
<% } %>
|
||||
</asp:Content>
|
||||
|
|
@ -67,6 +67,9 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
|||
<add assembly="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<customErrors mode="Off" />
|
||||
|
|
|
|||
|
|
@ -76,16 +76,16 @@
|
|||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<Reference Include="Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="System.Web.Http.WebHost">
|
||||
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Web.Http.WebHost.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
|
||||
<Package>nunit</Package>
|
||||
<Reference Include="System.Net.Http.Formatting">
|
||||
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -106,6 +106,7 @@
|
|||
<Folder Include="CatExts\" />
|
||||
<Folder Include="Views\WorkFlow\" />
|
||||
<Folder Include="Views\Admin\" />
|
||||
<Folder Include="js\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
|
|
@ -198,28 +199,22 @@
|
|||
<Content Include="Views\Admin\Index.aspx" />
|
||||
<Content Include="Views\FrontOffice\Estimate.aspx" />
|
||||
<Content Include="Views\FrontOffice\test.cshtml" />
|
||||
<Content Include="js\jquery.metadata.js" />
|
||||
<Content Include="js\jquery.tablesorter.js" />
|
||||
<Content Include="js\jquery.tablesorter.min.js" />
|
||||
<Content Include="js\jquery-latest.js" />
|
||||
<Content Include="Views\FrontOffice\Write.aspx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<Import Project="WebDeploy.targets" />
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties VerifyCodeBehindFields="True" VerifyCodeBehindEvents="True">
|
||||
<Properties>
|
||||
<Policies>
|
||||
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
|
||||
</Policies>
|
||||
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
|
||||
<WebDeployTargets>
|
||||
<Target Name="">
|
||||
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/yavsc" ctype="LocalFileCopyConfiguration" />
|
||||
</Target>
|
||||
<Target Name="">
|
||||
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/lua" ctype="LocalFileCopyConfiguration" />
|
||||
</Target>
|
||||
<Target Name="">
|
||||
<FileCopier Handler="MonoDevelop.Deployment.SshFuseFileCopyHandler" TargetDirectory="root@192.168.0.45:/srv/httpd/lua" ExtraMountArguments="" ctype="SshFuseFileCopyConfiguration" />
|
||||
</Target>
|
||||
</WebDeployTargets>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
|
|
@ -256,10 +251,6 @@
|
|||
<Project>{9D7D892E-9B77-4713-892D-C26E1E944119}</Project>
|
||||
<Name>ITContentProvider</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ITContent\ITContent.csproj">
|
||||
<Project>{88D83FC9-4158-4435-98A6-1F8F7F448B8F}</Project>
|
||||
<Name>ITContent</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
|
||||
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
|
||||
<Name>YavscModel</Name>
|
||||
|
|
|
|||
4
web/js/jquery-latest.js
vendored
Normal file
4
web/js/jquery-latest.js
vendored
Normal file
File diff suppressed because one or more lines are too long
120
web/js/jquery.metadata.js
Normal file
120
web/js/jquery.metadata.js
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* Metadata - jQuery plugin for parsing metadata from elements
|
||||
*
|
||||
* Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer, Paul McLanahan
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
||||
* in the JSON will become a property of the element itself.
|
||||
*
|
||||
* There are three supported types of metadata storage:
|
||||
*
|
||||
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
||||
*
|
||||
* class: Inside the class attribute, wrapped in curly braces: { }
|
||||
*
|
||||
* elem: Inside a child element (e.g. a script tag). The
|
||||
* name parameter indicates *which* element.
|
||||
*
|
||||
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
||||
*
|
||||
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
||||
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
||||
*
|
||||
* @name $.metadata.setType
|
||||
*
|
||||
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("class")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from the class attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("attr", "data")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a "data" attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
||||
* @before $.metadata.setType("elem", "script")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a nested script element
|
||||
*
|
||||
* @param String type The encoding type
|
||||
* @param String name The name of the attribute to be used to get metadata (optional)
|
||||
* @cat Plugins/Metadata
|
||||
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
||||
* @type undefined
|
||||
* @see metadata()
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend({
|
||||
metadata : {
|
||||
defaults : {
|
||||
type: 'class',
|
||||
name: 'metadata',
|
||||
cre: /({.*})/,
|
||||
single: 'metadata'
|
||||
},
|
||||
setType: function( type, name ){
|
||||
this.defaults.type = type;
|
||||
this.defaults.name = name;
|
||||
},
|
||||
get: function( elem, opts ){
|
||||
var settings = $.extend({},this.defaults,opts);
|
||||
// check for empty string in single property
|
||||
if ( !settings.single.length ) settings.single = 'metadata';
|
||||
|
||||
var data = $.data(elem, settings.single);
|
||||
// returned cached data if it already exists
|
||||
if ( data ) return data;
|
||||
|
||||
data = "{}";
|
||||
|
||||
if ( settings.type == "class" ) {
|
||||
var m = settings.cre.exec( elem.className );
|
||||
if ( m )
|
||||
data = m[1];
|
||||
} else if ( settings.type == "elem" ) {
|
||||
if( !elem.getElementsByTagName )
|
||||
return undefined;
|
||||
var e = elem.getElementsByTagName(settings.name);
|
||||
if ( e.length )
|
||||
data = $.trim(e[0].innerHTML);
|
||||
} else if ( elem.getAttribute != undefined ) {
|
||||
var attr = elem.getAttribute( settings.name );
|
||||
if ( attr )
|
||||
data = attr;
|
||||
}
|
||||
|
||||
if ( data.indexOf( '{' ) <0 )
|
||||
data = "{" + data + "}";
|
||||
|
||||
data = eval("(" + data + ")");
|
||||
|
||||
$.data( elem, settings.single, data );
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the metadata object for the first member of the jQuery object.
|
||||
*
|
||||
* @name metadata
|
||||
* @descr Returns element's metadata object
|
||||
* @param Object opts An object contianing settings to override the defaults
|
||||
* @type jQuery
|
||||
* @cat Plugins/Metadata
|
||||
*/
|
||||
$.fn.metadata = function( opts ){
|
||||
return $.metadata.get( this[0], opts );
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1031
web/js/jquery.tablesorter.js
Normal file
1031
web/js/jquery.tablesorter.js
Normal file
File diff suppressed because it is too large
Load diff
4
web/js/jquery.tablesorter.min.js
vendored
Normal file
4
web/js/jquery.tablesorter.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue