* 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
|
|
@ -4,31 +4,119 @@ using System.Web.Mvc;
|
|||
|
||||
namespace Yavsc.Model.WorkFlow
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Interface content provider.
|
||||
/// Class Assertion: <c>Statuses.Length >= 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
29
yavscModel/WorkFlow/NewEstimateEvenArgs.cs
Normal file
29
yavscModel/WorkFlow/NewEstimateEvenArgs.cs
Normal file
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue