Fixe la recherche d'un préstataire.

* Makefile: Fixe: ne pas déployer sans hôte de destination
Ajoute: le déployement de tous des sites en prod, avec la cible
  `syncall`

* NpgsqlContentProvider.cs: Renseigne le code APE et la côte à la création du
  profile préstataire

* SkillController.cs:
* FrontOfficeController.cs:
* NpgsqlSkillProvider.cs:
* SimpleBookingQuery.cs:
* AuthentificatedSkillRating.cs: refabrication

* ResultPages.cs:
* Title.aspx:
* YavscHelpers.cs: ajoute une classe css au bloc de liens vers les
  autres pages de resultat

* style.css: mise en forme du code

* style.css: du style

* Booking.aspx:
* FrontOfficeController.cs: Modifie la recherche des prestataire, pour
  qu'un resultat soit donné dès qu'un utilisateur est déclaré
  prestataire.

* PerformerProfile.cs: doc xml

* LocalizedText.resx:
* LocalizedText.fr.resx:
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: internationalisation

* Profile.cs: Décore la valeur de profile "GoogleRegId"

* SkillEntity.cs: refabrication pour l'instant inutile ...

* SkillManager.cs: présente à l'espace de travail la nouvelle methode
  de recherche d'un préstataire

* SkillProvider.cs: définit la nouvelle methode de recherche d'un
  préstataire

* WorkFlowManager.cs: présente à l'espace de travail une
nouvelle methode de recherche d'un préstataire,
renvoyant toute l'information relative à chaque prestataire listé.

* YavscModel.csproj: refabrication des cotes de compétences
This commit is contained in:
Paul Schneider 2015-11-30 15:16:24 +01:00
commit dbcbf8b318
30 changed files with 373 additions and 155 deletions

View file

@ -1,3 +1,10 @@
2015-11-30 Paul Schneider <paul@pschneider.fr>
* NpgsqlContentProvider.cs: Renseigne le code APE et la côte
au profile préstataire
* NpgsqlSkillProvider.cs: refabrication
2015-11-28 Paul Schneider <paul@pschneider.fr>
* NpgsqlContentProvider.cs: implemente un listing des

View file

@ -54,6 +54,8 @@ namespace Yavsc
profile.Id = rdr.GetInt64 (0);
profile.UserName = rdr.GetString (1);
profile.EMail = rdr.GetString (2);
profile.MEACode = MEACode;
profile.Rate = rdr.GetInt32 (3);
result.Add (profile);
}
}
@ -154,11 +156,11 @@ namespace Yavsc
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into activity (meacode,title,applicationname,cmnt) " +
" values (:code,:title,:app,:cmt)";
" values (:code,:title,:app,:cmnt)";
cmd.Parameters.AddWithValue ("code", code);
cmd.Parameters.AddWithValue ("title", activity);
cmd.Parameters.AddWithValue ("app", applicationName);
cmd.Parameters.AddWithValue ("cmt", comment);
cmd.Parameters.AddWithValue ("cmnt", comment);
cmd.ExecuteNonQuery ();
}
cnx.Close ();

View file

