diff --git a/ITContentProvider/ITContentProvider.csproj b/ITContentProvider/ITContentProvider.csproj index 10533cbf..7375fca4 100644 --- a/ITContentProvider/ITContentProvider.csproj +++ b/ITContentProvider/ITContentProvider.csproj @@ -41,13 +41,13 @@ - - {821FF72D-9F4B-4A2C-B95C-7B965291F119} - WorkFlowProvider - {68F5B80A-616E-4C3C-91A0-828AA40000BD} YavscModel + + {821FF72D-9F4B-4A2C-B95C-7B965291F119} + NpgsqlWorkflow + \ No newline at end of file diff --git a/WorkFlowProvider/NpgsqlContentProvider.cs b/WorkFlowProvider/NpgsqlContentProvider.cs index 333535ab..59e6fd66 100644 --- a/WorkFlowProvider/NpgsqlContentProvider.cs +++ b/WorkFlowProvider/NpgsqlContentProvider.cs @@ -12,36 +12,46 @@ namespace WorkFlowProvider { public class NpgsqlContentProvider: ProviderBase, IContentProvider { + public StatusChange[] GetWrittingStatuses (long wrid) + { + throw new NotImplementedException (); + } + public StatusChange[] GetEstimateStatuses (long estid) + { + throw new NotImplementedException (); + } + public void TagWritting (long wrid, string tag) + { + throw new NotImplementedException (); + } + public void DropTagWritting (long wrid, string tag) + { + throw new NotImplementedException (); + } + public void SetWrittingStatus (long wrtid, int status, string username) + { + throw new NotImplementedException (); + } + public void SetEstimateStatus (long estid, int status, string username) + { + throw new NotImplementedException (); + } + public void Dispose () + { + throw new NotImplementedException (); + } 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 (); - } - - public void Install () - { - throw new NotImplementedException (); - } - - public void Uninstall () - { - throw new NotImplementedException (); - } - public ConfigurationSection DefaultConfig (string appName, string cnxStr) { throw new NotImplementedException (); } - public bool Active { get { throw new NotImplementedException (); @@ -51,53 +61,6 @@ namespace WorkFlowProvider } } - public StatusChange[] GetWrittingStatuses (long wrid) - { - throw new NotImplementedException (); - } - - public StatusChange[] GetEstimateStatuses (long estid) - { - throw new NotImplementedException (); - } - - public void DropTagWritting (long wrid, string tag) - { - throw new NotImplementedException (); - } - - public void SetWrittingStatus (long wrtid, int status, string username) - { - throw new NotImplementedException (); - } - - public void SetEstimateStatus (long estid, int status, string username) - { - throw new NotImplementedException (); - } - - public void TagWritting (long wrid, string tag) - { - throw new NotImplementedException (); - } - - - - public string Order (IWFOrder c) - { - throw new NotImplementedException (); - } - - public IContent GetBlob (string orderId) - { - throw new NotImplementedException (); - } - - public int GetStatus (string orderId) - { - throw new NotImplementedException (); - } - public string[] Statuses { get { return new string[] { "Created", "Validated", "Success", "Error" }; @@ -108,6 +71,24 @@ namespace WorkFlowProvider return new bool[] { false, false, true, true }; } } + public Estimate[] GetEstimates (string client) + { + using (NpgsqlConnection cnx = CreateConnection ()) { + using (NpgsqlCommand cmd = cnx.CreateCommand ()) { + cmd.CommandText = + "select _id from estimate where client = @clid"; + cmd.Parameters.Add ("@clid", client); + cnx.Open (); + List ests = new List (); + using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) { + while (rdr.Read ()) { + ests.Add(GetEstimate(rdr.GetInt64(0))); + } + } + return ests.ToArray(); + } + } + } public void DropWritting (long wrid) { @@ -143,7 +124,7 @@ namespace WorkFlowProvider using (NpgsqlConnection cnx = CreateConnection ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = - "select title,username from estimate where _id = @estid"; + "select title,username,client,description from estimate where _id = @estid"; cmd.Parameters.Add ("@estid", estimid); cnx.Open (); @@ -155,8 +136,13 @@ namespace WorkFlowProvider est = new Estimate (); est.Title = rdr.GetString( rdr.GetOrdinal("title")); - est.Owner = rdr.GetString( + est.Responsible = rdr.GetString( rdr.GetOrdinal("username")); + est.Client = rdr.GetString ( + rdr.GetOrdinal ("client")); + int index = rdr.GetOrdinal ("description"); + if (!rdr.IsDBNull (index)) + est.Description = rdr.GetString (index); est.Id = estimid; using (NpgsqlCommand cmdw = new NpgsqlCommand ("select _id, productid, ucost, count, description from writtings where estimid = @estid", cnx)) { cmdw.Parameters.Add("@estid", estimid); @@ -166,8 +152,9 @@ namespace WorkFlowProvider lw = new List (); while (rdrw.Read ()) { Writting w = new Writting (); - w.Description = rdrw.GetString ( - rdrw.GetOrdinal ("description")); + int dei = rdrw.GetOrdinal ("description"); + if (!rdrw.IsDBNull (dei)) + w.Description = rdrw.GetString (dei); int opi = rdrw.GetOrdinal ("productid"); if (!rdrw.IsDBNull (opi)) w.ProductReference = rdrw.GetString(opi); @@ -217,14 +204,18 @@ namespace WorkFlowProvider } } - public void SetTitle (long estid, string newTitle) + public void UpdateEstimate (Estimate estim) { using (NpgsqlConnection cnx = CreateConnection ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = - "update estimate set title = @tit where _id = @estid"; - cmd.Parameters.Add ("@tit", newTitle); - cmd.Parameters.Add ("@estid", estid); + "update estimate set title = @tit, username = @un, " + + "description = @descr, client = @cli where _id = @estid"; + cmd.Parameters.Add ("@tit", estim.Title); + cmd.Parameters.Add ("@un", estim.Responsible); + cmd.Parameters.Add ("@descr", estim.Description); + cmd.Parameters.Add ("@cli", estim.Client); + cmd.Parameters.Add ("@estid", estim.Id); cnx.Open (); cmd.ExecuteNonQuery (); cnx.Close (); @@ -272,20 +263,27 @@ namespace WorkFlowProvider } - public long CreateEstimate (string client, string title) + public Estimate CreateEstimate (string responsible, string client, string title, string description) { using (NpgsqlConnection cnx = CreateConnection ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = - "insert into estimate (title,username,applicationname) " + - "values (@tit,@un,@app) returning _id"; + "insert into estimate (title,description,username,client,applicationname) " + + "values (@tit,@descr,@resp,@un,@app) returning _id"; cmd.Parameters.Add ("@tit", title); cmd.Parameters.Add ("@un", client); + cmd.Parameters.Add ("@resp", responsible); + cmd.Parameters.Add ("@descr", description); cmd.Parameters.Add("@app", ApplicationName); cnx.Open (); - long res = (long)cmd.ExecuteScalar (); + Estimate created = new Estimate (); + created.Id = (long)cmd.ExecuteScalar (); cnx.Close (); - return res; + created.Title = title; + created.Description = description; + created.Client = client; + created.Responsible = responsible; + return created; } } } @@ -319,12 +317,6 @@ namespace WorkFlowProvider { return new NpgsqlConnection (cnxstr); } - #region IDisposable implementation - public void Dispose () - { - - } - #endregion } } diff --git a/WorkFlowProvider/WorkFlowProvider.csproj b/WorkFlowProvider/NpgsqlWorkflow.csproj similarity index 100% rename from WorkFlowProvider/WorkFlowProvider.csproj rename to WorkFlowProvider/NpgsqlWorkflow.csproj diff --git a/Yavsc.sln b/Yavsc.sln index abe903ab..6b2a692a 100644 --- a/Yavsc.sln +++ b/Yavsc.sln @@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SalesCatalog", "SalesCatalo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YavscModel", "yavscModel\YavscModel.csproj", "{68F5B80A-616E-4C3C-91A0-828AA40000BD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlowProvider", "WorkFlowProvider\WorkFlowProvider.csproj", "{821FF72D-9F4B-4A2C-B95C-7B965291F119}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NpgsqlWorkflow", "WorkFlowProvider\NpgsqlWorkflow.csproj", "{821FF72D-9F4B-4A2C-B95C-7B965291F119}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YavscClient", "yavscclient\YavscClient.csproj", "{EEFCECE6-3B7F-4BBE-B7AF-69377AF3CF39}" EndProject diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index 13d44811..c54c62b3 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -43,13 +43,7 @@ namespace Yavsc.Controllers return new Profile (ProfileBase.Create (user)); } - [Authorize] - public ActionResult Profile(Profile model) - { - ViewData ["UserName"] = Membership.GetUser ().UserName; - model = GetProfile ((string)ViewData ["UserName"]); - return View (model); - } + // TODO [ValidateAntiForgeryToken] public ActionResult DoLogin (LoginModel model, string returnUrl) { @@ -200,14 +194,22 @@ namespace Yavsc.Controllers } + [Authorize] + [HttpGet] + public ActionResult Profile(Profile model) + { + ViewData ["UserName"] = Membership.GetUser ().UserName; + model = GetProfile ((string) ViewData ["UserName"]); + return View (model); + } [Authorize] [HttpPost] //public ActionResult UpdateProfile(HttpPostedFileBase Avatar, string Address, string CityAndState, string ZipCode, string Country, string WebSite) - public ActionResult UpdateProfile(Profile model, HttpPostedFileBase AvatarFile) + public ActionResult Profile(Profile model, HttpPostedFileBase AvatarFile) { string username = Membership.GetUser ().UserName; - + ViewData ["UserName"] = username; if (AvatarFile != null) { if (AvatarFile.ContentType == "image/png") { @@ -233,14 +235,36 @@ namespace Yavsc.Controllers "BlogVisible", model.BlogVisible); HttpContext.Profile.SetPropertyValue ( "CityAndState", model.CityAndState); + HttpContext.Profile.SetPropertyValue ( + "ZipCode", model.ZipCode); HttpContext.Profile.SetPropertyValue ( "Country", model.Country); HttpContext.Profile.SetPropertyValue ( "WebSite", model.WebSite); + HttpContext.Profile.SetPropertyValue ( + "Name", model.Name); + HttpContext.Profile.SetPropertyValue ( + "Phone", model.Phone); + HttpContext.Profile.SetPropertyValue ( + "Mobile", model.Mobile); + HttpContext.Profile.SetPropertyValue ( + "BankCode", model.BankCode); + HttpContext.Profile.SetPropertyValue ( + "WicketCode", model.WicketCode); + HttpContext.Profile.SetPropertyValue ( + "AccountNumber", model.AccountNumber); + HttpContext.Profile.SetPropertyValue ( + "BankedKey", model.BankedKey); + HttpContext.Profile.SetPropertyValue ( + "BIC", model.BIC); + HttpContext.Profile.SetPropertyValue ( + "IBAN", model.IBAN); + HttpContext.Profile.Save (); + ViewData ["Message"] = "Profile enregistré."; } // HttpContext.Profile.SetPropertyValue("Avatar",Avatar); - return RedirectToAction ("Profile"); + return View (model); } [Authorize] diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index 5cae3751..9f24ca62 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -225,7 +225,7 @@ namespace Yavsc.Controllers return UserPost (model.PostId); } } - return View (model); + return UserPost (model.PostId); } string defaultAvatar; diff --git a/web/Controllers/FrontOfficeApiController.cs b/web/Controllers/FrontOfficeApiController.cs index 1f9cf83b..da70397c 100644 --- a/web/Controllers/FrontOfficeApiController.cs +++ b/web/Controllers/FrontOfficeApiController.cs @@ -14,12 +14,20 @@ using System.Net; using WorkFlowProvider; using System.Web.Security; using Yavsc.Model.WorkFlow; +using System.Reflection; +using System.Collections.Generic; +using Yavsc.Model.RolesAndMembers; +using Yavsc.Controllers; +using Yavsc.Formatters; +using System.Text; +using System.Web.Profile; namespace Yavsc.ApiControllers { public class FrontOfficeController : ApiController { + [AcceptVerbs("GET")] public Catalog Catalog () { @@ -77,6 +85,52 @@ namespace Yavsc.ApiControllers return est; } + [AcceptVerbs("GET")] + public HttpResponseMessage GetTexEstim(long estimid) + { + return new HttpResponseMessage () { + Content = new ObjectContent (typeof(string), + getTexEstim (estimid), + new TexFormatter ()) + }; + } + + private string getTexEstim(long estimid) + { + Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim(); + Estimate e = WorkFlowManager.GetEstimate (estimid); + tmpe.Session = new Dictionary(); + tmpe.Session.Add ("estim", e); + Profile pr = AccountController.GetProfile (e.Responsible); + tmpe.Session.Add ("from", pr); + tmpe.Session.Add ("to", pr); + tmpe.Init (); + return tmpe.TransformText (); + } + /// + /// Gets the estimate in pdf format from tex generation. + /// + /// The estim pdf. + /// Estimid. + public HttpResponseMessage GetEstimPdf(long estimid) + { + Estimate estim = WorkFlowManager.GetEstimate (estimid); + + Profile prpro = new Profile(ProfileBase.Create(estim.Responsible)); + if (!prpro.IsBankable) + throw new Exception ("NotBankable:"+estim.Responsible); + + Profile prcli = new Profile(ProfileBase.Create(estim.Client)); + if (!prcli.IsBillable) + throw new Exception ("NotBillable:"+estim.Client); + + return new HttpResponseMessage () { + Content = new ObjectContent ( + typeof(Estimate), + estim, + new EstimToPdfFormatter ()) + }; + } } } diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index 2fa73ae1..c6fc4b1b 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -20,39 +20,54 @@ namespace Yavsc.Controllers /// public class FrontOfficeController : Controller { + [Authorize] + public ActionResult Estimates () + { + string username = Membership.GetUser ().UserName; + return View(WorkFlowManager.GetEstimates (username)); + } + [Authorize] public ActionResult Estimate(Estimate model,string submit) { - if (ModelState.IsValid) { - ViewData ["WebApiUrl"] = "http://"+ Request.Url.Authority + "/api/WorkFlow"; - string username = HttpContext.User.Identity.Name; + if (submit == null) { if (model.Id > 0) { Estimate f = WorkFlowManager.GetEstimate (model.Id); if (f == null) { ModelState.AddModelError ("Id", "Wrong Id"); return View (model); } - if (username != f.Owner) - if (!Roles.IsUserInRole ("FrontOffice")) - throw new UnauthorizedAccessException ("You're not allowed to view/modify this estimate"); - if (submit == "Update") { - if (model != f) { - WorkFlowManager.SetTitle (model.Id, model.Title); - } - } else if (submit == null) { - model = f; - } + model = f; + ModelState.Clear (); + string username = HttpContext.User.Identity.Name; + if (username != model.Responsible + && username != model.Client + && !Roles.IsUserInRole ("FrontOffice")) + throw new UnauthorizedAccessException ("You're not allowed to view this estimate"); + + } + } else if (ModelState.IsValid) { + + ViewData ["WebApiUrl"] = "http://" + Request.Url.Authority + "/api/WorkFlow"; + string username = HttpContext.User.Identity.Name; + if (username != model.Responsible + && username != model.Client + && !Roles.IsUserInRole ("FrontOffice")) + throw new UnauthorizedAccessException ("You're not allowed to modify this estimate"); + + if (model.Id == 0) + model = WorkFlowManager.CreateEstimate ( + username, + model.Client, model.Title, model.Description); + else + WorkFlowManager.UpdateEstimate (model); - } else if (model.Id == 0 && submit=="Create") { - // Create the estimate - model.Id=WorkFlowManager.CreateEstimate (username, - model.Title); - model.Owner = username; - } } return View(model); } + + [AcceptVerbs("GET")] public ActionResult Catalog () { diff --git a/web/Controllers/WorkFlowController.cs b/web/Controllers/WorkFlowController.cs index fe2a306a..fc2eb876 100644 --- a/web/Controllers/WorkFlowController.cs +++ b/web/Controllers/WorkFlowController.cs @@ -26,10 +26,10 @@ namespace Yavsc.ApiControllers [HttpGet] [Authorize] - public long CreateEstimate (string title) + public Estimate CreateEstimate (string title,string client,string description) { return WorkFlowManager.CreateEstimate ( - Membership.GetUser().UserName,title); + Membership.GetUser().UserName,client,title,description); } [HttpGet] diff --git a/web/Formatters/EstimToPdfFormatter.cs b/web/Formatters/EstimToPdfFormatter.cs new file mode 100644 index 00000000..a752cf64 --- /dev/null +++ b/web/Formatters/EstimToPdfFormatter.cs @@ -0,0 +1,112 @@ +// +// EstimToPdfFormatter.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2014 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Http.Headers; +using System.Net.Http.Formatting; +using Yavsc.Model.WorkFlow; +using Yavsc.Model.RolesAndMembers; +using System.Web.Profile; +using System.Web; +using System.Diagnostics; + +namespace Yavsc.Formatters +{ + public class EstimToPdfFormatter: BufferedMediaTypeFormatter + { + public EstimToPdfFormatter () + { + SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/pdf")); + } + + public override bool CanReadType(Type type) + { + return false; + } + + public override bool CanWriteType(System.Type type) + { + if (type == typeof(Estimate)) + { + return true; + } + else + { + Type enumerableType = typeof(IEnumerable); + return enumerableType.IsAssignableFrom(type); + } + } + + public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders) + { + // TODO create a type containing generation parameters, including a template path, and generate from them + + Yavsc.templates.Estim tmpe = new Yavsc.templates.Estim(); + tmpe.Session = new Dictionary(); + Estimate e = value as Estimate; + tmpe.Session.Add ("estim", e); + + Profile prpro = new Profile (ProfileBase.Create (e.Responsible)); + + var pbc = ProfileBase.Create (e.Client); + Profile prcli = new Profile (pbc); + if (!prpro.IsBankable) + throw new Exception ("This provider is not bankable."); + tmpe.Session.Add ("from", prpro); + tmpe.Session.Add ("to", prcli); + tmpe.Init (); + + string content = tmpe.TransformText (); + + string name = string.Format ("tmpestimtex{0}", e.Id); + string fullname = Path.Combine ( + HttpRuntime.CodegenDir, name); + FileInfo fi = new FileInfo(fullname + ".tex"); + FileInfo fo = new FileInfo(fullname + ".pdf"); + using (StreamWriter sw = new StreamWriter (fi.FullName)) + { + sw.Write (content); + } + using (Process p = new Process ()) { + p.StartInfo.WorkingDirectory = HttpRuntime.CodegenDir; + p.StartInfo = new ProcessStartInfo (); + p.StartInfo.UseShellExecute = false; + p.StartInfo.FileName = "/usr/bin/texi2pdf"; + p.StartInfo.Arguments = + string.Format ("--batch -o {0} {1}", + fo.FullName, + fi.FullName); + p.Start (); + p.WaitForExit (); + } + + using (StreamReader sr = new StreamReader (fo.FullName)) { + byte[] buffer = File.ReadAllBytes (fo.FullName); + stream.Write(buffer,0,buffer.Length); + } + fi.Delete(); + fo.Delete(); + } + + } +} + diff --git a/web/Formatters/TexFormatter.cs b/web/Formatters/TexFormatter.cs new file mode 100644 index 00000000..671e3b80 --- /dev/null +++ b/web/Formatters/TexFormatter.cs @@ -0,0 +1,68 @@ +// +// TexFormatter.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2014 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +using System; +using System.Net.Http.Formatting; +using System.Net.Http.Headers; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; + +namespace Yavsc.Formatters +{ + public class TexFormatter : BufferedMediaTypeFormatter + { + public TexFormatter () + { + SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/x-tex")); + + } + + public override bool CanWriteType(System.Type type) + { + if (type == typeof(string)) + { + return true; + } + else + { + Type enumerableType = typeof(IEnumerable); + return enumerableType.IsAssignableFrom(type); + } + } + + public override bool CanReadType(Type type) + { + return false; + } + + public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders) + { + // TODO create a type containing T4 parameters, and generate from them + using (var writer = new StreamWriter(stream)) + { + string doc = value as string; + writer.Write (doc); + } + } + + } +} + diff --git a/web/Global.asax.cs b/web/Global.asax.cs index f3f0e9eb..5f29a41f 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -7,6 +7,7 @@ using System.Web; using System.Web.Mvc; using System.Web.Routing; using System.Web.Http; +using Yavsc.Formatters; namespace Yavsc { @@ -43,7 +44,7 @@ namespace Yavsc protected void Application_Start () { AreaRegistration.RegisterAllAreas (); - + GlobalConfiguration.Configuration.Formatters.Add (new TexFormatter ()); GlobalConfiguration.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{*id}", diff --git a/web/Theme/dark/style.css b/web/Theme/dark/style.css index 5fd7a115..7d51291e 100644 --- a/web/Theme/dark/style.css +++ b/web/Theme/dark/style.css @@ -39,3 +39,6 @@ table.tablesorter thead tr .headerSortDown { table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { background-color: #123; } +tr.selected td { + background-color:#102010; +} \ No newline at end of file diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/Profile.aspx index 320fa5dd..aed367c1 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/Profile.aspx @@ -5,14 +5,25 @@ - <%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%> - + <%= Html.ValidationSummary() %> -<% using(Html.BeginForm("UpdateProfile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %> +<% using(Html.BeginForm("Profile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %> <% { %> - +

Informations générales

+ + + @@ -21,6 +32,10 @@ <%= Html.TextBox("CityAndState") %> <%= Html.ValidationMessage("CityAndState", "*") %> + @@ -42,6 +57,74 @@ Avatar
+<%= Html.LabelFor(model => model.Name) %> +<%= Html.TextBox("Name") %> +<%= Html.ValidationMessage("Name", "*") %>
+<%= Html.LabelFor(model => model.Phone) %> +<%= Html.TextBox("Phone") %> +<%= Html.ValidationMessage("Phone", "*") %>
+<%= Html.LabelFor(model => model.Mobile) %> +<%= Html.TextBox("Mobile") %> +<%= Html.ValidationMessage("Mobile", "*") %>
<%= Html.LabelFor(model => model.Address) %> <%= Html.TextBox("Address") %> <%= Html.ValidationMessage("Address", "*") %>
+<%= Html.LabelFor(model => model.ZipCode) %> +<%= Html.TextBox("ZipCode") %> +<%= Html.ValidationMessage("ZipCode", "*") %>
<%= Html.LabelFor(model => model.Country) %> <%= Html.TextBox("Country") %> <%= Html.ValidationMessage("Country", "*") %>
+ +

Informations de facturation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+<%= Html.LabelFor(model => model.BankCode) %> + +<%= Html.TextBox("BankCode") %> +<%= Html.ValidationMessage("BankCode", "*") %> +
+<%= Html.LabelFor(model => model.WicketCode) %> +<%= Html.TextBox("WicketCode") %> +<%= Html.ValidationMessage("WicketCode", "*") %> +
+<%= Html.LabelFor(model => model.AccountNumber) %> +<%= Html.TextBox("AccountNumber") %> +<%= Html.ValidationMessage("AccountNumber", "*") %> +
+<%= Html.LabelFor(model => model.BankedKey) %> +<%= Html.TextBox("BankedKey") %> +<%= Html.ValidationMessage("BankedKey", "*") %> +
+<%= Html.LabelFor(model => model.BIC) %> +<%= Html.TextBox("BIC") %> +<%= Html.ValidationMessage("BIC", "*") %> +
+<%= Html.LabelFor(model => model.IBAN) %> +<%= Html.TextBox("IBAN") %> +<%= Html.ValidationMessage("IBAN", "*") %> +
+ + <% } %>
+ + + + <%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%> + + diff --git a/web/Views/FrontOffice/Estimate.aspx b/web/Views/FrontOffice/Estimate.aspx index c7ae75bd..9e784fd3 100644 --- a/web/Views/FrontOffice/Estimate.aspx +++ b/web/Views/FrontOffice/Estimate.aspx @@ -13,12 +13,16 @@ <% using (Html.BeginForm("Estimate","FrontOffice")) { %> <%= Html.LabelFor(model => model.Title) %>:<%= Html.TextBox( "Title" ) %> <%= Html.ValidationMessage("Title", "*") %> -<% if (Model.Id > 0) { %>
-<%= Html.LabelFor(model => model.Owner) %>:<%=Model.Owner%> -<%= Html.ValidationMessage("Owner", "*") %> +<%= Html.LabelFor(model => model.Responsible) %>:<%=Model.Responsible%> +<%= Html.Hidden ("Responsible") %> +<%= Html.ValidationMessage("Responsible", "*") %>
-<%= Html.LabelFor(model => model.Ciffer) %>:<%=Model.Ciffer%> +<%= Html.LabelFor(model => model.Client) %>:<%=Html.TextBox( "Client" ) %> +<%= Html.ValidationMessage("Client", "*") %> +
+<%= Html.LabelFor(model => model.Description) %>:<%=Html.TextArea( "Description") %> +<%= Html.ValidationMessage("Description", "*") %>
<%= Html.LabelFor(model => model.Id) %>:<%=Model.Id%> <%= Html.Hidden( "Id" ) %> @@ -31,7 +35,7 @@ <% } %> - + <% if (Model.Id>0) { %> @@ -76,12 +80,14 @@ -