* style.css:

* UserPost.aspx:
* Estimate.cs:
* Writting.cs:
* WorkFlowController.cs:
* NpgsqlContentProvider.cs: 
* FrontOfficeApiController.cs: Fixed the GetEstimate function,
  refactoring
vnext
Paul Schneider 10 years ago
parent f6616286a6
commit 8fee293665
7 changed files with 48 additions and 35 deletions

@ -6,6 +6,7 @@ using System.Collections.Specialized;
using yavscModel.WorkFlow;
using System.Web.Mvc;
using System.Configuration.Provider;
using System.Collections.Generic;
namespace WorkFlowProvider
{
@ -65,6 +66,31 @@ namespace WorkFlowProvider
rdr.GetOrdinal("title"));
est.Owner = rdr.GetString(
rdr.GetOrdinal("username"));
using (NpgsqlCommand cmdw = new NpgsqlCommand ("select _id, productid, ucost, count, description from writtings where _id = @estid", cnx)) {
cmdw.Parameters.Add("@estid", estimid);
using (NpgsqlDataReader rdrw = cmdw.ExecuteReader ()) {
List<Writting> 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);
int oco = rdrw.GetOrdinal ("count");
if (!rdrw.IsDBNull(oco))
w.Count = rdrw.GetInt32 (oco);
int ouc = rdrw.GetOrdinal ("ucost");
if (!rdrw.IsDBNull(ouc))
w.UnitaryCost = rdrw.GetDecimal (ouc);
// TODO get w.id
lw.Add (w);
}
est.Lines = lw.ToArray ();
}
}
// TODO est.Ciffer = somme des ecritures
// TODO read into est.Lines
}
cnx.Close ();
return est;

@ -22,7 +22,8 @@ namespace Yavsc.ApiControllers
[AcceptVerbs("GET")]
public Catalog Catalog ()
{
return CatalogManager.GetCatalog ();
Catalog c = CatalogManager.GetCatalog ();
return c;
}
[AcceptVerbs("GET")]
@ -65,29 +66,7 @@ namespace Yavsc.ApiControllers
return result;
}
[HttpPost]
public string ProfileImagePost(HttpPostedFile profileImage)
{
string[] extensions = { ".jpg", ".jpeg", ".gif", ".bmp", ".png" };
if (!extensions.Any(x => x.Equals(Path.GetExtension(profileImage.FileName.ToLower()), StringComparison.OrdinalIgnoreCase)))
{
throw new HttpResponseException(
new HttpResponseMessage(HttpStatusCode.BadRequest));
}
// string root = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/uploads");
// Other code goes here
// profileImage.SaveAs ();
return "/path/to/image.png";
}
[HttpGet]
[Authorize]
public long CreateEstimate (string title)
{
return WFManager.CreateEstimate (
Membership.GetUser().UserName,title);
}
[HttpGet]
[Authorize]
public long AddToBasket (string title)

@ -7,12 +7,21 @@ using System.Web.Http;
using WorkFlowProvider;
using yavscModel.WorkFlow;
using System.Web.Http.Controllers;
using System.Web.Security;
namespace Yavsc.ApiControllers
{
[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
public class WorkFlowController : ApiController
{
[HttpGet]
[Authorize]
public long CreateEstimate (string title)
{
return WFManager.CreateEstimate (
Membership.GetUser().UserName,title);
}
[HttpGet]
[Authorize]
public object Index()
@ -44,7 +53,8 @@ namespace Yavsc.ApiControllers
/// <param name="estid">Estid.</param>
public Estimate GetEstimate (long estid)
{
return WFManager.ContentProvider.GetEstimate (estid);
Estimate est = WFManager.ContentProvider.GetEstimate (estid);
return est;
}
/*
public object Details(int id)

@ -27,7 +27,7 @@
<% foreach (var c in (Comment[])ViewData["Comments"]) { %>
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;" src="/Blogs/Avatar/<%=c.From%>" alt="<%=c.From%>"/>
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="/Blogs/Avatar/<%=c.From%>" alt="<%=c.From%>"/>
<%= BBCodeHelper.Parser.ToHtml(c.CommentText) %>
<% if ( username == Model.UserName || c.From == username ) { %>
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } )%>

@ -13,18 +13,16 @@ body {
video,img {
max-width:100%;
max-height:75%;
padding:.2em;
margin:0;
position:relative;
top:.7em;
}
#login {
position: fixed;
top: 3px;
right:3px;
font-size:x-small;
background-color:rgba(0,0,0,0.8);
color:rgb(0,254,0);
background-color:rgba(0,0,0,0.6);
color:rgb(130,254,130);
}
#login a {
@ -89,8 +87,6 @@ padding-left: 20px;
.validation-summary-errors{
color: #f88;
}
.pied {
}
.actionlink {
color: #B0B080;
@ -138,7 +134,7 @@ padding-left: 20px;
@media print {
body {background-color:white;color:black;}
.postcomment,#login,.actionlink,.metablog,.thanks{ display:none;}
header,footer,.postcomment,.actionlink,.metablog{ display:none;}
}
@media all and (max-width: 15em) {

@ -13,6 +13,8 @@ namespace yavscModel.WorkFlow
public decimal Ciffer {
get {
decimal total = 0;
if (Lines == null)
return total;
foreach (Writting l in Lines)
total += l.UnitaryCost * l.Count;
return total;

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

Loading…