* New features:
- New Client at estimation, ala ajax - Admins can now edit user's profiles
This commit is contained in:
@ -49,6 +49,7 @@ namespace Yavsc.WebControls
|
||||
public InputUserName ()
|
||||
{
|
||||
Multiple = false;
|
||||
EmptyValue = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the in role.
|
||||
/// </summary>
|
||||
@ -113,6 +128,21 @@ namespace Yavsc.WebControls
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Bindable (true)]
|
||||
[DefaultValue(null)]
|
||||
public string EmptyValue {
|
||||
get {
|
||||
return (string) ViewState["EmptyValue"];
|
||||
}
|
||||
set {
|
||||
ViewState ["EmptyValue"] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Renders the contents.
|
||||
/// </summary>
|
||||
@ -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)
|
||||
|
@ -231,19 +231,65 @@ namespace Yavsc
|
||||
return new bool[] { false, false, true, true };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimates created for a specified client.
|
||||
/// Gets the estimates created by
|
||||
/// or for the given user by user name.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
public Estimate[] GetEstimates (string client)
|
||||
/// <param name="username">user name.</param>
|
||||
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 = @clid";
|
||||
cmd.Parameters.Add ("@clid", client);
|
||||
"select _id from estimate where client = @uname or username = @uname";
|
||||
|
||||
cmd.Parameters.Add ("@uname", username);
|
||||
cnx.Open ();
|
||||
List<Estimate> ests = new List<Estimate> ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
while (rdr.Read ()) {
|
||||
ests.Add(GetEstimate(rdr.GetInt64(0)));
|
||||
}
|
||||
}
|
||||
return ests.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the estimates.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
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 ";
|
||||
|
||||
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<Estimate> ests = new List<Estimate> ();
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register the specified model.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
/// <param name="isApprouved">if false, sends a registration validation e-mail.</param>
|
||||
[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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -199,17 +199,20 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Profile the specified model.
|
||||
/// Profile the specified user.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
/// <param name="user">User name.</param>
|
||||
[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é.";
|
||||
|
||||
|
@ -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 ();
|
||||
}
|
||||
/// <summary>
|
||||
/// Removes the role.
|
||||
|
@ -48,11 +48,20 @@ namespace Yavsc.Controllers
|
||||
/// Estimates this instance.
|
||||
/// </summary>
|
||||
[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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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 (
|
||||
|
@ -86,9 +86,13 @@ namespace Yavsc.Controllers
|
||||
/// </summary>
|
||||
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 ();
|
||||
}
|
||||
|
@ -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}",
|
||||
|
@ -1,15 +1,14 @@
|
||||
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<asp:ContentPlaceHolder id="init" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
<% ViewState["orgtitle"] = T.GetString(Page.Title); %>
|
||||
<% Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName; %>
|
||||
<head runat="server">
|
||||
</asp:ContentPlaceHolder><%
|
||||
ViewState["orgtitle"] = T.GetString(Page.Title);
|
||||
Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName;
|
||||
%><head runat="server">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<link rel="stylesheet" href="/Theme/style.css"/>
|
||||
<link rel="icon" type="image/png" href="/favicon.png?v=2" />
|
||||
<script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-2.1.3.js")%>"></script>
|
||||
@ -23,35 +22,21 @@
|
||||
<h1><a href="<%= Html.Encode(Request.Url.AbsoluteUri.ToString()) %>"> <%=ViewState["orgtitle"]%> </a> -
|
||||
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority%>"><%= YavscHelpers.SiteName %></a>
|
||||
</h1>
|
||||
</asp:ContentPlaceHolder><asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder><%
|
||||
if (ViewData["Error"]!=null) {
|
||||
%><div class="error"><%= Html.Encode(ViewData["Error"]) %>
|
||||
</div><% }
|
||||
if (ViewData["Message"]!=null) {
|
||||
%><div class="message"><%= Html.Encode(ViewData["Message"]) %></div><% }
|
||||
%>
|
||||
</header>
|
||||
<main>
|
||||
<asp:ContentPlaceHolder ID="MainContent" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
|
||||
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
|
||||
<% if (ViewData["Error"]!=null) { %>
|
||||
<div class="error">
|
||||
<%= Html.Encode(ViewData["Error"]) %>
|
||||
</div>
|
||||
<% } %>
|
||||
<% if (ViewData["Message"]!=null) { %>
|
||||
<div class="message">
|
||||
<%= Html.Encode(ViewData["Message"]) %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
|
||||
</header>
|
||||
<main>
|
||||
|
||||
<asp:ContentPlaceHolder ID="MainContent" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
<aside>
|
||||
</main>
|
||||
<asp:ContentPlaceHolder ID="MASContent" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
|
||||
<aside>
|
||||
<div id="login" >
|
||||
<% if (Membership.GetUser()==null) { %>
|
||||
<%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ,null, new { @class="actionlink" } ) %>
|
||||
@ -71,10 +56,8 @@
|
||||
<span class="hidcom"> Édition d'un nouveau billet </span>
|
||||
<%= Html.ActionLink( "Deconnexion", "Logout", "Account", new { returnUrl=Request.Url.PathAndQuery }, new { @class="actionlink" }) %>
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
<div style="float:right; height:5em; z-index:-1;"></div>
|
||||
<footer>
|
||||
<%= Html.ActionLink("Contact","Contact","Home",null, new { @class="footerlink" }) %> <br/>
|
||||
@ -95,5 +78,4 @@ $( ".bshd" ).on("click",function(e) {
|
||||
} });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
5
web/Scripts/form-new-user.js
Normal file
5
web/Scripts/form-new-user.js
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
( function($) {
|
||||
$.fn.formCreateUser = function() {
|
||||
}
|
||||
});
|
BIN
web/Theme/dark/croix.png
Normal file
BIN
web/Theme/dark/croix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 B |
@ -20,18 +20,19 @@ main {
|
||||
background-color: rgba(17,0,23,0.65);
|
||||
float:left;
|
||||
}
|
||||
footer:after {
|
||||
content: '';
|
||||
}
|
||||
fieldset {
|
||||
|
||||
|
||||
fieldset {
|
||||
background-color: rgba(32,16,16,0.8);
|
||||
border-radius:5px; border: solid 1px #000060;
|
||||
}
|
||||
border-radius:5px; border: solid 1px #000060;
|
||||
float:left;
|
||||
}
|
||||
|
||||
.panel,.bshpanel,aside {
|
||||
background-color: rgba(32,16,16,0.8);
|
||||
border-radius:5px; border: solid 1px #000060;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.bsh { float: right; }
|
||||
|
||||
@ -128,8 +129,10 @@ padding-left: 20px;
|
||||
color: #f88;
|
||||
}
|
||||
|
||||
.actionlink {
|
||||
|
||||
input.actionlink, a.actionlink {
|
||||
color: #B0B080;
|
||||
border: solid 1px rgb(128,128,128);
|
||||
border-radius:5px;
|
||||
background-color:rgba(0,0,32,0.8);
|
||||
font-size:large;
|
||||
@ -137,10 +140,10 @@ padding-left: 20px;
|
||||
font-family: 'Arial', cursive;
|
||||
}
|
||||
|
||||
.actionlink img { top:4px; }
|
||||
a.actionlink img { top:4px; }
|
||||
|
||||
.actionlink: hover {
|
||||
background-color:rgba(30,0,124,0.5);
|
||||
input.actionlink:hover, a.actionlink:hover {
|
||||
background-color:rgba(30,0,124,0.9);
|
||||
border : solid 1px white;
|
||||
text-decoration: underline;
|
||||
}
|
||||
@ -190,7 +193,7 @@ padding-left: 20px;
|
||||
background-color: rgba(0,0,40,.8);
|
||||
}
|
||||
|
||||
.actionlink:hover + .hidcom {
|
||||
a.actionlink:hover + .hidcom {
|
||||
display:block;
|
||||
}
|
||||
|
||||
|
@ -6,13 +6,14 @@
|
||||
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<style>
|
||||
fieldset { float:left; }
|
||||
table.layout { border-width: 0; }
|
||||
table.layout TR TD { max-width:40%; }
|
||||
</style>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<% using(Html.BeginForm("Profile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %>
|
||||
<% { %>
|
||||
|
||||
<input type="hidden" name="username" value="<%=ViewData["ProfileUserName"]%>">
|
||||
<fieldset><legend>Informations publiques</legend>
|
||||
|
||||
<table class="layout">
|
||||
@ -165,7 +166,13 @@ Avatar </td><td> <img class="avatar" src="<%=Model.avatar%>" alt=""/>
|
||||
<% if (Roles.IsUserInRole((string)ViewData ["UserName"],"Admin")) { %>
|
||||
This user is Admin.
|
||||
<% } %>
|
||||
HasBankAccount:<%= Model.HasBankAccount %>, IsBillable:<%=Model.IsBillable%>
|
||||
HasBankAccount:<%= Model.HasBankAccount %>
|
||||
<% if (!Model.HasBankAccount) { %>
|
||||
(IBAN+BIC ou Codes banque, guichet, compte et clé RIB)
|
||||
<% } %>, IsBillable:<%=Model.IsBillable%>
|
||||
<% if (!Model.IsBillable) { %>
|
||||
(un nom et au choix, une adresse postale valide,
|
||||
ou un téléphone, ou un email, ou un Mobile) <% } %>
|
||||
</aside>
|
||||
|
||||
</asp:Content>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Register" Language="C#" Inherits="Yavsc.RegisterPage" MasterPageFile="~/Models/App.master" %>
|
||||
<%@ Page Title="Register" Language="C#" Inherits="System.Web.Mvc.ViewPages<RegisterViewModel>" MasterPageFile="~/Models/App.master" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<%= Html.ValidationSummary() %>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<%@ Page Title="User removal" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<div>
|
||||
|
||||
<%= Html.ValidationSummary() %>
|
||||
<% using ( Html.BeginForm("RemoveUser","Admin") ) { %>
|
||||
Supprimer l'utilisateur
|
||||
|
@ -7,7 +7,7 @@
|
||||
<%foreach (MembershipUser user in Model){ %>
|
||||
<li><%=user.UserName%> <%=user.Email%> <%=(user.IsApproved)?"":"("+LocalizedText.Not_Approuved+")"%> <%=user.IsOnline?LocalizedText.Online:LocalizedText.Offline%>
|
||||
<% if (Roles.IsUserInRole("Admin")) { %>
|
||||
<%= Html.ActionLink(LocalizedText.Remove,"RemoveUserQuery", new { username = user.UserName }, new { @class="actionlink" } ) %>
|
||||
<%= Html.ActionLink(LocalizedText.Remove,"RemoveUser", new { username = user.UserName }, new { @class="actionlink" } ) %>
|
||||
<% } %>
|
||||
</li><% }%>
|
||||
</ul>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<%@ Page Title="Devis" Language="C#" Inherits="System.Web.Mvc.ViewPage<Estimate>" MasterPageFile="~/Models/App.master" %>
|
||||
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
|
||||
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
|
||||
<script>
|
||||
@ -8,11 +7,10 @@ $(function(){
|
||||
$("#tbwrts").stupidtable();
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery.validate.js")%>"></script>
|
||||
<link rel="stylesheet" href="<%=Url.Content("~/Theme/dark/style.css")%>" type="text/css" media="print, projection, screen" />
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
|
||||
<%= Html.ValidationSummary("Devis") %>
|
||||
<% using (Html.BeginForm("Estimate","FrontOffice")) { %>
|
||||
<%= Html.LabelFor(model => model.Title) %>:<%= Html.TextBox( "Title" ) %>
|
||||
@ -21,11 +19,25 @@ $("#tbwrts").stupidtable();
|
||||
<%= Html.Hidden ("Responsible") %>
|
||||
|
||||
<%= Html.LabelFor(model => model.Client) %>:
|
||||
|
||||
<% Client.Value = Model.Client ; %>
|
||||
<yavsc:InputUserName id="Client" name="Client" runat="server">
|
||||
<yavsc:InputUserName
|
||||
id="Client"
|
||||
name="Client"
|
||||
emptyvalue="*nouvel utilisateur*"
|
||||
onchange="onClientChange(this.value);"
|
||||
runat="server" >
|
||||
</yavsc:InputUserName>
|
||||
|
||||
<%= Html.ValidationMessage("Client", "*") %>
|
||||
<script>
|
||||
function onClientChange(newval)
|
||||
{
|
||||
if (newval=='')
|
||||
$("#dfnuser").removeClass("hidden");
|
||||
else
|
||||
$("#dfnuser").addClass("hidden");
|
||||
}
|
||||
</script>
|
||||
<%= Html.ValidationMessage("Client", "*") %>
|
||||
<br/>
|
||||
<%= Html.LabelFor(model => model.Description) %>:<%=Html.TextArea( "Description") %>
|
||||
<%= Html.ValidationMessage("Description", "*") %>
|
||||
@ -38,7 +50,6 @@ $("#tbwrts").stupidtable();
|
||||
<input type="submit" name="submit" value="Update"/>
|
||||
<% } %>
|
||||
|
||||
|
||||
<% if (Model.Id>0) { %>
|
||||
<table id="tbwrts">
|
||||
<thead>
|
||||
@ -68,13 +79,26 @@ $("#tbwrts").stupidtable();
|
||||
</table>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MASContent" ID="MASContent1" runat="server">
|
||||
<% ViewData["EstimateId"]=Model.Id; %>
|
||||
<aside>
|
||||
<div id="dfnuser" class="hidden">
|
||||
<%= Html.Partial("Register",new RegisterClientModel(),new ViewDataDictionary(ViewData)
|
||||
{
|
||||
TemplateInfo = new System.Web.Mvc.TemplateInfo
|
||||
{
|
||||
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
|
||||
}
|
||||
}) %>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<aside>
|
||||
|
||||
<% ViewData["EstimateId"]=Model.Id; %>
|
||||
<%= Html.Partial("Writting",new Writting(),new ViewDataDictionary(ViewData)
|
||||
{
|
||||
TemplateInfo = new System.Web.Mvc.TemplateInfo
|
||||
@ -82,7 +106,6 @@ $("#tbwrts").stupidtable();
|
||||
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"wr":ViewData.TemplateInfo.HtmlFieldPrefix+"_wr"
|
||||
}
|
||||
}) %>
|
||||
|
||||
|
||||
<form>
|
||||
<div>
|
||||
@ -139,6 +162,7 @@ $("#tbwrts").stupidtable();
|
||||
}
|
||||
|
||||
function delRow(e) {
|
||||
clearWrittingValidation();
|
||||
e.stopPropagation(); // do not edit this row on this click
|
||||
// from <row id= ...><tr><td><input type="button" >
|
||||
var hid=e.delegateTarget.parentNode.parentNode.id;
|
||||
@ -157,13 +181,17 @@ $("#tbwrts").stupidtable();
|
||||
// $("#tbwrts").tablesorter( {sortList: [[0,0], [1,0]]} ); // .update();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
message(xhr.status+" : "+xhr.responseText);}
|
||||
if (xhr.status!=400)
|
||||
message(xhr.status+" : "+xhr.responseText);
|
||||
else message(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setRow() {
|
||||
var wrt = GetWritting();
|
||||
clearWrittingValidation();
|
||||
$.ajax({
|
||||
url: "<%=Url.Content("~/api/WorkFlow/UpdateWritting")%>",
|
||||
type: 'POST',
|
||||
@ -176,25 +204,94 @@ $("#tbwrts").stupidtable();
|
||||
cells[3].innerHTML=wrt.UnitaryCost;
|
||||
message(false);
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
message (xhr.status+" : "+xhr.responseText+" / "+thrownError);}
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
$.each(data.responseJSON, function (key, value) {
|
||||
var errspanid = "Err_" + value.key.replace(".","_");
|
||||
var errspan = document.getElementById(errspanid);
|
||||
if (errspan==null)
|
||||
alert('enoent '+errspanid);
|
||||
else
|
||||
errspan.innerHTML=value.errors.join("<br/>");
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status!=400)
|
||||
message(xhr.status+" : "+xhr.responseText);
|
||||
else message(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addUser()
|
||||
{
|
||||
var user={
|
||||
UserName: $("#ur_UserName").val(),
|
||||
Name: $("#ur_Name").val(),
|
||||
Password: $("#ur_Password").val(),
|
||||
Email: $("#ur_Email").val(),
|
||||
Address: $("#ur_Address").val(),
|
||||
CityAndState: $("#ur_CityAndState").val(),
|
||||
ZipCode: $("#ur_ZipCode").val(),
|
||||
Phone: $("#ur_Phone").val(),
|
||||
Mobile: $("#ur_Mobile").val(),
|
||||
IsApprouved: true
|
||||
};
|
||||
clearRegistrationValidation();
|
||||
$.ajax({
|
||||
url: "<%=Url.Content("~/api/FrontOffice/Register")%>",
|
||||
type: "POST",
|
||||
data: user,
|
||||
success: function (data) {
|
||||
$("#Client option:last").after($('<option>'+user.UserName+'</option>'));
|
||||
Client.value = user.UserName;
|
||||
onClientChange(Client.value);
|
||||
},
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
$.each(data.responseJSON, function (key, value) {
|
||||
var errspanid = "Err_ur_" + value.key.replace("model.","");
|
||||
var errspan = document.getElementById(errspanid);
|
||||
if (errspan==null)
|
||||
alert('enoent '+errspanid);
|
||||
else
|
||||
errspan.innerHTML=value.errors.join("<br/>");
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status!=400)
|
||||
message(xhr.status+" : "+xhr.responseText);
|
||||
else message(false);
|
||||
}});
|
||||
}
|
||||
function clearWrittingValidation() {
|
||||
$("#Err_wr_Description").text("");
|
||||
$("#Err_wr_ProductReference").text("");
|
||||
$("#Err_wr_UnitaryCost").text("");
|
||||
$("#Err_wr_Count").text("");
|
||||
}
|
||||
function clearRegistrationValidation(){
|
||||
$("#Err_ur_Name").text("");
|
||||
$("#Err_ur_UserName").text("");
|
||||
$("#Err_ur_Mobile").text("");
|
||||
$("#Err_ur_Phone").text("");
|
||||
$("#Err_ur_Email").text("");
|
||||
$("#Err_ur_Address").text("");
|
||||
$("#Err_ur_ZipCode").text("");
|
||||
$("#Err_ur_CityAndState").text("");
|
||||
}
|
||||
|
||||
function addRow(){
|
||||
var wrt = GetWritting(); // gets a writting object from input controls
|
||||
var estid = parseInt($("#Id").val());
|
||||
|
||||
$("#Err_wr_Description").text("");
|
||||
$("#Err_wr_ProductReference").text("");
|
||||
$("#Err_wr_UnitaryCost").text("");
|
||||
$("#Err_wr_Count").text("");
|
||||
clearWrittingValidation();
|
||||
|
||||
$.ajax({
|
||||
url: "<%=Url.Content("~/api/WorkFlow/Write?estid=")%>"+estid,
|
||||
type: "POST",
|
||||
data: wrt,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
wrt.Id = Number(data);
|
||||
wredit(wrt.Id);
|
||||
@ -211,22 +308,21 @@ function addRow(){
|
||||
$("<td></td>").append(btrm).appendTo("#"+wridval);
|
||||
btrm.click(function (e) {delRow(e);});
|
||||
$("#"+wridval).click(function(ev){onEditRow(ev);});
|
||||
// $("#tbwrts").tablesorter( {sortList: [[0,0], [1,0]]} ); // .update();
|
||||
|
||||
message(false);
|
||||
|
||||
},
|
||||
dataType: "json",
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
$.each(data.responseJSON, function (key, value) {
|
||||
document.getElementById("Err_" + value.key.replace(".","_")).innerHTML=value.errors.join("<br/>");
|
||||
document.getElementById("Err_wr_" + value.key).innerHTML=value.errors.join("<br/>");
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status != 400)
|
||||
message(xhr.status+" : "+xhr.responseText+" / "+thrownError);}});
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status!=400)
|
||||
message(xhr.status+" : "+xhr.responseText);
|
||||
else message(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onEditRow(e) {
|
||||
@ -243,6 +339,7 @@ function addRow(){
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#btnnewuser").click(addUser);
|
||||
$("#btncreate").click(addRow);
|
||||
$("#btnmodify").click(setRow);
|
||||
$(".row").click(function (e) {onEditRow(e);});
|
||||
@ -261,9 +358,4 @@ function addRow(){
|
||||
<a class="actionlink" href="<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>/FrontOffice/EstimateToTex?estimid=<%=Model.Id%>"><%= LocalizedText.Tex_version %></a>
|
||||
<a class="actionlink" href="<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>/FrontOffice/EstimateToPdf?estimid=<%=Model.Id%>"><%= LocalizedText.Pdf_version %></a>
|
||||
</aside>
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
|
||||
|
||||
</asp:Content>
|
@ -1,8 +1,25 @@
|
||||
<%@ Page Title="My estimates" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Estimate>>" %>
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<% foreach (Estimate estim in Model) { %>
|
||||
<%= Html.ActionLink(estim.Id.ToString(),"Estimate",new {Id=estim.Id}) %>
|
||||
<% if (((int)ViewData["ResponsibleCount"])>0) { %>
|
||||
<div>
|
||||
Les estimations que vous avez faites (<%=ViewData["ResponsibleCount"]%>):<br>
|
||||
<%
|
||||
foreach (Estimate estim in Model) {
|
||||
if (string.Compare(estim.Responsible,(string) ViewData["UserName"])==0) { %>
|
||||
|
||||
<%= Html.ActionLink("Titre:"+estim.Title+" Client:"+estim.Client+" Id:"+estim.Id.ToString(),"Estimate",new {Id=estim.Id}) %>
|
||||
<br>
|
||||
<% }}%>
|
||||
</div>
|
||||
<% } %>
|
||||
</asp:Content>
|
||||
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
|
||||
<div>
|
||||
Vos estimations <% if (((int)ViewData["ResponsibleCount"])>0) { %>
|
||||
en tant que client
|
||||
<% } %> (<%=ViewData["ClientCount"]%>):<br>
|
||||
<% foreach (Estimate estim in Model) {
|
||||
if (string.Compare(estim.Client,(string)ViewData["UserName"])==0) { %>
|
||||
<%= Html.ActionLink("Titre:"+estim.Title+" Responsable:"+estim.Responsible+" Id:"+estim.Id.ToString(),"Estimate",new {Id=estim.Id}) %>
|
||||
<br>
|
||||
<% }} %>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
72
web/Views/FrontOffice/Register.ascx
Normal file
72
web/Views/FrontOffice/Register.ascx
Normal file
@ -0,0 +1,72 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<RegisterClientModel>" %>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<% using(Html.BeginForm("Register")) %>
|
||||
<% { %>
|
||||
<h1>Nouvel utilisateur</h1>
|
||||
<table class="layout">
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Name) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "Name" ) %>
|
||||
<%= Html.ValidationMessage("Name", "*", new { @id="Err_ur_Name", @class="error" }) %></td></tr>
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.UserName) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "UserName" ) %>
|
||||
<%= Html.ValidationMessage("UserName", "*", new { @id="Err_ur_UserName", @class="error" }) %></td></tr>
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Password) %>
|
||||
</td><td>
|
||||
<%= Html.Password( "Password" ) %>
|
||||
<%= Html.ValidationMessage("Password", "*", new { @id="Err_ur_Password", @class="error" }) %>
|
||||
</td></tr>
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Email) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "Email" ) %>
|
||||
<%= Html.ValidationMessage("Email", "*", new { @id="Err_ur_Email", @class="error" }) %>
|
||||
</td></tr>
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Address) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "Address" ) %>
|
||||
<%= Html.ValidationMessage("Address", "*", new { @id="Err_ur_Address", @class="error" }) %></td></tr>
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.CityAndState) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "CityAndState" ) %>
|
||||
<%= Html.ValidationMessage("CityAndState", "*", new { @id="Err_ur_CityAndState", @class="error" }) %>
|
||||
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.ZipCode) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "ZipCode" ) %>
|
||||
<%= Html.ValidationMessage("ZipCode", "*", new { @id="Err_ur_ZipCode", @class="error" }) %></td></tr>
|
||||
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Phone) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "Phone" ) %>
|
||||
<%= Html.ValidationMessage("Phone", "*", new { @id="Err_ur_Phone", @class="error" }) %></td></tr>
|
||||
|
||||
<tr><td align="right">
|
||||
<%= Html.LabelFor(model => model.Mobile) %>
|
||||
</td><td>
|
||||
<%= Html.TextBox( "Mobile" ) %>
|
||||
<%= Html.ValidationMessage("Mobile", "*", new { @id="Err_ur_Mobile", @class="error" }) %></td></tr>
|
||||
|
||||
</table>
|
||||
<input type="button" id="btnnewuser" class="actionlink" value="Enregistrer">
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using Yavsc.Model.RolesAndMembers;
|
||||
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
/// <summary>
|
||||
/// Register page.
|
||||
/// </summary>
|
||||
public class RegisterPage : System.Web.Mvc.ViewPage<RegisterViewModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.RegisterPage"/> class.
|
||||
/// </summary>
|
||||
public RegisterPage ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// The createuserwizard1.
|
||||
/// </summary>
|
||||
public CreateUserWizard Createuserwizard1;
|
||||
/// <summary>
|
||||
/// Raises the register send mail event.
|
||||
/// </summary>
|
||||
/// <param name="sender">Sender.</param>
|
||||
/// <param name="e">E.</param>
|
||||
public void OnRegisterSendMail(object sender, MailMessageEventArgs e)
|
||||
{
|
||||
// Set MailMessage fields.
|
||||
e.Message.IsBodyHtml = false;
|
||||
e.Message.Subject = "New user on Web site.";
|
||||
// Replace placeholder text in message body with information
|
||||
// provided by the user.
|
||||
e.Message.Body = e.Message.Body.Replace("<%PasswordQuestion%>", Createuserwizard1.Question);
|
||||
e.Message.Body = e.Message.Body.Replace("<%PasswordAnswer%>", Createuserwizard1.Answer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add key="Name" value="Psc" />
|
||||
<!-- do not point "/Home/index" with the value for the "StartPage",
|
||||
it would result in a redirection infinite loop -->
|
||||
<add key="StartPage" value="/Blog" />
|
||||
<!-- <add key="StartPage" value="/Blog" /> -->
|
||||
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
|
||||
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
|
@ -144,7 +144,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\BlogsController.cs" />
|
||||
<Compile Include="Views\RegisterPage.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Helpers\BBCodeHelper.cs" />
|
||||
<Compile Include="Test\TestByteA.cs" />
|
||||
@ -239,7 +238,6 @@
|
||||
<Content Include="Views\Admin\Admin.aspx" />
|
||||
<Content Include="Views\Admin\AddRole.aspx" />
|
||||
<Content Include="Views\Admin\UserList.aspx" />
|
||||
<Content Include="Views\Admin\RemoveRoleQuery.aspx" />
|
||||
<Content Include="Views\Admin\RoleList.aspx" />
|
||||
<Content Include="Views\Admin\CreateBackup.aspx" />
|
||||
<Content Include="Views\Admin\BackupCreated.aspx" />
|
||||
@ -247,7 +245,6 @@
|
||||
<Content Include="Views\Admin\Restore.aspx" />
|
||||
<Content Include="Views\Admin\Restored.aspx" />
|
||||
<Content Include="Views\Admin\Index.aspx" />
|
||||
<Content Include="Views\FrontOffice\Estimate.aspx" />
|
||||
<Content Include="Theme\style.css" />
|
||||
<Content Include="Theme\green\asc.png" />
|
||||
<Content Include="Theme\green\bg.png" />
|
||||
@ -678,6 +675,11 @@
|
||||
<Content Include="Scripts\jquery-ui.js" />
|
||||
<Content Include="Views\Account\Profile.aspx" />
|
||||
<Content Include="robots.txt" />
|
||||
<Content Include="Views\FrontOffice\Register.ascx" />
|
||||
<Content Include="Scripts\form-new-user.js" />
|
||||
<Content Include="Views\FrontOffice\Estimate.aspx" />
|
||||
<Content Include="Theme\dark\croix.png" />
|
||||
<Content Include="Views\Admin\RemoveRole..aspx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
6
yavscModel/LocalizedText.Designer.cs
generated
6
yavscModel/LocalizedText.Designer.cs
generated
@ -70,6 +70,12 @@ namespace Yavsc.Model {
|
||||
}
|
||||
}
|
||||
|
||||
public static string My_Estimates {
|
||||
get {
|
||||
return ResourceManager.GetString("My_Estimates", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string UserName {
|
||||
get {
|
||||
return ResourceManager.GetString("UserName", resourceCulture);
|
||||
|
@ -47,4 +47,5 @@
|
||||
<data name="role_created"><value>Rôle créé</value></data>
|
||||
<data name="Item_added_to_basket"><value>Article ajouté au panier</value></data>
|
||||
<data name="Estimate_not_found"><value>Devis non trouvé</value></data>
|
||||
<data name="My_Estimates"><value>Mes estimations</value></data>
|
||||
</root>
|
||||
|
@ -49,4 +49,5 @@
|
||||
<data name="Estimate_not_found"><value>Estimate not found</value></data>
|
||||
<data name="DuplicateEmail"><value>This email adress is already used ({0}).</value></data>
|
||||
<data name="DuplicateUserName"><value>This user name is already used ({0}).</value></data>
|
||||
<data name="My_Estimates"><value>My estimates</value></data>
|
||||
</root>
|
||||
|
@ -168,28 +168,45 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
/// Gets a value indicating whether this instance has bank account.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has bank account; otherwise, <c>false</c>.</value>
|
||||
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))
|
||||
); } }
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
///
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is billable; otherwise, <c>false</c>.</value>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
71
yavscModel/RolesAndMemebers/RegisterClientModel.cs
Normal file
71
yavscModel/RolesAndMemebers/RegisterClientModel.cs
Normal file
@ -0,0 +1,71 @@
|
||||
//
|
||||
// RegisterClientModel.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Model.RolesAndMembers
|
||||
{
|
||||
/// <summary>
|
||||
/// Register client model.
|
||||
/// </summary>
|
||||
public class RegisterClientModel : RegisterModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the full name.
|
||||
/// </summary>
|
||||
/// <value>The full name.</value>
|
||||
[DisplayName("Nom complet")]
|
||||
[Required(ErrorMessage="S'il vous plait, saisissez le nom complet")]
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the address.
|
||||
/// </summary>
|
||||
/// <value>The address.</value>
|
||||
[DisplayName("Addresse")]
|
||||
public string Address { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the state of the city and.
|
||||
/// </summary>
|
||||
/// <value>The state of the city and.</value>
|
||||
[DisplayName("Ville")]
|
||||
public string CityAndState { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the zip code.
|
||||
/// </summary>
|
||||
/// <value>The zip code.</value>
|
||||
[DisplayName("Code postal")]
|
||||
public string ZipCode { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the phone.
|
||||
/// </summary>
|
||||
/// <value>The phone.</value>
|
||||
[DisplayName("Téléphone fixe")]
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the mobile.
|
||||
/// </summary>
|
||||
/// <value>The mobile.</value>
|
||||
[DisplayName("Téléphone mobile")]
|
||||
public string Mobile { get; set; }
|
||||
}
|
||||
}
|
@ -55,8 +55,15 @@ namespace Yavsc.Model.RolesAndMembers
|
||||
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is approuved.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is approuved; otherwise, <c>false</c>.</value>
|
||||
public bool IsApprouved { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.Model.RolesAndMembers.RegisterModel"/> class.
|
||||
/// </summary>
|
||||
public RegisterModel()
|
||||
{
|
||||
IsApprouved = false;
|
||||
|
@ -62,11 +62,19 @@ namespace Yavsc.Model.WorkFlow
|
||||
/// <param name="estimid">Estimid.</param>
|
||||
Estimate GetEstimate (long estimid);
|
||||
/// <summary>
|
||||
/// Gets the estimates created for a specified client.
|
||||
/// Gets the estimates created by
|
||||
/// or for the given user by user name.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="username">user name.</param>
|
||||
Estimate [] GetEstimates(string username);
|
||||
/// <summary>
|
||||
/// Gets the estimates.
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
Estimate [] GetEstimates(string client);
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
Estimate [] GetEstimates(string client, string responsible);
|
||||
/// <summary>
|
||||
/// Drops the writting.
|
||||
/// </summary>
|
||||
|
@ -48,15 +48,30 @@ namespace Yavsc.Model.WorkFlow
|
||||
return ContentProvider.GetEstimate (estid);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the estimates.
|
||||
/// Gets the estimates, refering the
|
||||
/// given client or username .
|
||||
/// </summary>
|
||||
/// <returns>The estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
public Estimate [] GetEstimates (string client)
|
||||
/// <param name="responsible">Responsible.</param>
|
||||
public Estimate [] GetResponsibleEstimates (string responsible)
|
||||
{
|
||||
return ContentProvider.GetEstimates (client);
|
||||
return ContentProvider.GetEstimates (null, responsible);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client estimates.
|
||||
/// </summary>
|
||||
/// <returns>The client estimates.</returns>
|
||||
/// <param name="client">Client.</param>
|
||||
public Estimate [] GetClientEstimates (string client)
|
||||
{
|
||||
return ContentProvider.GetEstimates (client, null);
|
||||
}
|
||||
|
||||
public Estimate [] GetUserEstimates (string username)
|
||||
{
|
||||
return ContentProvider.GetEstimates (username);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the stock for a given product reference.
|
||||
/// </summary>
|
||||
|
@ -143,6 +143,7 @@
|
||||
<Compile Include="Google\GDate.cs" />
|
||||
<Compile Include="Google\Resource.cs" />
|
||||
<Compile Include="RolesAndMemebers\RegisterModel.cs" />
|
||||
<Compile Include="RolesAndMemebers\RegisterClientModel.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user