From fe97f148317044e1dcfcaaa07754cdfa3329c4dc Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 23 Nov 2015 00:43:57 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9organisations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La page de reservation par défaut est maintenant la reservation dite simple. Fonctionnalités en cours de développement: 1) la reservation dite simple 2) la notification à la reservation 3) l'activité principale exercée 4) l'integration d'un premier thème clair * MEA.sql: définit la valeur MEA du profile (Main Exerted Activity) dans la base de donnée * Booking.aspx: Imlémente la vue du formulaire de reservation simple, c'etait avant la reservation classique, sur une période plutôt qu'un jour. La reservation classique est renomée `EavyBooking`. * SimpleBookingQuery.cs: Implémente une simple commande de rendez-vous, en tant que commande du workflow. * .gitignore: ignorer les configuration des pré et prod totem. * SkillEntity.cs: * SkillManager.cs: * Skills.aspx: * SkillProvider.cs: * SkillController.cs: * UserSkills.aspx: * NpgsqlSkillProvider.cs: refactorisation (-Skill+SkillEntity) * NpgsqlProfileProvider.cs: Fixe un bug introduit avec l'implementation des profiles anonymes. * FrontOfficeController.cs: definit l'interface de cotation des compétences attendues * UserCard.ascx: Imlémente une carte utilisateur. * Web.config: déclare le code activité principale exercée parmis les valeurs du profile authentifié. * Web.csproj: ajoute les nouveaux formulaire de reservation au projet. * PerformerProfile.cs: S'assure d'avoir une valeur pour le nom d'utilisateur à la création. * LocalizedText.resx: * LocalizedText.Designer.cs: "date préférée" en anglais * LocalizedText.fr.resx: * LocalizedText.fr.Designer.cs: "date préférée" en français * Profile.cs: à la creation d'un profile, on doit avoir un nom d'utilisateur, même dans le cas où le profile est anonyme (dans ce cas, on l'appelle identifiant anonyme). Sinon, on lève une exception. * YavscModel.csproj: * refactorisation: le nom `Skill` est celui de l'espace, celui de la classe devient `SkillEntity`. * Creation de la requête dite simple d'un rendez-vous (pour prestation) à une date donnée (sans heure), concernant simplement une activité. * EavyBooking.aspx: Implémente la reservation lourde --- .gitignore | 3 +- ChangeLog | 4 ++ NpgsqlContentProvider/ChangeLog | 4 ++ NpgsqlContentProvider/NpgsqlSkillProvider.cs | 9 +-- NpgsqlMRPProviders/ChangeLog | 5 ++ NpgsqlMRPProviders/NpgsqlProfileProvider.cs | 42 ++++++++------ web/ApiControllers/FrontOfficeController.cs | 12 +++- web/ApiControllers/SkillController.cs | 4 +- web/App_Code/Sql/MEA.sql | 5 ++ web/ChangeLog | 28 ++++++++++ web/Views/FrontOffice/Booking.aspx | 56 +++++++++++++++++++ .../EavyBooking.aspx} | 12 ++-- web/Views/FrontOffice/Skills.aspx | 4 +- web/Views/FrontOffice/UserCard.ascx | 16 +++++- web/Views/FrontOffice/UserSkills.aspx | 3 +- web/Web.config | 25 ++++----- web/Web.csproj | 4 +- yavscModel/ChangeLog | 33 +++++++++++ .../PerformerProfile.cs | 37 ++++++++---- yavscModel/FrontOffice/SimpleBookingQuery.cs | 47 ++++++++++++++++ yavscModel/LocalizedText.Designer.cs | 10 +++- yavscModel/LocalizedText.fr.Designer.cs | 10 +++- yavscModel/LocalizedText.fr.resx | 1 + yavscModel/LocalizedText.resx | 1 + yavscModel/RolesAndMembers/Profile.cs | 4 +- yavscModel/Skill/{Skill.cs => SkillEntity.cs} | 2 +- yavscModel/Skill/SkillManager.cs | 5 +- yavscModel/Skill/SkillProvider.cs | 5 +- yavscModel/YavscModel.csproj | 5 +- 29 files changed, 319 insertions(+), 77 deletions(-) create mode 100644 web/App_Code/Sql/MEA.sql create mode 100644 web/Views/FrontOffice/Booking.aspx rename web/Views/{Google/Book.aspx => FrontOffice/EavyBooking.aspx} (87%) rename yavscModel/{Skill => FrontOffice}/PerformerProfile.cs (77%) create mode 100644 yavscModel/FrontOffice/SimpleBookingQuery.cs rename yavscModel/Skill/{Skill.cs => SkillEntity.cs} (97%) diff --git a/.gitignore b/.gitignore index 6b77999b..b05a4969 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,8 @@ web/App_Themes/style.totem.css web/Web.Debug.config web/Web.Release.config web/Web.Lua.config +web/Web.TotemPre.config +web/Web.TotemProd.config .nuget .gitignore - diff --git a/ChangeLog b/ChangeLog index 13ecca77..a445cb83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-11-23 Paul Schneider + + * .gitignore: ignorer les configuration des pré et prod totem. + 2015-11-21 Paul Schneider * Makefile: retour au débuggage de la copie de travaille, et diff --git a/NpgsqlContentProvider/ChangeLog b/NpgsqlContentProvider/ChangeLog index 9b139afa..bb6c6c91 100644 --- a/NpgsqlContentProvider/ChangeLog +++ b/NpgsqlContentProvider/ChangeLog @@ -1,3 +1,7 @@ +2015-11-23 Paul Schneider + + * NpgsqlSkillProvider.cs: refactorisation (-Skill+SkillEntity) + 2015-11-19 Paul Schneider * NpgsqlContentProvider.csproj: adds a build target named diff --git a/NpgsqlContentProvider/NpgsqlSkillProvider.cs b/NpgsqlContentProvider/NpgsqlSkillProvider.cs index 34336505..8bc236ae 100644 --- a/NpgsqlContentProvider/NpgsqlSkillProvider.cs +++ b/NpgsqlContentProvider/NpgsqlSkillProvider.cs @@ -25,6 +25,7 @@ using System.Collections.Specialized; using System.Collections.Generic; using Npgsql; using NpgsqlTypes; +using Yavsc.Model.FrontOffice; namespace WorkFlowProvider { @@ -110,7 +111,7 @@ namespace WorkFlowProvider /// Create the specified skill. /// /// skill. - public override long Declare (Skill skill) + public override long Declare (SkillEntity skill) { long res = 0; using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) { @@ -258,9 +259,9 @@ namespace WorkFlowProvider /// /// The skill identifier. /// Pattern. - public override Skill[] FindSkill (string pattern) + public override SkillEntity[] FindSkill (string pattern) { - List skills = new List (); + List skills = new List (); using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) { cnx.Open (); using (NpgsqlCommand cmd = cnx.CreateCommand ()) { @@ -269,7 +270,7 @@ namespace WorkFlowProvider cmd.Prepare (); using (var rdr = cmd.ExecuteReader ()) { if (rdr.HasRows) while (rdr.Read ()) { - skills.Add (new Skill () { + skills.Add (new SkillEntity () { Id = (long)rdr.GetInt64 (0), Name = (string)rdr.GetString (1), Rate = (int) rdr.GetInt32(2) diff --git a/NpgsqlMRPProviders/ChangeLog b/NpgsqlMRPProviders/ChangeLog index 72569c06..6febb233 100644 --- a/NpgsqlMRPProviders/ChangeLog +++ b/NpgsqlMRPProviders/ChangeLog @@ -1,3 +1,8 @@ +2015-11-23 Paul Schneider + + * NpgsqlProfileProvider.cs: Fixe un bug introduit avec + l'implementation des profiles anonymes. + 2015-11-19 Paul Schneider * NpgsqlMRPProviders.csproj: adds a build target named "Lua" diff --git a/NpgsqlMRPProviders/NpgsqlProfileProvider.cs b/NpgsqlMRPProviders/NpgsqlProfileProvider.cs index b0a53d25..f2314b52 100644 --- a/NpgsqlMRPProviders/NpgsqlProfileProvider.cs +++ b/NpgsqlMRPProviders/NpgsqlProfileProvider.cs @@ -260,6 +260,7 @@ namespace Npgsql.Web return; long puid = 0; string username = (string) context ["UserName"]; + bool needsAProfileDataRecord = false; // This user is either a authentified username, or an anonymous asp user id // He's anonymous when he's got no associated record in the "users" table // But, as long as our membership provider creates a mandatory (by db constraint) associated @@ -269,37 +270,44 @@ namespace Npgsql.Web cnx.Open (); using (NpgsqlCommand cmdpi = cnx.CreateCommand ()) { cmdpi.CommandText = "select count(uniqueid) " + - "from profiles where username = @username " + - "and applicationname = @appname"; - cmdpi.Parameters.AddWithValue ("@username", username); - cmdpi.Parameters.AddWithValue ("@appname", applicationName); + "from profiles where username = :username " + + "and applicationname = :appname"; + cmdpi.Parameters.AddWithValue ("username", username); + cmdpi.Parameters.AddWithValue ("appname", applicationName); long c = (long)cmdpi.ExecuteScalar (); if (c == 0) { // This is a new anonymous profile. // the `isanonymous` field should be specified true by default in the ddl cmdpi.CommandText = "insert into profiles (username,applicationname) " + - "values ( @username, @appname ) " + + "values ( :username, :appname ) " + "returning uniqueid"; puid = (long) cmdpi.ExecuteScalar (); - - using (NpgsqlCommand cmdpdins = cnx.CreateCommand ()) { - cmdpdins.CommandText = "insert into profiledata (uniqueid) values (@puid)"; - cmdpdins.Parameters.AddWithValue ("@puid", puid); - cmdpdins.ExecuteNonQuery (); - } + needsAProfileDataRecord = true; } else { // here we're roughly sure to get the id - cmdpi.CommandText = "select uniqueid from profiles where username = @username " + - "and applicationname = @appname"; - puid = (long)cmdpi.ExecuteScalar (); + cmdpi.CommandText = "select uniqueid from profiles where username = :username " + + "and applicationname = :appname"; + puid = (long) cmdpi.ExecuteScalar (); + // but still no data + using (NpgsqlCommand cmdgetdataprid = cnx.CreateCommand ()) { + cmdgetdataprid.CommandText = "select count(uniqueid) from profiledata where uniqueid = :puid"; + cmdgetdataprid.Parameters.AddWithValue ("puid", puid); + long cd = (long) cmdgetdataprid.ExecuteScalar (); + if (cd == 0) { + needsAProfileDataRecord = true; + } + } } } - + if (needsAProfileDataRecord) using (NpgsqlCommand cmdpdins = cnx.CreateCommand ()) { + cmdpdins.CommandText = "insert into profiledata (uniqueid) values (:puid)"; + cmdpdins.Parameters.AddWithValue ("puid", puid); + cmdpdins.ExecuteNonQuery (); + } foreach (SettingsPropertyValue s in collection) { if (s.UsingDefaultValue) { - //TODO Drop the property in the profile - + //TODO ? Drop the property in the profile } else { // update the property value // TODO update to null values (included to avoid Not Implemented columns in profiledata diff --git a/web/ApiControllers/FrontOfficeController.cs b/web/ApiControllers/FrontOfficeController.cs index e9c86d59..223d4744 100644 --- a/web/ApiControllers/FrontOfficeController.cs +++ b/web/ApiControllers/FrontOfficeController.cs @@ -14,6 +14,7 @@ using Yavsc.Model.RolesAndMembers; using Yavsc.Model.WorkFlow; using System.IO; using Yavsc.Model.FrontOffice.Catalog; +using Yavsc.Model.Skill; namespace Yavsc.ApiControllers { @@ -108,7 +109,6 @@ namespace Yavsc.ApiControllers if (!prcli.IsBillable) throw new TemplateException ("NotBillable:" + e.Client); - tmpe.Session.Add ("from", prpro); tmpe.Session.Add ("to", prcli); tmpe.Session.Add ("efrom", Membership.GetUser (e.Responsible).Email); @@ -176,6 +176,16 @@ namespace Yavsc.ApiControllers return result; } + /// + /// Rates the skill, this is a client action to profile its needs. + /// + /// Skill rating. + [Authorize()] + public void RateSkill (SkillRating rate) { + throw new NotImplementedException (); + } + + } } diff --git a/web/ApiControllers/SkillController.cs b/web/ApiControllers/SkillController.cs index 0a0ce260..fac24dd7 100644 --- a/web/ApiControllers/SkillController.cs +++ b/web/ApiControllers/SkillController.cs @@ -35,7 +35,7 @@ namespace Yavsc.ApiControllers /// /// the Skill objet. [ValidateAjaxAttribute,Authorize(Roles="Profiler")] - public long DeclareSkill (Skill s) { + public long DeclareSkill (SkillEntity s) { if (ModelState.IsValid) { SkillManager.DeclareSkill (s); } @@ -83,7 +83,7 @@ namespace Yavsc.ApiControllers /// /// The skill identifier. /// Pattern. - public Skill [] FindSkill (string pattern){ + public SkillEntity [] FindSkill (string pattern){ return SkillManager.FindSkill(pattern); } diff --git a/web/App_Code/Sql/MEA.sql b/web/App_Code/Sql/MEA.sql new file mode 100644 index 00000000..ac503f1c --- /dev/null +++ b/web/App_Code/Sql/MEA.sql @@ -0,0 +1,5 @@ + +ALTER TABLE profiledata ADD COLUMN meacode character varying(256); +COMMENT ON COLUMN profiledata.meacode IS 'Code d''activité principale éxercée.'; + + diff --git a/web/ChangeLog b/web/ChangeLog index 4884a5be..2d2b6dd7 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,31 @@ +2015-11-23 Paul Schneider + + * MEA.sql: définit la valeur MEA du profile (Main Exerted + Activity) dans la base de donnée + + * Booking.aspx: Imlémente la vue du formulaire de reservation + simple, + c'etait avant la reservation classique, sur une période plutôt + qu'un jour. + La reservation classique est renomée `EavyBooking`. + + * FrontOfficeController.cs: definit l'interface de cotation + des compétences attendues + + * Skills.aspx: + * SkillController.cs: + * UserSkills.aspx: refactorisation (-Skill+SkillEntity) + + * UserCard.ascx: Imlémente une carte utilisateur. + + * Web.config: déclare le code activité principale exercée + parmis les valeurs du profile authentifié. + + * Web.csproj: ajoute les nouveaux formulaire de reservation au + projet. + + * EavyBooking.aspx: Implémente la reservation lourde + 2015-11-22 Paul Schneider * BasketController.cs: diff --git a/web/Views/FrontOffice/Booking.aspx b/web/Views/FrontOffice/Booking.aspx new file mode 100644 index 00000000..d77c9608 --- /dev/null +++ b/web/Views/FrontOffice/Booking.aspx @@ -0,0 +1,56 @@ +<%@ Page Title="Booking" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + + + + + + + + + + +<% using ( Html.BeginForm("Booking") ) { %> + +
+Préferences musicales + <%= Html.LabelFor(model=>model.Needs) %>: +
    + <% foreach (var need in Model.Needs) { %> +
  • <%= need.Name %> <%= Html.Partial("RateSkillControl",need)%>
  • + <% } %> +
+ <%= Html.ValidationMessageFor(model=>model.Needs) %> +
+ +
+Date de l'événement +Intervention souhaitée le + "> + <%= Html.ValidationMessageFor( model=>model.PreferedDate ) %> +
+ + + +<% } %> +
+ diff --git a/web/Views/Google/Book.aspx b/web/Views/FrontOffice/EavyBooking.aspx similarity index 87% rename from web/Views/Google/Book.aspx rename to web/Views/FrontOffice/EavyBooking.aspx index 22683cce..e3647560 100644 --- a/web/Views/Google/Book.aspx +++ b/web/Views/FrontOffice/EavyBooking.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="Booking" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> +<%@ Page Title="Booking" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> @@ -32,13 +32,9 @@ et le
Intervenant - <%= Html.LabelFor(model=>model.Role) %>: - <%= Html.TextBoxFor(model=>model.Role) %> - <%= Html.ValidationMessageFor(model=>model.Role) %> -
- <%= Html.LabelFor(model=>model.Person) %>: - <%= Html.TextBoxFor(model=>model.Person) %> - <%= Html.ValidationMessageFor(model=>model.Person) %> + <%= Html.LabelFor(model=>model.Roles) %>: + <%= Html.TextBoxFor(model=>model.Roles) %> + <%= Html.ValidationMessageFor(model=>model.Roles) %>
@@ -10,8 +10,6 @@
- -