* style.css:
* UserPost.aspx: * Estimate.cs: * Writting.cs: * WorkFlowController.cs: * NpgsqlContentProvider.cs: * FrontOfficeApiController.cs: Fixed the GetEstimate function, refactoring
This commit is contained in:
@ -6,6 +6,7 @@ using System.Collections.Specialized;
|
|||||||
using yavscModel.WorkFlow;
|
using yavscModel.WorkFlow;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Configuration.Provider;
|
using System.Configuration.Provider;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace WorkFlowProvider
|
namespace WorkFlowProvider
|
||||||
{
|
{
|
||||||
@ -64,7 +65,32 @@ namespace WorkFlowProvider
|
|||||||
est.Title = rdr.GetString(
|
est.Title = rdr.GetString(
|
||||||
rdr.GetOrdinal("title"));
|
rdr.GetOrdinal("title"));
|
||||||
est.Owner = rdr.GetString(
|
est.Owner = rdr.GetString(
|
||||||
rdr.GetOrdinal("username"));
|
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 ();
|
cnx.Close ();
|
||||||
return est;
|
return est;
|
||||||
|
@ -22,7 +22,8 @@ namespace Yavsc.ApiControllers
|
|||||||
[AcceptVerbs("GET")]
|
[AcceptVerbs("GET")]
|
||||||
public Catalog Catalog ()
|
public Catalog Catalog ()
|
||||||
{
|
{
|
||||||
return CatalogManager.GetCatalog ();
|
Catalog c = CatalogManager.GetCatalog ();
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AcceptVerbs("GET")]
|
[AcceptVerbs("GET")]
|
||||||
@ -65,29 +66,7 @@ namespace Yavsc.ApiControllers
|
|||||||
return result;
|
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]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public long AddToBasket (string title)
|
public long AddToBasket (string title)
|
||||||
|
@ -7,12 +7,21 @@ using System.Web.Http;
|
|||||||
using WorkFlowProvider;
|
using WorkFlowProvider;
|
||||||
using yavscModel.WorkFlow;
|
using yavscModel.WorkFlow;
|
||||||
using System.Web.Http.Controllers;
|
using System.Web.Http.Controllers;
|
||||||
|
using System.Web.Security;
|
||||||
|
|
||||||
namespace Yavsc.ApiControllers
|
namespace Yavsc.ApiControllers
|
||||||
{
|
{
|
||||||
[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
[HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))]
|
||||||
public class WorkFlowController : ApiController
|
public class WorkFlowController : ApiController
|
||||||
{
|
{
|
||||||
|
[HttpGet]
|
||||||
|
[Authorize]
|
||||||
|
public long CreateEstimate (string title)
|
||||||
|
{
|
||||||
|
return WFManager.CreateEstimate (
|
||||||
|
Membership.GetUser().UserName,title);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public object Index()
|
public object Index()
|
||||||
@ -44,7 +53,8 @@ namespace Yavsc.ApiControllers
|
|||||||
/// <param name="estid">Estid.</param>
|
/// <param name="estid">Estid.</param>
|
||||||
public Estimate GetEstimate (long estid)
|
public Estimate GetEstimate (long estid)
|
||||||
{
|
{
|
||||||
return WFManager.ContentProvider.GetEstimate (estid);
|
Estimate est = WFManager.ContentProvider.GetEstimate (estid);
|
||||||
|
return est;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
public object Details(int id)
|
public object Details(int id)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<% foreach (var c in (Comment[])ViewData["Comments"]) { %>
|
<% 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) %>
|
<%= BBCodeHelper.Parser.ToHtml(c.CommentText) %>
|
||||||
<% if ( username == Model.UserName || c.From == username ) { %>
|
<% if ( username == Model.UserName || c.From == username ) { %>
|
||||||
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } )%>
|
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } )%>
|
||||||
|
@ -13,18 +13,16 @@ body {
|
|||||||
video,img {
|
video,img {
|
||||||
max-width:100%;
|
max-width:100%;
|
||||||
max-height:75%;
|
max-height:75%;
|
||||||
padding:.2em;
|
|
||||||
margin:0;
|
|
||||||
position:relative;
|
position:relative;
|
||||||
top:.7em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#login {
|
#login {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
top: 3px;
|
||||||
right:3px;
|
right:3px;
|
||||||
font-size:x-small;
|
font-size:x-small;
|
||||||
background-color:rgba(0,0,0,0.8);
|
background-color:rgba(0,0,0,0.6);
|
||||||
color:rgb(0,254,0);
|
color:rgb(130,254,130);
|
||||||
}
|
}
|
||||||
|
|
||||||
#login a {
|
#login a {
|
||||||
@ -89,8 +87,6 @@ padding-left: 20px;
|
|||||||
.validation-summary-errors{
|
.validation-summary-errors{
|
||||||
color: #f88;
|
color: #f88;
|
||||||
}
|
}
|
||||||
.pied {
|
|
||||||
}
|
|
||||||
|
|
||||||
.actionlink {
|
.actionlink {
|
||||||
color: #B0B080;
|
color: #B0B080;
|
||||||
@ -138,7 +134,7 @@ padding-left: 20px;
|
|||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body {background-color:white;color:black;}
|
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) {
|
@media all and (max-width: 15em) {
|
||||||
|
@ -13,6 +13,8 @@ namespace yavscModel.WorkFlow
|
|||||||
public decimal Ciffer {
|
public decimal Ciffer {
|
||||||
get {
|
get {
|
||||||
decimal total = 0;
|
decimal total = 0;
|
||||||
|
if (Lines == null)
|
||||||
|
return total;
|
||||||
foreach (Writting l in Lines)
|
foreach (Writting l in Lines)
|
||||||
total += l.UnitaryCost * l.Count;
|
total += l.UnitaryCost * l.Count;
|
||||||
return total;
|
return total;
|
||||||
|
@ -6,7 +6,7 @@ namespace yavscModel.WorkFlow
|
|||||||
{
|
{
|
||||||
public decimal UnitaryCost { get; set; }
|
public decimal UnitaryCost { get; set; }
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public string ProductReference { get; set; }
|
public long ProductReference { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user