diff --git a/WebControls/InputUserName.cs b/WebControls/InputUserName.cs index 83cd6c0a..5d121655 100644 --- a/WebControls/InputUserName.cs +++ b/WebControls/InputUserName.cs @@ -49,6 +49,7 @@ namespace Yavsc.WebControls public InputUserName () { Multiple = false; + EmptyValue = null; } /// /// Gets or sets the name. @@ -80,6 +81,20 @@ namespace Yavsc.WebControls ViewState ["Value"] = value; } } + + [Bindable (true)] + [DefaultValue("")] + [Localizable(false)] + public string OnChange { + get { + return (string) ViewState["OnChange"]; + } + set { + ViewState ["OnChange"] = value; + } + } + + /// /// Gets or sets the in role. /// @@ -113,6 +128,21 @@ namespace Yavsc.WebControls } } + + [Bindable (true)] + [DefaultValue(null)] + public string EmptyValue { + get { + return (string) ViewState["EmptyValue"]; + } + set { + ViewState ["EmptyValue"] = value; + + } + } + + + /// /// Renders the contents. /// @@ -122,6 +152,8 @@ namespace Yavsc.WebControls writer.AddAttribute ("id", ID); writer.AddAttribute ("name", Name); writer.AddAttribute ("class", CssClass); + if (!string.IsNullOrWhiteSpace(OnChange)) + writer.AddAttribute ("onchange", OnChange); if (Multiple) writer.AddAttribute ("multiple","true"); writer.RenderBeginTag ("select"); @@ -133,6 +165,12 @@ namespace Yavsc.WebControls if (!string.IsNullOrWhiteSpace (InRole)) { roles = InRole.Split (','); } + if (EmptyValue!=null) { + writer.AddAttribute ("value", ""); + writer.RenderBeginTag ("option"); + writer.Write (EmptyValue); + writer.RenderEndTag (); + } foreach (MembershipUser u in Membership.GetAllUsers()) { // if roles are specified, members must be in one of them if (roles != null) diff --git a/WorkFlowProvider/NpgsqlContentProvider.cs b/WorkFlowProvider/NpgsqlContentProvider.cs index c091ef3e..f580caca 100644 --- a/WorkFlowProvider/NpgsqlContentProvider.cs +++ b/WorkFlowProvider/NpgsqlContentProvider.cs @@ -231,19 +231,65 @@ namespace Yavsc return new bool[] { false, false, true, true }; } } + /// + /// Gets the estimates created by + /// or for the given user by user name. + /// + /// The estimates. + /// user name. + public Estimate[] GetEstimates (string username) + { + if (username == null) + throw new InvalidOperationException ( + "username cannot be" + + " null at searching for estimates"); + using (NpgsqlConnection cnx = CreateConnection ()) { + using (NpgsqlCommand cmd = cnx.CreateCommand ()) { + cmd.CommandText = + "select _id from estimate where client = @uname or username = @uname"; + + cmd.Parameters.Add ("@uname", username); + cnx.Open (); + List ests = new List (); + using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) { + while (rdr.Read ()) { + ests.Add(GetEstimate(rdr.GetInt64(0))); + } + } + return ests.ToArray(); + } + } + } /// - /// Gets the estimates created for a specified client. + /// Gets the estimates. /// /// The estimates. /// Client. - public Estimate[] GetEstimates (string client) + /// Responsible. + public Estimate[] GetEstimates (string client, string responsible) { + if (client == null && responsible == null) + throw new InvalidOperationException ( + "client and responsible cannot be" + + " both null at searching for estimates"); + using (NpgsqlConnection cnx = CreateConnection ()) { using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = - "select _id from estimate where client = @clid"; - cmd.Parameters.Add ("@clid", client); + "select _id from estimate where "; + + if (client != null) { + cmd.CommandText += "client = @clid"; + if (responsible != null) + cmd.CommandText += " and "; + cmd.Parameters.Add ("@clid", client); + } + if (responsible != null) { + cmd.CommandText += "username = @resp"; + cmd.Parameters.Add ("@resp", responsible); + } + cnx.Open (); List ests = new List (); using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) { diff --git a/web/ApiControllers/FrontOfficeApiController.cs b/web/ApiControllers/FrontOfficeApiController.cs index cd5561cb..6535c12b 100644 --- a/web/ApiControllers/FrontOfficeApiController.cs +++ b/web/ApiControllers/FrontOfficeApiController.cs @@ -179,41 +179,58 @@ namespace Yavsc.ApiControllers }; } + private HttpResponseMessage DefaultResponse() + { + return ModelState.IsValid ? + Request.CreateResponse (System.Net.HttpStatusCode.OK) : + Request.CreateResponse (System.Net.HttpStatusCode.BadRequest, + ValidateAjaxAttribute.GetErrorModelObject (ModelState)); + } + /// /// Register the specified model. /// /// Model. - /// if false, sends a registration validation e-mail. - [Authorize(Roles="Admin")] + [Authorize()] [ValidateAjaxAttribute] - public void Register ([FromBody] RegisterModel model, bool isApprouved=true) + public HttpResponseMessage Register ([FromBody] RegisterModel model) { - MembershipCreateStatus mcs; - var user = Membership.CreateUser ( - model.UserName, - model.Password, - model.Email, - null, - null, - isApprouved, - out mcs); - switch (mcs) { - case MembershipCreateStatus.DuplicateEmail: - ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " + + if (ModelState.IsValid) { + if (model.IsApprouved) + if (!Roles.IsUserInRole ("Admin")) + if (!Roles.IsUserInRole ("FrontOffice")) { + ModelState.AddModelError ("IsApprouved", + "Since you're not member of Admin or FrontOffice groups, " + + "you cannot ask for a pre-approuved registration"); + return DefaultResponse (); + } + MembershipCreateStatus mcs; + var user = Membership.CreateUser ( + model.UserName, + model.Password, + model.Email, + null, + null, + model.IsApprouved, + out mcs); + switch (mcs) { + case MembershipCreateStatus.DuplicateEmail: + ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " + "à un compte utilisateur existant"); - return ; - case MembershipCreateStatus.DuplicateUserName: - ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " + + break; + case MembershipCreateStatus.DuplicateUserName: + ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " + "déjà enregistré"); - return ; - case MembershipCreateStatus.Success: - if (!isApprouved) - Yavsc.Helpers.YavscHelpers.SendActivationEmail (user); - return ; - - default: - throw new Exception ( string.Format( "Unexpected membership creation status : {0}", mcs.ToString() ) ); + break; + case MembershipCreateStatus.Success: + if (!model.IsApprouved) + Yavsc.Helpers.YavscHelpers.SendActivationEmail (user); + break; + default: + break; + } } + return DefaultResponse (); } } } diff --git a/web/ApiControllers/WorkFlowController.cs b/web/ApiControllers/WorkFlowController.cs index 285849a3..ee96bfb2 100644 --- a/web/ApiControllers/WorkFlowController.cs +++ b/web/ApiControllers/WorkFlowController.cs @@ -62,29 +62,29 @@ namespace Yavsc.ApiControllers [HttpGet] [ValidateAjax] [Authorize(Roles="Admin,FrontOffice")] - public void Register([FromBody] RegisterModel model) + public void Register([FromBody] RegisterModel userModel) { if (ModelState.IsValid) { MembershipCreateStatus mcs; var user = Membership.CreateUser ( - model.UserName, - model.Password, - model.Email, + userModel.UserName, + userModel.Password, + userModel.Email, null, null, - model.IsApprouved, + userModel.IsApprouved, out mcs); switch (mcs) { case MembershipCreateStatus.DuplicateEmail: ModelState.AddModelError ("Email", - string.Format(LocalizedText.DuplicateEmail,model.UserName) ); + string.Format(LocalizedText.DuplicateEmail,userModel.UserName) ); return ; case MembershipCreateStatus.DuplicateUserName: ModelState.AddModelError ("UserName", - string.Format(LocalizedText.DuplicateUserName,model.Email)); + string.Format(LocalizedText.DuplicateUserName,userModel.Email)); return ; case MembershipCreateStatus.Success: - if (!model.IsApprouved) + if (!userModel.IsApprouved) YavscHelpers.SendActivationEmail (user); return; default: diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index c99be3ff..ee4f9095 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -199,17 +199,20 @@ namespace Yavsc.Controllers } /// - /// Profile the specified model. + /// Profile the specified user. /// - /// Model. + /// User name. [Authorize] [HttpGet] - public ActionResult Profile (Profile model) + public ActionResult Profile (string user) { - string username = Membership.GetUser ().UserName; - ViewData ["UserName"] = username; - model = new Profile (ProfileBase.Create (username)); - model.RememberMe = FormsAuthentication.GetAuthCookie (username, true) == null; + ViewData ["ProfileUserName"] = user; + string logdu = Membership.GetUser ().UserName; + ViewData ["UserName"] = logdu; + if (user == null) + user = logdu; + Profile model= new Profile (ProfileBase.Create (user)); + model.RememberMe = FormsAuthentication.GetAuthCookie (user, true) == null; return View (model); } @@ -221,10 +224,17 @@ namespace Yavsc.Controllers [Authorize] [HttpPost] // ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash" - public ActionResult Profile (Profile model, HttpPostedFileBase AvatarFile) + public ActionResult Profile (string username, Profile model, HttpPostedFileBase AvatarFile) { - string username = Membership.GetUser ().UserName; - ViewData ["UserName"] = username; + + string logdu = Membership.GetUser ().UserName; + ViewData ["UserName"] = logdu; + if (username != logdu) + if (!Roles.IsUserInRole ("Admin")) + if (!Roles.IsUserInRole ("FrontOffice")) + throw new UnauthorizedAccessException ("Your are not authorized to modify this profile"); + + ProfileBase prtoup = ProfileBase.Create (username); if (AvatarFile != null) { // if said valid, move as avatar file // else invalidate the model @@ -244,24 +254,24 @@ namespace Yavsc.Controllers */ if (ModelState.IsValid) { if (model.avatar != null) - HttpContext.Profile.SetPropertyValue ("avatar", model.avatar); - HttpContext.Profile.SetPropertyValue ("Address", model.Address); - HttpContext.Profile.SetPropertyValue ("BlogTitle", model.BlogTitle); - HttpContext.Profile.SetPropertyValue ("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 (); + prtoup.SetPropertyValue ("avatar", model.avatar); + prtoup.SetPropertyValue ("Address", model.Address); + prtoup.SetPropertyValue ("BlogTitle", model.BlogTitle); + prtoup.SetPropertyValue ("BlogVisible", model.BlogVisible); + prtoup.SetPropertyValue ("CityAndState", model.CityAndState); + prtoup.SetPropertyValue ("ZipCode", model.ZipCode); + prtoup.SetPropertyValue ("Country", model.Country); + prtoup.SetPropertyValue ("WebSite", model.WebSite); + prtoup.SetPropertyValue ("Name", model.Name); + prtoup.SetPropertyValue ("Phone", model.Phone); + prtoup.SetPropertyValue ("Mobile", model.Mobile); + prtoup.SetPropertyValue ("BankCode", model.BankCode); + prtoup.SetPropertyValue ("WicketCode", model.WicketCode); + prtoup.SetPropertyValue ("AccountNumber", model.AccountNumber); + prtoup.SetPropertyValue ("BankedKey", model.BankedKey); + prtoup.SetPropertyValue ("BIC", model.BIC); + prtoup.SetPropertyValue ("IBAN", model.IBAN); + prtoup.Save (); FormsAuthentication.SetAuthCookie (username, model.RememberMe); ViewData ["Message"] = "Profile enregistré, cookie modifié."; diff --git a/web/Controllers/AdminController.cs b/web/Controllers/AdminController.cs index 0a327f78..0e667e71 100644 --- a/web/Controllers/AdminController.cs +++ b/web/Controllers/AdminController.cs @@ -159,12 +159,14 @@ namespace Yavsc.Controllers [Authorize(Roles="Admin")] public ActionResult RemoveUser (string username, string submitbutton) { + ViewData ["usertoremove"] = username; if (submitbutton == "Supprimer") { Membership.DeleteUser (username); ViewData["Message"]= string.Format("utilisateur \"{0}\" supprimé",username); + ViewData ["usertoremove"] = null; } - return RedirectToAction("UserList"); + return View (); } /// /// Removes the role. diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index bbd502bd..92bbd620 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -48,11 +48,20 @@ namespace Yavsc.Controllers /// Estimates this instance. /// [Authorize] - public ActionResult Estimates () + public ActionResult Estimates (string client) { string username = Membership.GetUser ().UserName; - - return View (wfmgr.GetEstimates (username)); + Estimate [] estims = wfmgr.GetUserEstimates (username); + ViewData ["UserName"] = username; + ViewData ["ResponsibleCount"] = + Array.FindAll ( + estims, + x => x.Responsible == username).Length; + ViewData ["ClientCount"] = + Array.FindAll ( + estims, + x => x.Client == username).Length; + return View (estims); } /// @@ -63,6 +72,7 @@ namespace Yavsc.Controllers [Authorize] public ActionResult Estimate (Estimate model, string submit) { + string username = Membership.GetUser().UserName; // Obsolete, set in master page ViewData ["WebApiBase"] = Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative); ViewData ["WABASEWF"] = ViewData ["WebApiBase"] + "/WorkFlow"; @@ -75,23 +85,23 @@ namespace Yavsc.Controllers } 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 (model.Id == 0) { + if (string.IsNullOrWhiteSpace(model.Responsible)) + model.Responsible = username; + } } else { - string username = Membership.GetUser().UserName; + + if (model.Id == 0) // if (submit == "Create") + if (string.IsNullOrWhiteSpace (model.Responsible)) + model.Responsible = username; if (username != model.Responsible && !Roles.IsUserInRole ("FrontOffice")) throw new UnauthorizedAccessException ("You're not allowed to modify this estimate"); - if (model.Id == 0) { - model.Responsible = username; - ModelState.Clear (); - // TODO better, or ensure that the model state is checked - // before insertion - } + if (ModelState.IsValid) { if (model.Id == 0) model = wfmgr.CreateEstimate ( diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index c5c0587a..9300a66a 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -86,9 +86,13 @@ namespace Yavsc.Controllers /// public ActionResult Index () { - string startPage = WebConfigurationManager.AppSettings ["StartPage"]; + /* + * A very bad idea (a redirect permanent as home page): + * + * string startPage = WebConfigurationManager.AppSettings ["StartPage"]; if (startPage != null) Redirect (startPage); + */ ViewData ["Message"] = LocalizedText.Welcome; return View (); } diff --git a/web/Global.asax.cs b/web/Global.asax.cs index eed3c48b..354ee3dd 100644 --- a/web/Global.asax.cs +++ b/web/Global.asax.cs @@ -48,6 +48,11 @@ namespace Yavsc "Blogs/{action}/{user}/{title}", new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional } ); + routes.MapRoute ( + "Account", + "Account/{action}/{user}", + new { controller = "Account", action = "Index", user=UrlParameter.Optional } + ); routes.MapRoute ( "Default", "{controller}/{action}/{user}/{title}", diff --git a/web/Models/App.master b/web/Models/App.master index 249a99b1..c65d3f50 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -1,15 +1,14 @@ <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> - - - <% ViewState["orgtitle"] = T.GetString(Page.Title); %> - <% Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName; %> - +<% +ViewState["orgtitle"] = T.GetString(Page.Title); + Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName; + %> - + @@ -23,35 +22,21 @@