@ -72,6 +72,27 @@ namespace WorkFlowProvider
var profile = new PerformerProfile (username);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select p.uniqueid, d.rate, d.MEACode, u.email " +
" from users u, profiles p, profiledata d where " +
" u.username = :user and u.applicationname = :app " +
" and p.username = u.username " +
" and p.applicationname = u.applicationname " +
" and p.uniqueid = d.uniqueid ";
cmd.Parameters.AddWithValue ("user", NpgsqlTypes.NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
using (var rdr = cmd.ExecuteReader ()) {
rdr.Read ();
profile.Id = rdr.GetInt64 (0);
profile.Rate = rdr.GetInt32 (1);
profile.MEACode = rdr.GetString (2);
profile.EMail = rdr.GetString (3);
}
}
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
" select u._id, u.skillid, s.name, " +
@ -79,10 +100,13 @@ namespace WorkFlowProvider
" skill s " +
" where u.skillid = s._id and " +
" u.username = :uname " +
" and applicationname = :app " +
" order by u.rate desc";
" and s.applicationname = u.applicationname " +
" and s.applicationname = :app " +
" and s.meacode = :mea " +
" order by u.rate desc ";
cmd.Parameters.AddWithValue ("uname", NpgsqlTypes.NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlTypes.NpgsqlDbType.Varchar, profile.MEACode);
cmd.Prepare ();
using (var rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows)
@ -98,20 +122,7 @@ namespace WorkFlowProvider
profile.Skills = skills.ToArray ();
}
}
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"select p.uniqueid, d.rate from profiles p, profiledata d where " +
" username = :user and applicationname = :app " +
" and p.uniqueid = d.uniqueid ";
cmd.Parameters.AddWithValue ("user", NpgsqlTypes.NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
using (var rdr = cmd.ExecuteReader ()) {
rdr.Read ();
profile.Id = rdr.GetInt64 (0);
profile.Rate = rdr.GetInt32 (1);
}
}
cnx.Close ();
}
return profile;
@ -164,6 +175,8 @@ namespace WorkFlowProvider
cnx.Open ();
if (userskill.Id == 0) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (userskill.Comment == null)
userskill.Comment = "";
cmd.CommandText = "insert into userskills" +
" (username, applicationname, skillid, rate, comment) " +
" values (:uname,:app,:sid,:rate,:cmnt) returning _id";
@ -185,7 +198,7 @@ namespace WorkFlowProvider
" set rate = :rate," +
" comment = :cmnt) " +
" where _id = :usid ";
cmd.Parameters.AddWithValue ("comment",
cmd.Parameters.AddWithValue ("cmnt",
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.Comment);
cmd.Parameters.AddWithValue ("rate",
NpgsqlTypes.NpgsqlDbType.Integer, userskill.Rate);
@ -247,7 +260,7 @@ namespace WorkFlowProvider
/// or a rating engine
/// </summary>
/// <param name="skill">Skill.</param>
public override void Rate (SkillRating skill)
public override void Rate (AuthentificatedSkillRating skill)
{
// TODO Use the Author value to choose
// between a global setting for the application
@ -316,56 +329,73 @@ namespace WorkFlowProvider
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public override string[] FindPerformer (long[] skillIds)
/// <param name="MEACode">MEACode.</param>
/// <param name="skills">Skills.</param>
public override string[] FindPerformer (string MEACode, SkillRating [] skills)
{
var res = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = " select u.username " +
" from userskills s, profiledata p, profile q, users u " +
" where s.username = u.username " +
" and s.applicationname = u.applicationanme " +
" and s.skillid = :sid " +
" and u.username = q.username " +
" and u.applicationname = q.applicationanme " +
" and p.uniqueid = q.uniqueid " +
" and u.applicationanme = :app " +
" and u.islockedout = FALSE " +
" and u.isapproved = TRUE " +
" order by s.rate desc ";
if (skills != null) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, 0);
cmd.Prepare ();
// on cherche ici simplement les prestataires
// ayant déclaré les compétences spécifiées.
foreach (long sid in skillIds) {
cmd.Parameters ["sid"].Value = sid;
using (var rdr = cmd.ExecuteReader ()) {
string uname = rdr.GetString (0);
if (!res.Contains (uname))
res.Add (uname);
cmd.CommandText = @" select u.username
from userskills s, profiledata p, profiles q, users u
where s.username = u.username
and s.applicationname = u.applicationname
and s.skillid = :sid
and p.meacode = :mea
and u.username = q.username
and u.applicationname = q.applicationname
and p.uniqueid = q.uniqueid
and u.applicationname = :app
and u.islockedout = FALSE
and u.isapproved = TRUE
order by s.rate desc ";
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, 0);
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlDbType.Varchar, MEACode);
cmd.Prepare ();
foreach (SkillRating skill in skills) {
cmd.Parameters ["sid"].Value = skill.Id;
using (var rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
string uname = rdr.GetString (0);
if (!res.Contains (uname))
res.Add (uname);
}
}
}
}
// TODO implement a configuration parameter
if (res.Count < 10) {
}
if (res.Count < 10) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
// Si on a trouvé trop peu de prestataire ayant
// déclaré ces compétences (moins de 10),
// On en cherche un ayant
// simplement déclaré avoir l'activité
// concernée.
// TODO implement a configuration parameter :
cmd.CommandText = " select u.username " +
" from skill s, profiledata p , profile q, users u " +
" from profiledata p, profiles q, users u " +
" where u.username = q.username " +
" and u.applicationname = q.applicationanme " +
" and u.applicationname = q.applicationname " +
" and p.uniqueid = q.uniqueid " +
" and p.meacode = s.meacode " +
" and s._id = :sid " +
" and u.applicationanme = :app " +
" and p.meacode = :mea " +
" and u.applicationname = :app " +
" and u.islockedout = FALSE " +
" and u.isapproved = TRUE" +
" order by s.rate desc " ;
foreach (long sid in skillIds) {
cmd.Parameters ["sid"].Value = sid;
using (var rdr = cmd.ExecuteReader ()) {
" and u.isapproved = TRUE " +
" order by p.rate desc " ;
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("mea", NpgsqlDbType.Varchar, MEACode);
using (var rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
string uname = rdr.GetString (0);
if (!res.Contains (uname))
res.Add (uname);