diff --git a/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs b/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs index 06ac44f5..3aed8719 100644 --- a/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs +++ b/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs @@ -18,7 +18,7 @@ namespace Yavsc.Models.Billing public string GetInvoiceId() { return GetType().Name + "/" + Id; } public abstract long Id { get; set; } - public abstract string Description { get; } + public abstract string Description { get; set; } [Required()] public bool Consent { get; set; } diff --git a/Yavsc.Server/Models/HairCut/HairCutQuery.cs b/Yavsc.Server/Models/HairCut/HairCutQuery.cs index 4b407efd..a47a21b9 100644 --- a/Yavsc.Server/Models/HairCut/HairCutQuery.cs +++ b/Yavsc.Server/Models/HairCut/HairCutQuery.cs @@ -20,12 +20,19 @@ namespace Yavsc.Models.Haircut { // Bill description - public override string Description { get + string _description = null; + public override string Description { - string type = ResourcesHelpers.GlobalLocalizer[this.GetType().Name]; - string gender = ResourcesHelpers.GlobalLocalizer[this.Prestation.Gender.ToString()]; - return $"{type} ({gender})"; - } + get + { + string type = ResourcesHelpers.GlobalLocalizer[this.GetType().Name]; + string gender = ResourcesHelpers.GlobalLocalizer[this.Prestation.Gender.ToString()]; + return $"{_description} {type} ({gender})"; + } + set + { + _description = value; + } } @@ -73,34 +80,35 @@ namespace Yavsc.Models.Haircut List bill = new List(); - if (this.Prestation==null) throw new InvalidOperationException("Prestation property is null"); - if (this.SelectedProfile==null) throw new InvalidOperationException("SelectedProfile property is null"); + if (this.Prestation == null) throw new InvalidOperationException("Prestation property is null"); + if (this.SelectedProfile == null) throw new InvalidOperationException("SelectedProfile property is null"); // Le shampoing if (this.Prestation.Shampoo) - bill.Add(new CommandLine { Name = "Shampoing", Description="Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); + bill.Add(new CommandLine { Name = "Shampoing", Description = "Shampoing", UnitaryCost = SelectedProfile.ShampooPrice }); // la coupe - if (Prestation.Cut) { - bill.Add(new CommandLine + if (Prestation.Cut) + { + bill.Add(new CommandLine { Name = "Coupe", - Description = $"Coupe "+ - ResourcesHelpers.GlobalLocalizer[Prestation.Gender.ToString()]+ " "+ - (Prestation.Gender == HairCutGenders.Women ? - Prestation.Length == HairLength.Long ? longhairsuffix : - Prestation.Length == HairLength.HalfLong ? halflonghairsuffix : - shorthairsuffix: null), + Description = $"Coupe " + + ResourcesHelpers.GlobalLocalizer[Prestation.Gender.ToString()] + " " + + (Prestation.Gender == HairCutGenders.Women ? + Prestation.Length == HairLength.Long ? longhairsuffix : + Prestation.Length == HairLength.HalfLong ? halflonghairsuffix : + shorthairsuffix : null), UnitaryCost = Prestation.Gender == HairCutGenders.Women ? - Prestation.Length == HairLength.Long ? SelectedProfile.WomenLongCutPrice : - Prestation.Length == HairLength.HalfLong ? SelectedProfile.WomenHalfCutPrice : - SelectedProfile.WomenShortCutPrice : Prestation.Gender == HairCutGenders.Man ? - SelectedProfile.ManCutPrice : SelectedProfile.KidCutPrice + Prestation.Length == HairLength.Long ? SelectedProfile.WomenLongCutPrice : + Prestation.Length == HairLength.HalfLong ? SelectedProfile.WomenHalfCutPrice : + SelectedProfile.WomenShortCutPrice : Prestation.Gender == HairCutGenders.Man ? + SelectedProfile.ManCutPrice : SelectedProfile.KidCutPrice }); } - + // Les techniques switch (Prestation.Tech) { @@ -274,100 +282,104 @@ Prestation.Gender == HairCutGenders.Women ? switch (Prestation.Dressing) { case HairDressings.Brushing: - { - string name = "Brushing"; - - - switch (Prestation.Gender) { - case HairCutGenders.Women: - switch (Prestation.Length) - { - case HairLength.Long: - bill.Add(new CommandLine + string name = "Brushing"; + + + switch (Prestation.Gender) + { + case HairCutGenders.Women: + switch (Prestation.Length) { - Name = name, - Description = name + longhairsuffix, - UnitaryCost = SelectedProfile.LongBrushingPrice - }); - break; - case HairLength.HalfLong: + case HairLength.Long: + bill.Add(new CommandLine + { + Name = name, + Description = name + longhairsuffix, + UnitaryCost = SelectedProfile.LongBrushingPrice + }); + break; + case HairLength.HalfLong: + bill.Add(new CommandLine + { + Name = name, + Description = name + halflonghairsuffix, + UnitaryCost = SelectedProfile.HalfBrushingPrice + }); + break; + default: + bill.Add(new CommandLine + { + Name = name, + Description = name + shorthairsuffix, + UnitaryCost = SelectedProfile.ShortBrushingPrice + }); + break; + } + break; + case HairCutGenders.Man: bill.Add(new CommandLine - { - Name = name, - Description = name + halflonghairsuffix, - UnitaryCost = SelectedProfile.HalfBrushingPrice - }); - break; - default: - bill.Add(new CommandLine - { - Name = name, - Description = name + shorthairsuffix, - UnitaryCost = SelectedProfile.ShortBrushingPrice - }); - break; - } - break; - case HairCutGenders.Man: - bill.Add(new CommandLine { Name = name, Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ManBrushPrice }); - break; + break; } } break; case HairDressings.Coiffage: // est offert - /* bill.Add(new CommandLine - { - Name = "Coiffage (offert)", - UnitaryCost = 0m - }); */ + /* bill.Add(new CommandLine + { + Name = "Coiffage (offert)", + UnitaryCost = 0m + }); */ break; case HairDressings.Folding: - { - string name = "Mise en plis"; - - switch (Prestation.Length) { - case HairLength.Long: + string name = "Mise en plis"; + + switch (Prestation.Length) + { + case HairLength.Long: bill.Add(new CommandLine { Name = name, Description = name + longhairsuffix, UnitaryCost = SelectedProfile.LongFoldingPrice }); - break; - case HairLength.HalfLong: + break; + case HairLength.HalfLong: bill.Add(new CommandLine { Name = name, Description = name + halflonghairsuffix, UnitaryCost = SelectedProfile.HalfFoldingPrice }); - break; - default: + break; + default: bill.Add(new CommandLine { Name = name, Description = name + shorthairsuffix, UnitaryCost = SelectedProfile.ShortFoldingPrice }); - break; + break; } } break; - } + } // les soins - if (Prestation.Cares) { - bill.Add(new CommandLine { Name = "Soins", - Description = "Soins", - UnitaryCost = SelectedProfile.CarePrice }); + if (Prestation.Cares) + { + bill.Add(new CommandLine + { + Name = "Soins", + Description = "Soins", + UnitaryCost = SelectedProfile.CarePrice + }); } return bill; @@ -375,28 +387,31 @@ Prestation.Gender == HairCutGenders.Women ? public HairCutPayementEvent CreatePaymentEvent(PaymentInfo info, IStringLocalizer localizer) { - - return new HairCutPayementEvent(Client.UserName,info,this, localizer); + + return new HairCutPayementEvent(Client.UserName, info, this, localizer); } public virtual BrusherProfile SelectedProfile { get; set; } - public HairCutQueryEvent CreateEvent(string subTopic, string reason, string sender) { + public HairCutQueryEvent CreateEvent(string subTopic, string reason, string sender) + { - string evdate = EventDate?.ToString("dddd dd/MM/yyyy à HH:mm")??"[pas de date spécifiée]"; - string address = Location?.Address??"[pas de lieu spécifié]"; + string evdate = EventDate?.ToString("dddd dd/MM/yyyy à HH:mm") ?? "[pas de date spécifiée]"; + string address = Location?.Address ?? "[pas de lieu spécifié]"; var p = Prestation; - string total = GetBillItems().Addition().ToString("C",CultureInfo.CurrentUICulture); + string total = GetBillItems().Addition().ToString("C", CultureInfo.CurrentUICulture); string strprestation = Description; string bill = string.Join("\n", GetBillItems().Select( - l=> $"{l.Name} {l.Description} {l.UnitaryCost} € " + - ((l.Count != 1) ? "*"+l.Count.ToString() : ""))); + l => $"{l.Name} {l.Description} {l.UnitaryCost} € " + + ((l.Count != 1) ? "*" + l.Count.ToString() : ""))); var yaev = new HairCutQueryEvent(subTopic) { - Client = new ClientProviderInfo {  - UserName = Client.UserName , - UserId =ClientId, - Avatar = Client.Avatar } , + Client = new ClientProviderInfo + { + UserName = Client.UserName, + UserId = ClientId, + Avatar = Client.Avatar + }, Previsional = Previsional, EventDate = EventDate, Location = Location, diff --git a/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs b/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs index 025c66d5..24714ee4 100644 --- a/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs +++ b/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs @@ -25,7 +25,16 @@ namespace Yavsc.Models.Haircut public class HairMultiCutQuery : NominativeServiceCommand { // Bill description - public override string Description => "Prestation en coiffure à domicile [commande groupée]" ; + string _customDescription = null; + public override string Description + { + get { + return _customDescription ?? "Prestation en coiffure à domicile [commande groupée]" ; + } + set { + _customDescription = value; + } + } [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] override public long Id { get; set; } diff --git a/Yavsc.Server/Models/IT/Project.cs b/Yavsc.Server/Models/IT/Project.cs index f371b066..f3cb066e 100644 --- a/Yavsc.Server/Models/IT/Project.cs +++ b/Yavsc.Server/Models/IT/Project.cs @@ -51,7 +51,11 @@ namespace Yavsc.Server.Models.IT } string description; - public override string Description => description; + public override string Description + { + get { return description; } + set { description = value; } + } public Project() { diff --git a/Yavsc.Server/Models/Workflow/RdvQuery.cs b/Yavsc.Server/Models/Workflow/RdvQuery.cs index 6ad089b3..d908c492 100644 --- a/Yavsc.Server/Models/Workflow/RdvQuery.cs +++ b/Yavsc.Server/Models/Workflow/RdvQuery.cs @@ -42,7 +42,19 @@ namespace Yavsc.Models.Workflow [Display(Name="GiveAnExplicitReason")] public string Reason { get; set; } - public override string Description => "Rendez-vous"; + string _description = "Rendez-vous"; + public override string Description + { + get + { + string type = ResourcesHelpers.GlobalLocalizer[this.GetType().Name]; + return $"{_description} {type}"; + } + set + { + _description = value; + } + } public RdvQuery() { diff --git a/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs b/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs index e44189dc..b5ace84f 100644 --- a/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs +++ b/Yavsc.Server/ViewModels/Account/RegisterViewModel.cs @@ -3,11 +3,12 @@ using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { + using Yavsc; public class RegisterViewModel { [StringLength(102)] - [YaRegularExpression(Constants.UserNameRegExp, ErrorMessageResourceName="InvalidUserName", ErrorMessageResourceType = typeof(RegisterViewModel))] + [YaRegularExpression(Constants.UserNameRegExp)] public string UserName { get; set; } [YaRequired()] @@ -23,9 +24,10 @@ namespace Yavsc.ViewModels.Account public string Password { get; set; } [DataType(DataType.Password)] - [Compare("Password", ErrorMessageResourceName = "PassAndConfirmDontMach", ErrorMessageResourceType = typeof(RegisterViewModel) )] + [Compare("Password")] public string ConfirmPassword { get; set; } public string GoogleRegId { get; set; } + } } diff --git a/Yavsc/Controllers/Accounting/AccountController.cs b/Yavsc/Controllers/Accounting/AccountController.cs index a0155ae6..527bcecf 100644 --- a/Yavsc/Controllers/Accounting/AccountController.cs +++ b/Yavsc/Controllers/Accounting/AccountController.cs @@ -20,6 +20,7 @@ using Newtonsoft.Json; namespace Yavsc.Controllers { + using System.Text; using Yavsc.Abstract.Manage; using Yavsc.Helpers; @@ -60,10 +61,28 @@ namespace Yavsc.Controllers _dbContext = dbContext; } + const string nextPageTokenKey = "nextPageTokenKey"; + const int defaultLen = 10; + [Authorize(Roles = Constants.AdminGroupName)] - public async Task UserList() + [Route("Account/UserList/{page?}/{len?}")] + public async Task UserList(string page, string len) { - return View(await _dbContext.Users.ToArrayAsync()); + int pageNum = page!=null ? int.Parse(page) : 0; + int pageLen = len!=null ? int.Parse(len) : defaultLen; + + var users = _dbContext.Users.OrderBy(u=>u.UserName); + var shown = pageNum * pageLen; + var toShow = users.Skip(shown).Take(pageLen); + + ViewBag.page = pageNum; + ViewBag.hasNext = await users.CountAsync() > (toShow.Count() + shown); + ViewBag.nextpage = pageNum+1; + ViewBag.pageLen = pageLen; + return View(toShow.ToArray()); + } + string GeneratePageToken() { + return System.Guid.NewGuid().ToString(); } [AllowAnonymous] diff --git a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx index 520d4d1e..8a3f415e 100644 --- a/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx +++ b/Yavsc/Resources/Yavsc.Resources.YavscLocalisation.fr.resx @@ -453,6 +453,7 @@ Les mots de passe doivent contenir au moins une lettre majuscule ('A' à 'Z'). Le mot de passe et sa confirmation ne sont pas les mêmes. Confirmation du mot de passe + Confirmation du mot de passe L'envoi de de courrier pour confirmation de l'adresse e-mail a échoué. Un courrier a été envoyé pour confirmation de l'adresse e-mail . S'il vous plait, confirmez votre addresse e-mail diff --git a/Yavsc/Views/Account/Register.fr.cshtml b/Yavsc/Views/Account/Register.fr.cshtml index c7eb480a..f1761a43 100755 --- a/Yavsc/Views/Account/Register.fr.cshtml +++ b/Yavsc/Views/Account/Register.fr.cshtml @@ -15,28 +15,28 @@
- +
- +
- +
- +
diff --git a/Yavsc/Views/Account/UserList.cshtml b/Yavsc/Views/Account/UserList.cshtml index 8ec957ea..81606ed6 100644 --- a/Yavsc/Views/Account/UserList.cshtml +++ b/Yavsc/Views/Account/UserList.cshtml @@ -4,5 +4,61 @@ }

