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:
2015-11-30 15:16:24 +01:00
parent a99232ba2b
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>
* 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`
2015-11-26 Paul Schneider <paul@pschneider.fr>
* Makefile:

View File

@ -3,6 +3,7 @@ VERSION=1.1
CONFIG=Debug
LDYDESTDIR=dist/web/$(CONFIG)
COPYUNCHANGED="false"
SHELL=/bin/bash
HOST_rsync_dev=lua.pschneider.fr
DESTDIR_rsync_dev=/srv/www/yavscdev
@ -46,6 +47,7 @@ rsync_% : HOST = $(HOST_$@)
rsync_% : DESTDIR = $(DESTDIR_$@)
rsync_% : deploy
if [[ "x$(HOST)" == "x" ]]; then echo "no host given, aborting"; exit 1; fi
echo "!Deploying to $(HOST) using $(CONFIG) config!"
$(RSYNCCMD) dist/web/$(CONFIG)/ root@$(HOST):$(DESTDIR)
@ -90,5 +92,7 @@ nuget_restore:
nuget_update:
for prj in ITContentProvider NpgsqlBlogProvider NpgsqlContentProvider NpgsqlMRPProviders Presta SalesCatalog TestAPI web WebControls yavscclient yavscModel; do nuget update "$${prj}/packages.config" ; done
syncall: rsync_lua rsync_pre rsync_prod rsync_totempre rsync_totemprod

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);

View File

@ -1,3 +1,8 @@
2015-11-30 Paul Schneider <paul@pschneider.fr>
* ResultPages.cs: ajoute une classe css au bloc de liens vers
les autres pages de resultat
2015-11-26 Paul Schneider <paul@pschneider.fr>
* WebControls.csproj: nouvelles configurations de déploiement

View File

@ -17,7 +17,6 @@ namespace Yavsc.WebControls
AspNetHostingPermission (SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
ParseChildren (true),
ToolboxData ("<{0}:ResultPages runat=\"server\"> </{0}:ResultPages>")
]
public class ResultPages: WebControl
@ -156,10 +155,17 @@ namespace Yavsc.WebControls
/// <param name="writer">Writer.</param>
protected override void RenderContents (HtmlTextWriter writer)
{
// avoids a division by zero
if (PageSize <= 0)
PageSize = 5;
if (ResultCount > 0 && ResultCount > PageSize ) {
writer.WriteEncodedText (Text);
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
if (!string.IsNullOrWhiteSpace(CssClass))
writer.AddAttribute ("class", this.CssClass);
writer.RenderBeginTag ("div");
writer.Write (PagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
@ -173,6 +179,8 @@ namespace Yavsc.WebControls
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
RenderChildren (writer);
writer.RenderEndTag ();
}
else {
writer.Write (SinglePage);
@ -181,7 +189,6 @@ namespace Yavsc.WebControls
if (ResultCount == 0) {
writer.Write (None);
}
}
}
}

View File

@ -202,7 +202,7 @@ namespace Yavsc.ApiControllers
/// </summary>
/// <param name="rate">Skill rating.</param>
[Authorize()]
public void RateSkill (SkillRating rate) {
public void RateSkill (AuthentificatedSkillRating rate) {
throw new NotImplementedException ();
}
}

View File

@ -74,7 +74,7 @@ namespace Yavsc.ApiControllers
/// </summary>
/// <param name="rate">Skill rating.</param>
[Authorize()]
public void RateSkill (SkillRating rate) {
public void RateSkill (AuthentificatedSkillRating rate) {
SkillManager.RateSkill(User.Identity.Name,rate);
}
@ -91,9 +91,11 @@ namespace Yavsc.ApiControllers
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public string [] FindPerformer (long []skillIds){
return SkillManager.FindPerformer(skillIds);
/// <param name="MEACode">MEA Code.</param>
/// <param name="skills">Skill ratings.</param>
public string [] FindPerformer (string MEACode, SkillRating []skills)
{
return SkillManager.FindPerformer(MEACode, skills);
}
/// <summary>
/// Deletes the skill.

View File

@ -17,6 +17,7 @@ body {
background-color: rgba(20,20,20,.8);
color: yellow;
}
.rate:hover { border-color: green;
background-color:rgba(30,0,124,0.9); }
@ -181,6 +182,7 @@ header h1, header a , .actionlink, .menuitem, a { padding:.5em;}
.usertitleref{
padding:.3em;
}
.bshpanel { cursor:zoom-in; }
.c2 { display:initial; }

View File

@ -14,6 +14,8 @@ body.loading .modal {
border-radius:1em;
border-style: solid;
border-width: 1px;
padding:.2em;
display: inline-block;
}
header {
@ -273,7 +275,7 @@ input, select, textarea {
padding:5px; margin:5px;
background-color: rgba(0,0,40,.8);
}
.skillname {
.skillname, .performer, .usercard, .pagelink {
padding:.5em;
margin:.25em;
max-width: 24em;
@ -282,6 +284,7 @@ input, select, textarea {
border-radius:1em;
border-style: solid;
border-width: 1px;
font-size: large;
}
.input-validation-error { border: solid 1px red; background-color: rgba(180,256,256,.5); }

View File

@ -1,3 +1,21 @@
2015-11-30 Paul Schneider <paul@pschneider.fr>
* SkillController.cs:
* FrontOfficeController.cs: refabrication
* 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.
* Title.aspx:
* YavscHelpers.cs: ajoute une classe css au bloc de liens vers
les autres pages de resultat
2015-11-28 Paul Schneider <paul@pschneider.fr>
* p8-av4.xxs.jpg:

View File

@ -321,7 +321,7 @@ namespace Yavsc.Controllers
// actually performed via the Web API :-°
// else if (ModelState.IsValid) {}
var usp = SkillManager.GetUserSkills (id);
var skills = SkillManager.FindSkill ("%");
var skills = SkillManager.FindSkill ("%",usp.MEACode);
ViewData ["SiteSkills"] = skills;
return View (usp);
}
@ -346,7 +346,8 @@ namespace Yavsc.Controllers
var result = new List<PerformerProfile> ();
foreach (string meacode in model.MEACodes) {
foreach (PerformerProfile profile in WorkFlowManager.FindPerformer(meacode)) {
foreach (PerformerProfile profile in WorkFlowManager.FindPerformer(meacode,null)) {
if (profile.HasCalendar())
try {
var events = ProfileBase.Create (profile.UserName).GetEvents (model.StartDate, model.EndDate);
if (events.items.Length == 0)
@ -376,25 +377,34 @@ namespace Yavsc.Controllers
/// <summary>
/// Booking the specified model.
/// </summary>
/// <param name="MEACode">MEA Code.</param>
/// <param name="model">Model.</param>
public ActionResult Booking (SimpleBookingQuery model)
{
// assert (model.MEACode!=null), since it's the required part of the route data
var needs = SkillManager.FindSkill ("%", model.MEACode);
var specification = new List<SkillRating> ();
ViewData ["Needs"] = needs;
if (model.Need != null) {
if (model.Need != "none")
foreach (string specitem in model.Need.Split(',')) {
string[] specvals = specitem.Split (' ');
specification.Add (new SkillRating () { Id = long.Parse (specvals [0]),
Rate = int.Parse (specvals [1])
});
}
}
// In order to present this form
// with no need selected and without
// validation error display,
// we only check the need here, not at validation time.
// Although, the need is indeed cruxial requirement,
// but we already have got a MEA code
if (ModelState.IsValid)
if (model.Needs != null) {
if (ModelState.IsValid && model.Need!=null) {
var result = new List<PerformerAvailability> ();
foreach (PerformerProfile profile in WorkFlowManager.FindPerformer(model.MEACode)) {
foreach (PerformerProfile profile in WorkFlowManager.FindPerformer(model.MEACode,specification.ToArray()))
if (profile.HasCalendar ()) {
try {
var events = ProfileBase.Create (profile.UserName)
.GetEvents (
var events = ProfileBase.Create (profile.UserName).GetEvents (
model.PreferedDate.Date,
model.PreferedDate.AddDays (1).Date);
// TODO replace (events.items.Length == 0)
@ -406,17 +416,17 @@ namespace Yavsc.Controllers
}
} else
result.Add (profile.CreateAvailability (model.PreferedDate, false));
}
return View ("Performers", result.ToArray ());
} else {
// A first Get
var needs = SkillManager.FindSkill ("%", model.MEACode);
ViewData ["Needs"] = needs;
model.Needs = needs.Select (
x => string.Format ("{0}:{1}", x.Id, x.Rate)).ToArray ();
}
if (model.Need==null) {
// A first Get, or no skill available
model.Need =
string.Join(",", needs.Select (x => string.Format ("{0}:{1}", x.Id, x.Rate)).ToArray ());
if (string.IsNullOrWhiteSpace (model.Need))
model.Need = "none";
}
var activity = WorkFlowManager.GetActivity (model.MEACode);
ViewData ["Activity"] = activity;
ViewData ["Title"] = activity.Title;

View File

@ -299,23 +299,33 @@ namespace Yavsc.Helpers
/// </summary>
/// <returns>The page links.</returns>
/// <param name="helper">Helper.</param>
/// <param name="ResultCount">Result count.</param>
/// <param name="PageSize">Page size.</param>
/// <param name="PageIndex">Page index.</param>
/// <param name="PageSize">Page size.</param>
/// <param name="ResultCount">Result count.</param>
/// <param name="args">Arguments.</param>
/// <param name="pagesLabel">Pages label.</param>
/// <param name="singlePage">Single page.</param>
/// <param name="none">None.</param>
/// <param name="cssClass">Css class.</param>
public static IHtmlString RenderPageLinks (
this HtmlHelper helper,
int PageIndex, int PageSize, int ResultCount,
string args="?PageIndex={0}",
string pagesLabel="Pages: ", string singlePage="",
string none="néant"
string none="néant", string cssClass = "pagelink"
)
{
StringWriter strwr = new StringWriter ();
HtmlTextWriter writer = new HtmlTextWriter(strwr);
if (PageSize <= 0)
PageSize = 0;
if (ResultCount > 0 && ResultCount > PageSize ) {
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
if (cssClass!=null)
writer.AddAttribute ("class", cssClass);
writer.RenderBeginTag ("div");
writer.WriteEncodedText (pagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
@ -329,6 +339,7 @@ namespace Yavsc.Helpers
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
writer.RenderEndTag ();
}
else {
writer.Write (singlePage);

View File

@ -18,7 +18,7 @@ if (((int) ViewData["ResultCount"]) > ((int) ViewData["PageSize"])) {
rp1.PageIndex = (int) ViewData["PageIndex"];
rp1.PageSize = (int) ViewData["PageSize"];
%><aside><form runat="server" id="form1">
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" CssClass="pagelink" runat="server">
<None><i>Pas de contenu</i></None>
</yavsc:ResultPages>
</form>

View File

@ -30,13 +30,14 @@
<%= Html.Hidden("MEACode") %>
<fieldset>
<legend><%= Html.Translate("YourNeed") %></legend>
<input type="hidden" name="Needs" id="Needs" value="">
<ul>
<% foreach (var need in (SkillEntity[])(ViewData["Needs"])) { %>
<li><%= need.Name %> <%= Html.Partial("RateSkillControl", need)%></li>
<input type="hidden" name="Need" id="Need" value="">
<ul >
<% if (ViewData ["Needs"]!=null)
foreach (var need in (SkillEntity[])(ViewData ["Needs"])) { %>
<li class="skillname"><%= need.Name %> <%= Html.Partial("RateSkillControl", need)%></li>
<% } %>
</ul>
<%= Html.ValidationMessageFor(model=>model.Needs) %>
<%= Html.ValidationMessageFor(model=>model.Need) %>
</fieldset>
<fieldset>
<legend><%= Html.Translate("PerformanceDate") %></legend>
@ -46,12 +47,10 @@ Intervention souhaitée le
</fieldset>
<script>
$(document).ready(function(){
var needs = <%= Ajax.JSonString((SkillEntity[])(ViewData["Needs"])) %>;
var fneeds = needs.map( function (need) {
return need.Id+' '+need.Rate; } );
fneeds.forEach(function(elt) { console.log(Yavsc.dumpprops(elt)) } );
$('#Needs').val(fneeds);
var needs = <%= Ajax.JSonString((SkillEntity[])(ViewData ["Needs"])) %>;
var fneeds = [];
needs.forEach(function(elt) { fneeds.push (''+elt.Id+' '+elt.Rate); } );
if (needs.length>0) $('#Need').val(fneeds); else $('#Need').val('none');
$('[data-type="rate-site-skill"]').rate({jsTarget: function (rating)
{
// console.log(Yavsc.dumpprops(rating));

View File

@ -1,3 +1,32 @@
2015-11-30 Paul Schneider <paul@pschneider.fr>
* PerformerProfile.cs: doc xml
* SimpleBookingQuery.cs:
* AuthentificatedSkillRating.cs: refabrication
* 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
2015-11-28 Paul Schneider <paul@pschneider.fr>
* SkillManager.cs:

View File

@ -92,16 +92,25 @@ namespace Yavsc.Model.FrontOffice
return yavscCLientProfile;
}
}
/// <summary>
/// Gets or sets the E mail.
/// </summary>
/// <value>The E mail.</value>
public string EMail {
get ;
set;
}
/// <summary>
/// Gets the google reg identifier.
/// </summary>
/// <value>The google reg identifier.</value>
public string GoogleRegId {
get { return YavscClientProfile.GoogleRegId; }
}
/// <summary>
/// Gets the google cal identifier.
/// </summary>
/// <value>The google cal identifier.</value>
public string GoogleCalId {
get { return YavscClientProfile.GoogleCalendar; }
}
@ -125,14 +134,19 @@ namespace Yavsc.Model.FrontOffice
}
}
/// <summary>
/// Gets or sets the MEA code.
/// </summary>
/// <value>The MEA code.</value>
[Required]
public string MEACode { get; set; }
/// <summary>
/// Determines whether this instance has calendar.
/// </summary>
/// <returns><c>true</c> if this instance has calendar; otherwise, <c>false</c>.</returns>
public bool HasCalendar ()
{
return (YavscClientProfile.GoogleCalendar != null);
return !string.IsNullOrWhiteSpace( YavscClientProfile.GoogleCalendar );
}
/// <summary>

View File

@ -32,8 +32,9 @@ namespace Yavsc.Model.FrontOffice
public class SimpleBookingQuery: Command
{
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.FrontOffice.SimpleBookingQuery"/> class.
/// Gets or sets the MEA code.
/// </summary>
/// <value>The MEA code.</value>
[Required(ErrorMessageResourceName="MEACode",ErrorMessageResourceType=typeof(LocalizedText))]
public string MEACode {
get;
@ -52,8 +53,8 @@ namespace Yavsc.Model.FrontOffice
/// Gets or sets the needs.
/// </summary>
/// <value>The needs.</value>
[Display(ResourceType=typeof(LocalizedText),Name="Needs")]
public string[] Needs { get; set; }
[Display(ResourceType=typeof(LocalizedText),Name="Need")]
public string Need { get; set; }
}

View File

@ -142,9 +142,9 @@ namespace Yavsc.Model {
}
}
public static string My_Estimates {
public static string AnIMessageHasbeenSent {
get {
return ResourceManager.GetString("My_Estimates", resourceCulture);
return ResourceManager.GetString("AnIMessageHasbeenSent", resourceCulture);
}
}
@ -190,6 +190,12 @@ namespace Yavsc.Model {
}
}
public static string Performers {
get {
return ResourceManager.GetString("Performers", resourceCulture);
}
}
public static string Members {
get {
return ResourceManager.GetString("Members", resourceCulture);
@ -388,6 +394,18 @@ namespace Yavsc.Model {
}
}
public static string Need {
get {
return ResourceManager.GetString("Need", resourceCulture);
}
}
public static string YourNeed {
get {
return ResourceManager.GetString("YourNeed", resourceCulture);
}
}
public static string Location {
get {
return ResourceManager.GetString("Location", resourceCulture);
@ -490,9 +508,9 @@ namespace Yavsc.Model {
}
}
public static string YourNeed {
public static string Non_existent_user {
get {
return ResourceManager.GetString("YourNeed", resourceCulture);
return ResourceManager.GetString("Non_existent_user", resourceCulture);
}
}
@ -622,6 +640,12 @@ namespace Yavsc.Model {
}
}
public static string NoSkillforthisactivity {
get {
return ResourceManager.GetString("NoSkillforthisactivity", resourceCulture);
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);
@ -712,21 +736,15 @@ namespace Yavsc.Model {
}
}
public static string AnIMessageHasbeenSent {
get {
return ResourceManager.GetString("AnIMessageHasbeenSent", resourceCulture);
}
}
public static string Profile_edition {
get {
return ResourceManager.GetString("Profile_edition", resourceCulture);
}
}
public static string Non_existent_user {
public static string My_Estimates {
get {
return ResourceManager.GetString("Non_existent_user", resourceCulture);
return ResourceManager.GetString("My_Estimates", resourceCulture);
}
}

View File

@ -184,6 +184,12 @@ namespace Yavsc.Model {
}
}
public static string Performers {
get {
return ResourceManager.GetString("Performers", resourceCulture);
}
}
public static string Members {
get {
return ResourceManager.GetString("Members", resourceCulture);
@ -382,9 +388,15 @@ namespace Yavsc.Model {
}
}
public static string My_Estimates {
public static string Need {
get {
return ResourceManager.GetString("My_Estimates", resourceCulture);
return ResourceManager.GetString("Need", resourceCulture);
}
}
public static string YourNeed {
get {
return ResourceManager.GetString("YourNeed", resourceCulture);
}
}
@ -484,9 +496,9 @@ namespace Yavsc.Model {
}
}
public static string YourNeed {
public static string My_Estimates {
get {
return ResourceManager.GetString("YourNeed", resourceCulture);
return ResourceManager.GetString("My_Estimates", resourceCulture);
}
}
@ -610,6 +622,12 @@ namespace Yavsc.Model {
}
}
public static string NoSkillforthisactivity {
get {
return ResourceManager.GetString("NoSkillforthisactivity", resourceCulture);
}
}
public static string Hide_source {
get {
return ResourceManager.GetString("Hide_source", resourceCulture);

View File

@ -71,9 +71,11 @@
<data name="Modify"><value>Modifier</value></data>
<data name="My_Estimates"><value>Mes estimations</value></data>
<data name="Name"><value>Nom</value></data>
<data name="Needs"><value>Besoin</value></data>
<data name="Needs"><value>Besoins</value></data>
<data name="Need"><value>Besoin</value></data>
<data name="New_Tag"><value>Nouveau Tag</value></data>
<data name="no_content"><value>pas de contenu</value></data>
<data name="NoSkillforthisactivity"><value>Aucune compétence n'a été enregistrée par aucun préstataire pour cette activité</value></data>
<data name="none"><value>aucun(e)</value></data>
<data name="Non_existent_user"><value>Non existent user</value></data>
<data name="Not Approuved"><value>Non approuvé</value></data>
@ -82,6 +84,7 @@
<data name="Online"><value>En ligne</value></data>
<data name="Pdf_version"><value>Version Pdf</value></data>
<data name="PerformanceDate"><value>Date de la prestation</value></data>
<data name="Performers"><value>Perstataires</value></data>
<data name="Person"><value>Personne</value></data>
<data name="Photo"><value>Photo</value></data>
<data name="PhotoUpdated"><value>Photo mise à jour</value></data>

View File

@ -76,8 +76,10 @@
<data name="Modify"><value>Modify</value></data>
<data name="My_Estimates"><value>My estimates</value></data>
<data name="Needs"><value>Needs</value></data>
<data name="Need"><value>Need</value></data>
<data name="New_Tag"><value>New Tag</value></data>
<data name="no_content"><value>no content</value></data>
<data name="NoSkillforthisactivity"><value>No skill was informed by any performer for this activity</value></data>
<data name="none"><value>none</value></data>
<data name="Non_existent_user"><value>Non existent user</value></data>
<data name="Not_Approuved"><value>Not Approuved</value></data>
@ -86,6 +88,7 @@
<data name="Offline"><value>Offline</value></data>
<data name="Pdf_version"><value>Pdf version</value></data>
<data name="PerformanceDate"><value>Performance Date</value></data>
<data name="Performers"><value>Performers</value></data>
<data name="Person"><value>Person</value></data>
<data name="Photo"><value>Photo</value></data>
<data name="PhotoUpdated"><value>Photo updated</value></data>

View File

@ -169,8 +169,15 @@ namespace Yavsc.Model.RolesAndMembers
/// <value>The google calendar.</value>
[Display(Name="Google_calendar",ResourceType=typeof(LocalizedText))]
public string GoogleCalendar { get; set; }
/// <summary>
/// Gets or sets the google registration identifier.
/// </summary>
/// <value>The google reg identifier.</value>
[Display(Name="Google_registration_id",ResourceType=typeof(LocalizedText))]
public string GoogleRegId { get; set; }
public string GoogleRegId {
get; set;
}
/// <summary>
/// Gets a value indicating whether this instance has bank account.

View File

@ -22,22 +22,12 @@ using System;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill rating.
/// </summary>
public class SkillRating : IRating, IAuthorized
public class AuthentificatedSkillRating : SkillRating, IAuthorized
{
/// <summary>
/// Gets or sets the skill identifier.
/// </summary>
/// <value>The skill identifier.</value>
public long Id { get;set ; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
public int Rate { get; set; }
/// <summary>
/// Gets or sets the author.

View File

@ -24,18 +24,21 @@ using System.Configuration;
using System.Reflection;
using System.Configuration.Provider;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Yavsc.Model.Skill
{
/// <summary>
/// Skill.
/// </summary>
[DataContract]
public class SkillEntity : IRating {
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
[DataMember]
public long Id { get; set; }
/// <summary>
@ -43,6 +46,7 @@ namespace Yavsc.Model.Skill
/// </summary>
/// <value>The MEA code.</value>
[Required(ErrorMessageResourceName="MEACode",ErrorMessageResourceType=typeof(LocalizedText))]
[DataMember]
public string MEACode { get; set; }
/// <summary>
@ -50,12 +54,14 @@ namespace Yavsc.Model.Skill
/// </summary>
/// <value>The name.</value>
[Required(ErrorMessage = "Please, specify a skill name")]
[DataMember]
public string Name { get; set; }
/// <summary>
/// Gets or sets the rate.
/// </summary>
/// <value>The rate.</value>
[DataMember]
public int Rate { get; set; }
}

View File

@ -77,7 +77,7 @@ namespace Yavsc.Model.Skill
/// </summary>
/// <param name="username">Username.</param>
/// <param name="skill">Skill.</param>
public static void RateSkill(string username, SkillRating skill) {
public static void RateSkill(string username, AuthentificatedSkillRating skill) {
DefaultProvider.Rate(skill);
}
@ -86,6 +86,7 @@ namespace Yavsc.Model.Skill
/// </summary>
/// <returns>The skill identifier.</returns>
/// <param name="pattern">Pattern.</param>
/// <param name="MEACode">code APE.</param>
public static SkillEntity [] FindSkill(string pattern, string MEACode=null){
return DefaultProvider.FindSkill(pattern, MEACode);
}
@ -94,9 +95,10 @@ namespace Yavsc.Model.Skill
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public static string [] FindPerformer(long [] skillIds) {
return DefaultProvider.FindPerformer(skillIds);
/// <param name="MEACode">MEA Code.</param>
/// <param name="skills">skills.</param>
public static string [] FindPerformer(string MEACode, SkillRating [] skills) {
return DefaultProvider.FindPerformer(MEACode, skills);
}
/// <summary>
/// Deletes the skill.

View File

@ -51,13 +51,14 @@ namespace Yavsc.Model.Skill
/// Rate the specified skill.
/// </summary>
/// <param name="skill">Skill.</param>
public abstract void Rate(SkillRating skill) ;
public abstract void Rate(AuthentificatedSkillRating skill) ;
/// <summary>
/// Finds the skill identifier.
/// </summary>
/// <returns>The skill identifier.</returns>
/// <param name="pattern">Pattern.</param>
/// <param name="MEACode">MEA code.</param>
public abstract SkillEntity [] FindSkill(string pattern, string MEACode);
/// <summary>
@ -71,8 +72,9 @@ namespace Yavsc.Model.Skill
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="skillIds">Skill identifiers.</param>
public abstract string [] FindPerformer(long []skillIds);
/// <param name="MEACode">MEA code.</param>
/// <param name="need">Need.</param>
public abstract string [] FindPerformer(string MEACode, SkillRating [] need);
/// <summary>
/// Deletes the skill.

View File

@ -6,6 +6,8 @@ using Yavsc.Model.FrontOffice;
using System.Configuration.Provider;
using Yavsc.Model.FrontOffice.Catalog;
using System.Collections.Generic;
using Yavsc.Model.Skill;
using System.Linq;
namespace Yavsc.Model.WorkFlow
{
@ -17,15 +19,6 @@ namespace Yavsc.Model.WorkFlow
/// </summary>
public static class WorkFlowManager
{
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="MEACode">MEA code.</param>
public static PerformerProfile [] FindPerformer(string MEACode)
{
return DefaultProvider.FindPerformer (MEACode);
}
/// <summary>
/// Finds the activity.
@ -44,6 +37,21 @@ namespace Yavsc.Model.WorkFlow
return activities.ToArray();
}
/// <summary>
/// Finds the performer.
/// </summary>
/// <returns>The performer.</returns>
/// <param name="MEACode">MEA code.</param>
/// <param name="skills">Skills.</param>
public static PerformerProfile [] FindPerformer (string MEACode, SkillRating[] skills)
{
string[] usernames = SkillManager.FindPerformer (MEACode, skills);
List<PerformerProfile> result = new List<PerformerProfile> ();
foreach (string user in usernames)
result.Add (SkillManager.GetUserSkills (user));
return result.ToArray ();
}
/// <summary>
/// Gets the activity.
/// </summary>
@ -168,7 +176,11 @@ namespace Yavsc.Model.WorkFlow
return defaultProvider;
}
}
/// <summary>
/// Drops the writting tag.
/// </summary>
/// <param name="wrid">Wrid.</param>
/// <param name="tag">Tag.</param>
public static void DropWrittingTag (long wrid, string tag)
{
throw new NotImplementedException ();
@ -250,7 +262,12 @@ namespace Yavsc.Model.WorkFlow
{
return DefaultProvider.GetCommands (username);
}
/// <summary>
/// Registers the activity.
/// </summary>
/// <param name="activityName">Activity name.</param>
/// <param name="meacode">Meacode.</param>
/// <param name="comment">Comment.</param>
public static void RegisterActivity (string activityName, string meacode, string comment)
{
DefaultProvider.RegisterActivity (activityName, meacode, comment);

View File

@ -206,7 +206,6 @@
<Compile Include="RolesAndMembers\UserRole.cs" />
<Compile Include="RolesAndMembers\UserNameBase.cs" />
<Compile Include="Calendar\BookingQuery.cs" />
<Compile Include="Skill\SkillRating.cs" />
<Compile Include="Skill\SkillProvider.cs" />
<Compile Include="Skill\SkillManager.cs" />
<Compile Include="Skill\UserSkill.cs" />
@ -240,6 +239,8 @@
<Compile Include="Google\Api\Messaging\Notification.cs" />
<Compile Include="SimpleJsonPostMethod.cs" />
<Compile Include="FrontOffice\PerformerAvailability.cs" />
<Compile Include="Skill\AuthentificatedSkillRating.cs" />
<Compile Include="Skill\SkillRating.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>