* 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
vnext
Paul Schneider 10 years ago
parent 886bb31882
commit f157c6edb9
25 changed files with 1569 additions and 167 deletions

@ -1,12 +0,0 @@
using System;
using WorkFlowProvider;
using Yavsc.Model.WorkFlow;
namespace ITContent
{
public interface IITContent: IContentProvider
{
}
}

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88D83FC9-4158-4435-98A6-1F8F7F448B8F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ITContent</RootNamespace>
<AssemblyName>ITContent</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="IITContent.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\WorkFlowProvider\WorkFlowProvider.csproj">
<Project>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</Project>
<Name>WorkFlowProvider</Name>
</ProjectReference>
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
<Name>YavscModel</Name>
</ProjectReference>
</ItemGroup>
</Project>

@ -1,22 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("ITContent")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Paul Schneider")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

@ -55,6 +55,15 @@ namespace SalesCatalog.Model
public DateTime EndDate { get; set; }
public Product FindProduct (string reference)
{
Product p = null;
foreach (Brand b in Brands)
foreach (ProductCategory c in b.Categories)
if ((p = c.GetProduct(reference))!=null)
return p;
return null;
}
}
}

@ -12,6 +12,16 @@ namespace WorkFlowProvider
{
public class NpgsqlContentProvider: ProviderBase, IContentProvider
{
public void Install (System.Data.IDbConnection cnx)
{
throw new NotImplementedException ();
}
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
{
throw new NotImplementedException ();
}
public Estimate[] GetEstimates (string client)
{
throw new NotImplementedException ();
@ -93,7 +103,7 @@ namespace WorkFlowProvider
throw new NotImplementedException ();
}
public string[] StatusLabels {
public string[] Statuses {
get {
return new string[] { "Created", "Validated", "Success", "Error" };
}
@ -153,17 +163,19 @@ namespace WorkFlowProvider
est.Owner = rdr.GetString(
rdr.GetOrdinal("username"));
est.Id = estimid;
using (NpgsqlCommand cmdw = new NpgsqlCommand ("select _id, productid, ucost, count, description from writtings where _id = @estid", cnx)) {
using (NpgsqlCommand cmdw = new NpgsqlCommand ("select _id, productid, ucost, count, description from writtings where estimid = @estid", cnx)) {
cmdw.Parameters.Add("@estid", estimid);
using (NpgsqlDataReader rdrw = cmdw.ExecuteReader ()) {
List<Writting> lw = new List<Writting> ();
List<Writting> lw = null;
if (rdrw.HasRows) {
lw = new List<Writting> ();
while (rdrw.Read ()) {
Writting w = new Writting ();
w.Description = rdrw.GetString (
rdrw.GetOrdinal ("description"));
int opi = rdrw.GetOrdinal ("productid");
if (!rdrw.IsDBNull (opi))
w.ProductReference = rdrw.GetInt64(opi);
w.ProductReference = rdrw.GetString(opi);
int oco = rdrw.GetOrdinal ("count");
if (!rdrw.IsDBNull (oco))
w.Count = rdrw.GetInt32 (oco);
@ -176,6 +188,7 @@ namespace WorkFlowProvider
est.Lines = lw.ToArray ();
}
}
}
// TODO est.Ciffer = somme des ecritures
// TODO read into est.Lines
}
@ -200,17 +213,21 @@ namespace WorkFlowProvider
}
}
public long Write (long estid, string desc, decimal ucost, int count, long productid)
public long Write (long estid, string desc, decimal ucost, int count, string productid)
{
using (NpgsqlConnection cnx = CreateConnection ()) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"insert into writtings (description, estimid) VALUES (@dscr,@estid) returning _id";
"insert into writtings (description, estimid, ucost, count, productid) VALUES (@dscr,@estid,@ucost,@count,@prdid) returning _id";
cmd.Parameters.Add ("@dscr", desc);
// cmd.Parameters.Add ("@prdid", productid);
// cmd.Parameters.Add("@ucost", ucost);
// cmd.Parameters.Add("@mult", count);
cmd.Parameters.Add("@estid", estid);
cmd.Parameters.Add("@ucost", ucost);
cmd.Parameters.Add("@count", count);
cmd.Parameters.Add("@prdid", productid);
cnx.Open ();
long res = (long) cmd.ExecuteScalar ();

@ -19,8 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebControls", "WebControls\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vscadm", "vscadm\vscadm.csproj", "{6C5E1490-E141-4ADA-84E5-6D65523D6B73}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ITContent", "ITContent\ITContent.csproj", "{88D83FC9-4158-4435-98A6-1F8F7F448B8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ITContentProvider", "ITContentProvider\ITContentProvider.csproj", "{9D7D892E-9B77-4713-892D-C26E1E944119}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{ECEC9074-ACB5-4A74-BE22-FF7B40F25A1A}"
@ -53,10 +51,6 @@ Global
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Debug|Any CPU.Build.0 = Debug|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Release|Any CPU.ActiveCfg = Release|Any CPU
{821FF72D-9F4B-4A2C-B95C-7B965291F119}.Release|Any CPU.Build.0 = Release|Any CPU
{88D83FC9-4158-4435-98A6-1F8F7F448B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88D83FC9-4158-4435-98A6-1F8F7F448B8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88D83FC9-4158-4435-98A6-1F8F7F448B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88D83FC9-4158-4435-98A6-1F8F7F448B8F}.Release|Any CPU.Build.0 = Release|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90BF2234-7252-4CD5-B2A4-17501B19279B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -87,5 +81,9 @@ Global
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = web\Web.csproj
Policies = $0
$0.StandardHeader = $1
$1.Text = @\n ${FileName}\n \n Author:\n ${AuthorName} <${AuthorEmail}>\n \n Copyright (c) ${Year} ${CopyrightHolder}\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.
$1.IncludeInNewFiles = True
EndGlobalSection
EndGlobal

@ -1,5 +1,6 @@
using System;
using Yavsc.Model;
using System.Configuration;
namespace fortune
{
@ -8,6 +9,48 @@ namespace fortune
public MyClass ()
{
}
#region IModule implementation
public void Install (System.Data.IDbConnection cnx)
{
throw new NotImplementedException ();
}
public void Uninstall (System.Data.IDbConnection cnx, bool removeConfig)
{
throw new NotImplementedException ();
}
public ConfigurationSection DefaultConfig (string appName, string cnxStr)
{
throw new NotImplementedException ();
}
public void Initialize (string name, System.Collections.Specialized.NameValueCollection config)
{
throw new NotImplementedException ();
}
public bool Active {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
public string ApplicationName {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
#endregion
}
}

@ -30,6 +30,8 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyClass.cs" />

@ -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.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 { %>
<ul>
<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) { %>
<li><%=wr.Count%>/<%=wr.Id%>/<%=wr.ProductReference%>/<%=wr.UnitaryCost%>/<%=wr.Description%></li>
<tr>
<td><%=wr.Id%></td>
<td><%=wr.Description%></td>
<td><%=wr.ProductReference%></td>
<td><%=wr.Count%></td>
<td><%=wr.UnitaryCost%></td>
</tr>
<% } %>
</ul>
</tbody>
</table>
<% } %>
<% } %>
<% if (Model.Id==0) { %>
<input type="submit" name="submit" value="Create"/>
<% } else { %>
<input type="submit" name="submit" value="Update"/>
<% }
%>
<% } %>
<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>

@ -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>

File diff suppressed because one or more lines are too long

@ -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);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -1,15 +1,34 @@
using System;
using System.Configuration;
using System.Collections.Specialized;
using System.Data;
namespace Yavsc.Model
{
public interface IModule
{
void Install();
void Uninstall();
/// <summary>
/// Install the model in database using the specified cnx.
/// </summary>
/// <param name="cnx">Cnx.</param>
void Install(IDbConnection cnx);
/// <summary>
/// Uninstall the module data and data model from
/// database, using the specified cnx.
/// </summary>
/// <param name="cnx">Cnx.</param>
/// <param name="removeConfig">If set to <c>true</c> remove config.</param>
void Uninstall(IDbConnection cnx,bool removeConfig);
ConfigurationSection DefaultConfig (string appName, string cnxStr);
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.IModule"/> is active.
/// </summary>
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
bool Active { get; set; }
/// <summary>
/// Gets or sets the name of the application.
/// </summary>
/// <value>The name of the application.</value>
string ApplicationName { get; set; }
void Initialize (string name, NameValueCollection config);
}

@ -4,31 +4,119 @@ using System.Web.Mvc;
namespace Yavsc.Model.WorkFlow
{
/// <summary>
/// Interface content provider.
/// Class Assertion: <c>Statuses.Length &gt;= FinalStatuses.Length</c>.
/// </summary>
public interface IContentProvider : IModule, IDisposable
{
/// <summary>
/// Gets the status labels.
/// 0 is the starting status
/// Gets the different status labels.
/// 0 is the starting status. Each status is an integer and the 0-based index
/// of a string in this array.
/// </summary>
/// <value>The status labels.</value>
string [] StatusLabels {get;}
string [] Statuses { get; }
/// <summary>
/// Gets the final statuses.
/// </summary>
/// <value>The final statuses.</value>
bool [] FinalStatuses { get; }
/// <summary>
/// Gets the writting status changes.
/// </summary>
/// <returns>The writting statuses.</returns>
/// <param name="wrid">Wrid.</param>
StatusChange[] GetWrittingStatuses (long wrid);
/// <summary>
/// Gets the estimate status changes.
/// </summary>
/// <returns>The estimate statuses.</returns>
/// <param name="estid">Estid.</param>
StatusChange[] GetEstimateStatuses (long estid);
/// <summary>
/// Creates the estimate.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="client">Client.</param>
/// <param name="title">Title.</param>
long CreateEstimate (string client, string title);
Estimate [] GetEstimates(string client);
/// <summary>
/// Add a line to the specified estimate by id,
/// using the specified desc, ucost, count and productid.
/// </summary>
/// <param name="estid">Estimate identifier.</param>
/// <param name="desc">Textual description for this line.</param>
/// <param name="ucost">Unitary cost.</param>
/// <param name="count">Cost multiplier.</param>
/// <param name="productid">Product identifier.</param>
long Write (long estid, string desc, decimal ucost, int count, string productid);
/// <summary>
/// Gets the estimate by identifier.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="estimid">Estimid.</param>
Estimate GetEstimate (long estimid);
long Write (long estid, string desc, decimal ucost, int count, long productid);
/// <summary>
/// Gets the estimates created for a specified client.
/// </summary>
/// <returns>The estimates.</returns>
/// <param name="client">Client.</param>
Estimate [] GetEstimates(string client);
/// <summary>
/// Drops the writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
void DropWritting (long wrid);
/// <summary>
/// Drops the estimate.
/// </summary>
/// <param name="estid">Estid.</param>
void DropEstimate (long estid);
/// <summary>
/// Tags the writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
/// <param name="tag">Tag.</param>
void TagWritting (long wrid,string tag);
/// <summary>
/// Drops the tag writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
/// <param name="tag">Tag.</param>
void DropTagWritting (long wrid,string tag);
/// <summary>
/// Updates the writting.
/// </summary>
/// <param name="wr">Wr.</param>
void UpdateWritting (Writting wr);
/// <summary>
/// Sets the title for a specified estimate by id.
/// </summary>
/// <param name="estid">Estid.</param>
/// <param name="newTitle">New title.</param>
void SetTitle (long estid, string newTitle);
/// <summary>
/// Sets the descripton for a writting.
/// </summary>
/// <param name="writid">Writid.</param>
/// <param name="newDesc">New desc.</param>
void SetDesc (long writid, string newDesc);
/// <summary>
/// Sets the writting status.
/// </summary>
/// <param name="wrtid">Wrtid.</param>
/// <param name="status">Status.</param>
/// <param name="username">Username.</param>
void SetWrittingStatus (long wrtid,int status,string username);
/// <summary>
/// Sets the estimate status.
/// </summary>
/// <param name="estid">Estid.</param>
/// <param name="status">Status.</param>
/// <param name="username">Username.</param>
void SetEstimateStatus (long estid,int status,string username);
}
}

@ -0,0 +1,29 @@
using System;
using Yavsc.Model.WorkFlow;
using System.Configuration;
using Yavsc.Model.WorkFlow.Configuration;
using System.Collections.Specialized;
namespace Yavsc.Model.WorkFlow
{
public class NewEstimateEvenArgs: EventArgs
{
private string clientName;
private string estimateTitle;
private long eid;
public string ClientName{ get { return clientName; } }
public string EstimateTitle { get { return estimateTitle; } }
public long EstimateId { get { return eid; } }
public NewEstimateEvenArgs(long estid, string client, string title)
{
clientName = client;
estimateTitle = title;
eid = estid;
}
}
}

@ -3,6 +3,7 @@ using Yavsc.Model.WorkFlow;
using System.Configuration;
using Yavsc.Model.WorkFlow.Configuration;
using System.Collections.Specialized;
using SalesCatalog.Model;
namespace Yavsc.Model.WorkFlow
{
@ -13,6 +14,9 @@ namespace Yavsc.Model.WorkFlow
/// </summary>
public static class WorkFlowManager
{
public static Catalog Catalog { get; set; }
public static void SetTitle (long id, string title)
{
ContentProvider.SetTitle (id, title);
@ -93,13 +97,22 @@ namespace Yavsc.Model.WorkFlow
/// <param name="title">Title.</param>
public static long CreateEstimate(string client, string title)
{
return ContentProvider.CreateEstimate (client, title);
long estid = ContentProvider.CreateEstimate (client, title);
if (NewOrder != null)
NewOrder.Invoke(ContentProvider, new NewEstimateEvenArgs(estid,client,title));
return estid;
}
public static long Write(long estid, string desc, decimal ucost, int count, long productid)
public static long Write(long estid, string desc, decimal ucost, int count, string productid)
{
if (!string.IsNullOrWhiteSpace(productid)) {
if (Catalog == null)
Catalog = SalesCatalog.CatalogManager.GetCatalog ();
if (Catalog == null)
throw new Exception ("No catalog");
Product p = Catalog.FindProduct (productid);
// TODO new EstimateChange Event
}
return ContentProvider.Write(estid, desc, ucost, count, productid);
}

@ -7,7 +7,7 @@ namespace Yavsc.Model.WorkFlow
public long Id { get; set; }
public decimal UnitaryCost { get; set; }
public int Count { get; set; }
public long ProductReference { get; set; }
public string ProductReference { get; set; }
public string Description { get; set; }
}
}

@ -31,10 +31,10 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="nunit.framework" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@ -77,6 +77,7 @@
<Compile Include="Blogs\Configuration\BlogProviderConfigurationElement.cs" />
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationCollection.cs" />
<Compile Include="Blogs\Configuration\BlogProvidersConfigurationSection.cs" />
<Compile Include="WorkFlow\NewEstimateEvenArgs.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>

Loading…