<%=ViewState["orgtitle"]%> - "><%= YavscHelpers.SiteName %>

+ <% + if (ViewData["Error"]!=null) { + %>
<%= Html.Encode(ViewData["Error"]) %> +
<% } + if (ViewData["Message"]!=null) { + %>
<%= Html.Encode(ViewData["Message"]) %>
<% } + %> + +
+ - - -<% if (ViewData["Error"]!=null) { %> -
-<%= Html.Encode(ViewData["Error"]) %> -
-<% } %> -<% if (ViewData["Message"]!=null) { %> -
-<%= Html.Encode(ViewData["Message"]) %> -
-<% } %> - - - -
- - - - - -
- - -
- + - + +
/// true if this instance has bank account; otherwise, false. - public bool HasBankAccount { get { - return IsBillable - && !string.IsNullOrWhiteSpace (BankCode) - && !string.IsNullOrWhiteSpace (BIC) - && !string.IsNullOrWhiteSpace (IBAN) - && !string.IsNullOrWhiteSpace (WicketCode) - && !string.IsNullOrWhiteSpace (AccountNumber) - && BankedKey != 0; } } + public bool HasBankAccount { + get { + return !( + ( + string.IsNullOrWhiteSpace (BankCode) + || string.IsNullOrWhiteSpace (WicketCode) + || string.IsNullOrWhiteSpace (AccountNumber) + || BankedKey == 0 + ) + && + ( string.IsNullOrWhiteSpace (BIC) + || string.IsNullOrWhiteSpace (IBAN)) + ); } } /// /// Gets a value indicating whether this instance is billable. + /// Returns true when + /// Name is not null and all of + /// Address, CityAndState and ZipCode are not null, + /// or one of Email or Phone or Mobile is not null + /// /// /// true if this instance is billable; otherwise, false. public bool IsBillable { get { + // true if + // Name is not null and + // ( + // (Address and CityAndState and ZipCode) + // or Email or Phone or Mobile + // ) return !string.IsNullOrWhiteSpace (Name) - && !string.IsNullOrWhiteSpace (Address) - && !string.IsNullOrWhiteSpace (CityAndState) - && !string.IsNullOrWhiteSpace (ZipCode) - && !string.IsNullOrWhiteSpace (Email) - && !(string.IsNullOrWhiteSpace (Phone) && - string.IsNullOrWhiteSpace (Mobile)); + && !( ( + string.IsNullOrWhiteSpace (Address) + || string.IsNullOrWhiteSpace (CityAndState) + || string.IsNullOrWhiteSpace (ZipCode)) + && string.IsNullOrWhiteSpace (Email) + && string.IsNullOrWhiteSpace (Phone) + && string.IsNullOrWhiteSpace (Mobile)); } } diff --git a/yavscModel/RolesAndMemebers/RegisterClientModel.cs b/yavscModel/RolesAndMemebers/RegisterClientModel.cs new file mode 100644 index 00000000..3ce4fe1a --- /dev/null +++ b/yavscModel/RolesAndMemebers/RegisterClientModel.cs @@ -0,0 +1,71 @@ +// +// RegisterClientModel.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 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.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.Model.RolesAndMembers +{ + /// + /// Register client model. + /// + public class RegisterClientModel : RegisterModel + { + /// + /// Gets or sets the full name. + /// + /// The full name. + [DisplayName("Nom complet")] + [Required(ErrorMessage="S'il vous plait, saisissez le nom complet")] + public string Name { get; set; } + /// + /// Gets or sets the address. + /// + /// The address. + [DisplayName("Addresse")] + public string Address { get; set; } + /// + /// Gets or sets the state of the city and. + /// + /// The state of the city and. + [DisplayName("Ville")] + public string CityAndState { get; set; } + /// + /// Gets or sets the zip code. + /// + /// The zip code. + [DisplayName("Code postal")] + public string ZipCode { get; set; } + /// + /// Gets or sets the phone. + /// + /// The phone. + [DisplayName("Téléphone fixe")] + public string Phone { get; set; } + /// + /// Gets or sets the mobile. + /// + /// The mobile. + [DisplayName("Téléphone mobile")] + public string Mobile { get; set; } + } +} diff --git a/yavscModel/RolesAndMemebers/RegisterModel.cs b/yavscModel/RolesAndMemebers/RegisterModel.cs index 794e6ae0..2fdc4de2 100644 --- a/yavscModel/RolesAndMemebers/RegisterModel.cs +++ b/yavscModel/RolesAndMemebers/RegisterModel.cs @@ -55,8 +55,15 @@ namespace Yavsc.Model.RolesAndMembers [Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")] public string Email { get; set; } + /// + /// Gets or sets a value indicating whether this instance is approuved. + /// + /// true if this instance is approuved; otherwise, false. public bool IsApprouved { get; set; } + /// + /// Initializes a new instance of the class. + /// public RegisterModel() { IsApprouved = false; diff --git a/yavscModel/WorkFlow/IContentProvider.cs b/yavscModel/WorkFlow/IContentProvider.cs index 6152b819..68a15511 100644 --- a/yavscModel/WorkFlow/IContentProvider.cs +++ b/yavscModel/WorkFlow/IContentProvider.cs @@ -62,11 +62,19 @@ namespace Yavsc.Model.WorkFlow /// Estimid. Estimate GetEstimate (long estimid); /// - /// Gets the estimates created for a specified client. + /// Gets the estimates created by + /// or for the given user by user name. + /// + /// The estimates. + /// user name. + Estimate [] GetEstimates(string username); + /// + /// Gets the estimates. /// /// The estimates. /// Client. - Estimate [] GetEstimates(string client); + /// Responsible. + Estimate [] GetEstimates(string client, string responsible); /// /// Drops the writting. /// diff --git a/yavscModel/WorkFlow/WorkFlowManager.cs b/yavscModel/WorkFlow/WorkFlowManager.cs index 394bcdbc..22dfb021 100644 --- a/yavscModel/WorkFlow/WorkFlowManager.cs +++ b/yavscModel/WorkFlow/WorkFlowManager.cs @@ -48,15 +48,30 @@ namespace Yavsc.Model.WorkFlow return ContentProvider.GetEstimate (estid); } /// - /// Gets the estimates. + /// Gets the estimates, refering the + /// given client or username . /// /// The estimates. + /// Responsible. + public Estimate [] GetResponsibleEstimates (string responsible) + { + return ContentProvider.GetEstimates (null, responsible); + } + + /// + /// Gets the client estimates. + /// + /// The client estimates. /// Client. - public Estimate [] GetEstimates (string client) + public Estimate [] GetClientEstimates (string client) { - return ContentProvider.GetEstimates (client); + return ContentProvider.GetEstimates (client, null); } + public Estimate [] GetUserEstimates (string username) + { + return ContentProvider.GetEstimates (username); + } /// /// Gets the stock for a given product reference. /// diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 4f7a94fa..c6a3c58b 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -143,6 +143,7 @@ +