* 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
196 lines
4.3 KiB
C#
196 lines
4.3 KiB
C#
using System;
|
|
using System.Web;
|
|
using System.Security.Permissions;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.ComponentModel;
|
|
using System.Collections;
|
|
|
|
namespace Yavsc.WebControls
|
|
{
|
|
/// <summary>
|
|
/// Result pages.
|
|
/// </summary>
|
|
[
|
|
AspNetHostingPermission (SecurityAction.Demand,
|
|
Level = AspNetHostingPermissionLevel.Minimal),
|
|
AspNetHostingPermission (SecurityAction.InheritanceDemand,
|
|
Level = AspNetHostingPermissionLevel.Minimal),
|
|
ParseChildren (true),
|
|
ToolboxData ("<{0}:ResultPages runat=\"server\"> </{0}:ResultPages>")
|
|
]
|
|
public class ResultPages: WebControl
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="Yavsc.WebControls.ResultPages"/> class.
|
|
/// </summary>
|
|
public ResultPages ()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the results per page.
|
|
/// </summary>
|
|
/// <value>The results per page.</value>
|
|
public int PageSize {
|
|
get {
|
|
return (int)( ViewState["PageSize"]==null?10:ViewState["PageSize"]);
|
|
}
|
|
set {
|
|
ViewState["PageSize"]=value;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Gets or sets the result count.
|
|
/// </summary>
|
|
/// <value>The result count.</value>
|
|
public int ResultCount {
|
|
get {
|
|
return (int)( ViewState["ResultCount"]==null?0:ViewState["ResultCount"]);
|
|
}
|
|
set {
|
|
ViewState["ResultCount"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the text.
|
|
/// </summary>
|
|
/// <value>The text.</value>
|
|
[DefaultValue("Pages:")]
|
|
[Localizable(true)]
|
|
public string Text {
|
|
get {
|
|
|
|
string s = (string)ViewState["Text"];
|
|
return (s == null) ? "Pages:" : s;
|
|
}
|
|
set {
|
|
ViewState["Text"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the action.
|
|
/// </summary>
|
|
/// <value>The action.</value>
|
|
[Bindable (true)]
|
|
[DefaultValue("?pageIndex=")]
|
|
public string Action {
|
|
get {
|
|
|
|
string s = (string)ViewState["Action"];
|
|
return (s == null) ? "?pageIndex=" : s;
|
|
}
|
|
set {
|
|
ViewState["Action"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Single page message.
|
|
/// </summary>
|
|
/// <value>The none.</value>
|
|
[Bindable (true)]
|
|
[DefaultValue("1")]
|
|
public string SinglePage {
|
|
get {
|
|
return (string) ViewState["SinglePage"];
|
|
}
|
|
set {
|
|
ViewState["SinglePage"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the none.
|
|
/// </summary>
|
|
/// <value>The none.</value>
|
|
[Bindable (true)]
|
|
[DefaultValue("none")]
|
|
public string None {
|
|
get {
|
|
return (string) ViewState["None"];
|
|
}
|
|
set {
|
|
ViewState["None"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Gets or sets the none.
|
|
/// </summary>
|
|
/// <value>The none.</value>
|
|
[Bindable (true)]
|
|
[DefaultValue("Pages: ")]
|
|
public string PagesLabel {
|
|
get {
|
|
return (string) ViewState["PagesLabel"];
|
|
}
|
|
set {
|
|
ViewState["PagesLabel"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Gets or sets the current page.
|
|
/// </summary>
|
|
/// <value>The current page.</value>
|
|
[Bindable (true)]
|
|
[DefaultValue(0)]
|
|
public int PageIndex {
|
|
get {
|
|
int i = (int)(ViewState["PageIndex"]==null?0:ViewState["PageIndex"]);
|
|
return i;
|
|
}
|
|
set {
|
|
ViewState["PageIndex"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Renders the contents as the list of links to pages of results.
|
|
/// </summary>
|
|
/// <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)
|
|
writer.RenderBeginTag ("b");
|
|
else {
|
|
writer.AddAttribute (HtmlTextWriterAttribute.Href,
|
|
string.Format (Action, pi));
|
|
writer.RenderBeginTag ("a");
|
|
}
|
|
writer.Write (pi + 1);
|
|
writer.RenderEndTag ();
|
|
writer.Write (" ");
|
|
}
|
|
RenderChildren (writer);
|
|
writer.RenderEndTag ();
|
|
}
|
|
else {
|
|
writer.Write (SinglePage);
|
|
}
|
|
}
|
|
if (ResultCount == 0) {
|
|
writer.Write (None);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|