From d430d7391541d72a0d848fa20b24bf339dd17189 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 23 Nov 2015 12:48:59 +0100 Subject: [PATCH] Nettoyages et refactorisations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ITitle.cs: * RssFeeds.cs: * Blog.cs: * BasePost.cs: * YaEvent.cs: * Estimate.cs: * BaseEvent.cs: * Activity.cs: * UTBlogEntryCollection.cs: * UUTBlogEntryCollection.cs: refactorisation: Les titres obtiennent une interface logicielle dédiée. * ErrorHtmlFormatter.cs: Pour note: conception à revoir * PerformerProfile.cs: refactorisation: Les identifiant deviennent génériques * IRating.cs: * IComment.cs: * IIdentified.cs: refactorisation: Les identifiant et commentaires deviennent génériques * ITagBackup.cs: refactorisation: un meilleur nom pour cette interface qui n'a pas encore d'implementeur. * UserNameBase.cs: xml doc * UserSkill.cs: * UserSkillComment.cs: Les commentaire deviennent génériques * OtherWebException.cs: classe obsolete * ViewRenderer.cs: classe obsolète * YavscModel.csproj: nettoyages de classes obsoletes, ajout des nouvelles interfaces et de la classe de base implementant l' "activité". --- web/ChangeLog | 4 + web/Formatters/ErrorHtmlFormatter.cs | 1 + yavscModel/Blogs/BasePost.cs | 2 +- yavscModel/Blogs/Blog.cs | 2 +- yavscModel/Blogs/UTBlogEntryCollection.cs | 5 +- yavscModel/Blogs/UUTBlogEntryCollection.cs | 5 +- yavscModel/Calendar/BaseEvent.cs | 70 +++++++++++++++++ yavscModel/Calendar/YaEvent.cs | 40 ---------- yavscModel/ChangeLog | 38 ++++++++++ yavscModel/FrontOffice/Activity.cs | 49 ++++++++++++ yavscModel/FrontOffice/PerformerProfile.cs | 2 +- yavscModel/IComment.cs | 2 +- yavscModel/IIdentified.cs | 4 +- yavscModel/IRating.cs | 2 +- yavscModel/{ITagHandler.cs => ITagBackup.cs} | 7 +- yavscModel/{IViewRenderer.cs => ITitle.cs} | 27 ++----- yavscModel/OtherWebException.cs | 79 -------------------- yavscModel/RolesAndMembers/UserNameBase.cs | 3 + yavscModel/RssFeeds.cs | 2 +- yavscModel/Skill/UserSkill.cs | 2 +- yavscModel/Skill/UserSkillComment.cs | 2 +- yavscModel/ViewRenderer.cs | 70 ----------------- yavscModel/WorkFlow/Estimate.cs | 2 +- yavscModel/YavscModel.csproj | 8 +- 24 files changed, 195 insertions(+), 233 deletions(-) create mode 100644 yavscModel/Calendar/BaseEvent.cs create mode 100644 yavscModel/FrontOffice/Activity.cs rename yavscModel/{ITagHandler.cs => ITagBackup.cs} (92%) rename yavscModel/{IViewRenderer.cs => ITitle.cs} (62%) delete mode 100644 yavscModel/OtherWebException.cs delete mode 100644 yavscModel/ViewRenderer.cs diff --git a/web/ChangeLog b/web/ChangeLog index 521b6f18..3ba09d81 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,7 @@ +2015-11-23 Paul Schneider + + * ErrorHtmlFormatter.cs: Pour note: conception à revoir + 2015-11-23 Paul Schneider * FrontOfficeController.cs: Démarre l'implementation des diff --git a/web/Formatters/ErrorHtmlFormatter.cs b/web/Formatters/ErrorHtmlFormatter.cs index e8b4ddcd..13d9bcb2 100644 --- a/web/Formatters/ErrorHtmlFormatter.cs +++ b/web/Formatters/ErrorHtmlFormatter.cs @@ -59,6 +59,7 @@ namespace Yavsc.Formatters public ErrorHtmlFormatter (HttpStatusCode errorCode, string title):base("text/html") { + // FIXME this is not a place for this property ErrorCode = errorCode; Title = title; diff --git a/yavscModel/Blogs/BasePost.cs b/yavscModel/Blogs/BasePost.cs index 2195665b..1c930a50 100644 --- a/yavscModel/Blogs/BasePost.cs +++ b/yavscModel/Blogs/BasePost.cs @@ -33,7 +33,7 @@ namespace Yavsc.Model.Blogs /// /// Base post. /// - public class BasePost: IRating { + public class BasePost: IRating, ITitle { /// /// The identifier. /// diff --git a/yavscModel/Blogs/Blog.cs b/yavscModel/Blogs/Blog.cs index 0a542178..506bf951 100644 --- a/yavscModel/Blogs/Blog.cs +++ b/yavscModel/Blogs/Blog.cs @@ -8,7 +8,7 @@ namespace Yavsc.Model.Blogs /// /// Blog. /// - public class Blog + public class Blog: ITitle { string title; diff --git a/yavscModel/Blogs/UTBlogEntryCollection.cs b/yavscModel/Blogs/UTBlogEntryCollection.cs index ec0bd32d..034290d1 100644 --- a/yavscModel/Blogs/UTBlogEntryCollection.cs +++ b/yavscModel/Blogs/UTBlogEntryCollection.cs @@ -26,7 +26,7 @@ namespace Yavsc.Model.Blogs /// /// Unique User and Title blog entry collection. /// - public class UTBlogEntryCollection : BlogEntryCollection { + public class UTBlogEntryCollection : BlogEntryCollection, ITitle { /// /// Initializes a new instance of the class. @@ -41,7 +41,8 @@ namespace Yavsc.Model.Blogs /// Gets the title. /// /// The title. - public string Title { get { return _title; } } + public string Title { get { return _title; } + set { _title = value; } } /// /// Returns a that represents the current . diff --git a/yavscModel/Blogs/UUTBlogEntryCollection.cs b/yavscModel/Blogs/UUTBlogEntryCollection.cs index 3245f902..d61e67a9 100644 --- a/yavscModel/Blogs/UUTBlogEntryCollection.cs +++ b/yavscModel/Blogs/UUTBlogEntryCollection.cs @@ -26,7 +26,7 @@ namespace Yavsc.Model.Blogs /// /// Unique User and Title blog entry collection. /// - public class UUTBlogEntryCollection : UUBlogEntryCollection { + public class UUTBlogEntryCollection : UUBlogEntryCollection, ITitle { /// /// Initializes a new instance of the class. /// @@ -41,7 +41,8 @@ namespace Yavsc.Model.Blogs /// Gets the title. /// /// The title. - public string Title { get { return _title; } } + public string Title { get { return _title; } + set { _title = value; } } /// /// Returns a that represents the current . diff --git a/yavscModel/Calendar/BaseEvent.cs b/yavscModel/Calendar/BaseEvent.cs new file mode 100644 index 00000000..e74718a6 --- /dev/null +++ b/yavscModel/Calendar/BaseEvent.cs @@ -0,0 +1,70 @@ +// +// BaseEvent.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 GNU GPL +// +// 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 . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; +using Yavsc.Model; + +namespace Yavsc.Model.Calendar +{ + /// + /// Base event. + /// + public class BaseEvent: ITitle + { + /// + /// The title. + /// + [Required(ErrorMessage="Please, choose a .")] + [Display(ResourceType=typeof(LocalizedText),Name="Title")] + public string Title { get; set; } + /// + /// The description. + /// + [Required(ErrorMessage="Please, choose a Description.")] + [Display(ResourceType=typeof(LocalizedText),Name="Description")] + public string Description { get; set; } + + /// + /// The location. + /// + [Required(ErrorMessage="Please, choose a Location.")] + [Display(ResourceType=typeof(LocalizedText),Name="Location")] + public Position Location { get; set; } + /// + /// The start date. + /// + [Required(ErrorMessage="Please, choose a Start Date.")] + [Display(ResourceType=typeof(LocalizedText),Name="StartDate")] + public DateTime StartDate { get; set; } + + /// + /// Gets or sets the end date. + /// + /// The end date. + [Required(ErrorMessage="Please, choose an End Date.")] + [Display(ResourceType=typeof(LocalizedText),Name="EndDate")] + public DateTime EndDate { get; set; } + + } + +} diff --git a/yavscModel/Calendar/YaEvent.cs b/yavscModel/Calendar/YaEvent.cs index dd3571c7..7b38cf4d 100644 --- a/yavscModel/Calendar/YaEvent.cs +++ b/yavscModel/Calendar/YaEvent.cs @@ -26,46 +26,6 @@ using Yavsc.Model; namespace Yavsc.Model.Calendar { - /// - /// Base event. - /// - public class BaseEvent - { - /// - /// The title. - /// - [Required(ErrorMessage="Please, choose a .")] - [Display(ResourceType=typeof(LocalizedText),Name="Title")] - public string Title { get; set; } - /// - /// The description. - /// - [Required(ErrorMessage="Please, choose a Description.")] - [Display(ResourceType=typeof(LocalizedText),Name="Description")] - public string Description { get; set; } - - /// - /// The location. - /// - [Required(ErrorMessage="Please, choose a Location.")] - [Display(ResourceType=typeof(LocalizedText),Name="Location")] - public Position Location { get; set; } - /// - /// The start date. - /// - [Required(ErrorMessage="Please, choose a Start Date.")] - [Display(ResourceType=typeof(LocalizedText),Name="StartDate")] - public DateTime StartDate { get; set; } - - /// - /// Gets or sets the end date. - /// - /// The end date. - [Required(ErrorMessage="Please, choose an End Date.")] - [Display(ResourceType=typeof(LocalizedText),Name="EndDate")] - public DateTime EndDate { get; set; } - - } /// /// NF event. /// diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index 1e0bf96b..37ec1c2b 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,41 @@ +2015-11-23 Paul Schneider + + * ITitle.cs: + * RssFeeds.cs: + * Blog.cs: + * BasePost.cs: + * YaEvent.cs: + * Estimate.cs: + * BaseEvent.cs: + * Activity.cs: + * UTBlogEntryCollection.cs: + * UUTBlogEntryCollection.cs: refactorisation: Les titres + obtiennent une interface logicielle dédiée. + + * PerformerProfile.cs: refactorisation: Les identifiant + deviennent génériques + + * IRating.cs: + * IComment.cs: + * IIdentified.cs: refactorisation: Les identifiant et + commentaires deviennent génériques + + * ITagBackup.cs: refactorisation: un meilleur nom pour cette + interface qui n'a pas encore d'implementeur. + + * UserNameBase.cs: xml doc + + * UserSkill.cs: + * UserSkillComment.cs: Les commentaire deviennent génériques + + * OtherWebException.cs: classe obsolete + + * ViewRenderer.cs: classe obsolète + + * YavscModel.csproj: nettoyages de classes obsoletes, ajout + des nouvelles interfaces et de la classe de base implementant + l' "activité". + 2015-11-23 Paul Schneider * SimpleBookingQuery.cs: Implémente une simple commande de diff --git a/yavscModel/FrontOffice/Activity.cs b/yavscModel/FrontOffice/Activity.cs new file mode 100644 index 00000000..041e1c6e --- /dev/null +++ b/yavscModel/FrontOffice/Activity.cs @@ -0,0 +1,49 @@ +// +// Activity.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 GNU GPL +// +// 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 . +using System; + +namespace Yavsc.Model.FrontOffice +{ + public class Activity: IComment, ITitle + { + #region ITitle implementation + public string Title { + get; + set; + } + #endregion + + #region IComment implementation + public string Comment { + get; + set; + } + #endregion + #region IIdentified implementation + public string Id { + get; + set; + } + #endregion + + } +} + diff --git a/yavscModel/FrontOffice/PerformerProfile.cs b/yavscModel/FrontOffice/PerformerProfile.cs index 95e2b44e..0dd5906e 100644 --- a/yavscModel/FrontOffice/PerformerProfile.cs +++ b/yavscModel/FrontOffice/PerformerProfile.cs @@ -34,7 +34,7 @@ namespace Yavsc.Model.FrontOffice /// /// Performer profile. /// - public class PerformerProfile: UserNameBase, IRating, IIdentified + public class PerformerProfile: UserNameBase, IRating, IIdentified { /// /// Initializes a new instance of the class. diff --git a/yavscModel/IComment.cs b/yavscModel/IComment.cs index f9fd738e..711f74cc 100644 --- a/yavscModel/IComment.cs +++ b/yavscModel/IComment.cs @@ -24,7 +24,7 @@ using System; namespace Yavsc.Model { - public interface IComment: IIdentified { + public interface IComment: IIdentified { string Comment { get; set; } } } diff --git a/yavscModel/IIdentified.cs b/yavscModel/IIdentified.cs index 34bb0403..39c00bb8 100644 --- a/yavscModel/IIdentified.cs +++ b/yavscModel/IIdentified.cs @@ -22,9 +22,9 @@ using System; namespace Yavsc.Model { - public interface IIdentified + public interface IIdentified { - long Id { get; set; } + T Id { get; set; } } } diff --git a/yavscModel/IRating.cs b/yavscModel/IRating.cs index 213c241c..db61c0b6 100644 --- a/yavscModel/IRating.cs +++ b/yavscModel/IRating.cs @@ -26,7 +26,7 @@ namespace Yavsc.Model /// /// I rating. /// - public interface IRating: IIdentified + public interface IRating: IIdentified { /// /// Gets or sets the rate. diff --git a/yavscModel/ITagHandler.cs b/yavscModel/ITagBackup.cs similarity index 92% rename from yavscModel/ITagHandler.cs rename to yavscModel/ITagBackup.cs index 0e19c46a..da3be5d1 100644 --- a/yavscModel/ITagHandler.cs +++ b/yavscModel/ITagBackup.cs @@ -30,7 +30,7 @@ namespace Yavsc.Model /// /// I tag handler. /// - public interface ITagHandler { + public interface ITagBackup { /// /// Backup this instance. /// Should set ViewData["Tags"] with @@ -43,11 +43,6 @@ namespace Yavsc.Model /// void Restore(); - /// - /// Invoke this instance. - /// - void Invoke(); - /// /// Gets or sets the name. /// diff --git a/yavscModel/IViewRenderer.cs b/yavscModel/ITitle.cs similarity index 62% rename from yavscModel/IViewRenderer.cs rename to yavscModel/ITitle.cs index a5bae042..11a4b426 100644 --- a/yavscModel/IViewRenderer.cs +++ b/yavscModel/ITitle.cs @@ -1,10 +1,10 @@ -// -// IViewRenderer.cs +// +// ITitle.cs // // Author: -// Paul Schneider +// Paul Schneider // -// Copyright (c) 2015 Paul Schneider +// Copyright (c) 2015 GNU GPL // // 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 @@ -18,24 +18,13 @@ // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . - using System; -using System.Configuration; -using System.Collections.Specialized; -using System.Data; -using System.Web.Mvc; namespace Yavsc.Model { - /// - /// I view renderer. - /// - public interface IViewRenderer : IRenderer { - /// - /// Gets the template route part. - /// - /// The template. - string Template { get; } + public interface ITitle + { + string Title { get; set; } } - } + diff --git a/yavscModel/OtherWebException.cs b/yavscModel/OtherWebException.cs deleted file mode 100644 index 28305a83..00000000 --- a/yavscModel/OtherWebException.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// JsonReaderError.cs -// -// Author: -// Paul Schneider -// -// 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 . -using System; -using System.Net; -using System.IO; -using Newtonsoft.Json; - -namespace Yavsc.Model -{ - /// - /// Google error exception. - /// - public class OtherWebException : WebException - { - /// - /// Gets or sets the title. - /// - /// The title. - public string Title { get; set; } - /// - /// Gets or sets the content. - /// - /// The content. - public string Content { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// Ex. - public OtherWebException (WebException ex) { - // ASSERT ex != null; - Title = ex.Message; - - using (var stream = ex.Response.GetResponseStream()) - using (var reader = new StreamReader(stream)) - { - Content = reader.ReadToEnd(); - } - } - /// - /// Initializes a new instance of the class. - /// - /// Ex. - /// Message. - [Obsolete] - public OtherWebException(Exception ex, string message) { - Content = message; - Title = ex.Message; - } - /// - /// Initializes a new instance of the class. - /// - /// Ex. - [Obsolete] - public OtherWebException(Exception ex) { - Content = ex.Message; - Title = ex.GetType().FullName; - } - } - -} - diff --git a/yavscModel/RolesAndMembers/UserNameBase.cs b/yavscModel/RolesAndMembers/UserNameBase.cs index f362566d..14cd579f 100644 --- a/yavscModel/RolesAndMembers/UserNameBase.cs +++ b/yavscModel/RolesAndMembers/UserNameBase.cs @@ -25,6 +25,9 @@ using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.RolesAndMembers { + /// + /// User name base. + /// public class UserNameBase { /// /// Gets or sets the name of the user. diff --git a/yavscModel/RssFeeds.cs b/yavscModel/RssFeeds.cs index 4b64eb6d..be00647f 100644 --- a/yavscModel/RssFeeds.cs +++ b/yavscModel/RssFeeds.cs @@ -25,7 +25,7 @@ namespace Yavsc.Model /// /// Rss feeds entry. /// - public class RssFeedsEntry { + public class RssFeedsEntry: ITitle { /// /// Gets or sets the title. /// diff --git a/yavscModel/Skill/UserSkill.cs b/yavscModel/Skill/UserSkill.cs index 74416f37..2c5535e9 100644 --- a/yavscModel/Skill/UserSkill.cs +++ b/yavscModel/Skill/UserSkill.cs @@ -26,7 +26,7 @@ namespace Yavsc.Model.Skill /// /// User skill. /// - public class UserSkill : IComment, IRating + public class UserSkill : IComment, IRating { /// /// Gets or sets the identifier for this diff --git a/yavscModel/Skill/UserSkillComment.cs b/yavscModel/Skill/UserSkillComment.cs index 4294d14c..08418742 100644 --- a/yavscModel/Skill/UserSkillComment.cs +++ b/yavscModel/Skill/UserSkillComment.cs @@ -27,7 +27,7 @@ namespace Yavsc.Model.Skill /// /// User skill comment. /// - public class UserSkillComment: UserSkillReference, IComment + public class UserSkillComment: UserSkillReference, IComment { /// diff --git a/yavscModel/ViewRenderer.cs b/yavscModel/ViewRenderer.cs deleted file mode 100644 index a9cdeece..00000000 --- a/yavscModel/ViewRenderer.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// ViewRenderer.cs -// -// Author: -// Paul Schneider -// -// 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 . - -using System; -using System.Configuration; -using System.Collections.Specialized; -using System.Data; -using System.Web.Mvc; - -namespace Yavsc.Model -{ - /// - /// View renderer. - /// - public abstract class ViewRenderer : IViewRenderer { - #region IRenderer implementation - /// - /// Get the specified c. - /// - /// C. - public object Get (Controller c) - { - return Name; - } - - /// - /// Gets the template route part. - /// - /// The template. - public string Template { - get { - return "Tag.aspx"; - } - } - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - #endregion - - } - -} diff --git a/yavscModel/WorkFlow/Estimate.cs b/yavscModel/WorkFlow/Estimate.cs index b4fb0762..783bd949 100644 --- a/yavscModel/WorkFlow/Estimate.cs +++ b/yavscModel/WorkFlow/Estimate.cs @@ -8,7 +8,7 @@ namespace Yavsc.Model.WorkFlow /// Estimate. /// [Serializable] - public class Estimate + public class Estimate : ITitle { /// /// Initializes a new instance of the class. diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 3d72603e..f002e892 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -80,9 +80,6 @@ - - - @@ -123,7 +120,6 @@ - @@ -201,6 +197,10 @@ + + + +