@ViewData["Title"].

+ + + + + + +@foreach (var user in Model) +{ + + + + +} +
+ @SR["Public info"] + + @SR["AdminOnly"] +
+ @Html.DisplayFor(m=>user) + +
+
+ UserName +
+
+ @Html.DisplayFor(m=>user.UserName) +
+
+
+
+ FullName +
+
+ @Html.DisplayFor(m=>user.FullName) +
+
+
+
+ @SR["PostalAddress"] +
+
+ @Html.DisplayFor(m=>user.PostalAddress) +
+
+
+
+ Email +
+
+ @Html.DisplayFor(m=>user.Email) +
+
+
-@Html.DisplayFor(m=>m) +@if (ViewBag.hasNext) +{ + Next page +} \ No newline at end of file diff --git a/Yavsc/contrib/TEstShouldNotBeCompiled.cs b/Yavsc/contrib/TEstShouldNotBeCompiled.cs new file mode 100644 index 00000000..14ec4ef0 --- /dev/null +++ b/Yavsc/contrib/TEstShouldNotBeCompiled.cs @@ -0,0 +1,3 @@ +namespace Yavsc.contrib +{ + omg, daB4C0|)3DA!!! \ No newline at end of file diff --git a/test/Makefile b/test/Makefile index 5da264b7..d322e43a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -19,11 +19,11 @@ $(BINTARGET): project.lock.json ../Yavsc/bin/$(CONFIGURATION)/dnx451/Yavsc.dll . dnu build --configuration $(CONFIGURATION) breaking: - dnx test -trait noregres=no + dnx test -trait regres=yes test: $(BINTARGET) - ASPNET_ENV=Development dnx test -maxthreads 1 -trait noregres=yes + ASPNET_ENV=Development dnx test -maxthreads 1 -trait regres=no .PHONY: test