refactoring

This commit is contained in:
2018-08-01 03:12:08 +02:00
parent 4ab43a7874
commit 29d85a0ccf
16 changed files with 11 additions and 53 deletions

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Linq;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Text; using System.Text;

View File

@ -5,7 +5,7 @@ using Yavsc.Services;
namespace Yavsc.Billing namespace Yavsc.Billing
{ {
public interface IBillable { public interface IBillable {
string GetDescription (); string Description { get; }
List<IBillItem> GetBillItems(); List<IBillItem> GetBillItems();
long Id { get; set; } long Id { get; set; }

View File

@ -18,7 +18,7 @@ namespace Yavsc.Models.Billing
public string GetInvoiceId() { return GetType().Name + "/" + Id; } public string GetInvoiceId() { return GetType().Name + "/" + Id; }
public abstract long Id { get; set; } public abstract long Id { get; set; }
public abstract string GetDescription (); public abstract string Description { get; }
[Required()] [Required()]
public bool Consent { get; set; } public bool Consent { get; set; }

View File

@ -20,13 +20,13 @@ namespace Yavsc.Models.Haircut
{ {
// Bill description // Bill description
public override string GetDescription() public override string Description { get
{ {
string type = ResourcesHelpers.GlobalLocalizer[this.GetType().Name]; string type = ResourcesHelpers.GlobalLocalizer[this.GetType().Name];
string gender = ResourcesHelpers.GlobalLocalizer[this.Prestation.Gender.ToString()]; string gender = ResourcesHelpers.GlobalLocalizer[this.Prestation.Gender.ToString()];
return $"{type} ({gender})"; return $"{type} ({gender})";
} }
}
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@ -387,7 +387,7 @@ Prestation.Gender == HairCutGenders.Women ?
string address = Location?.Address??"[pas de lieu spécifié]"; string address = Location?.Address??"[pas de lieu spécifié]";
var p = Prestation; var p = Prestation;
string total = GetBillItems().Addition().ToString("C",CultureInfo.CurrentUICulture); string total = GetBillItems().Addition().ToString("C",CultureInfo.CurrentUICulture);
string strprestation = GetDescription(); string strprestation = Description;
string bill = string.Join("\n", GetBillItems().Select( string bill = string.Join("\n", GetBillItems().Select(
l=> $"{l.Name} {l.Description} {l.UnitaryCost} € " + l=> $"{l.Name} {l.Description} {l.UnitaryCost} € " +
((l.Count != 1) ? "*"+l.Count.ToString() : ""))); ((l.Count != 1) ? "*"+l.Count.ToString() : "")));

View File

@ -25,10 +25,7 @@ namespace Yavsc.Models.Haircut
public class HairMultiCutQuery : NominativeServiceCommand public class HairMultiCutQuery : NominativeServiceCommand
{ {
// Bill description // Bill description
public override string GetDescription() public override string Description => "Prestation en coiffure à domicile [commande groupée]" ;
{
return "Prestation en coiffure à domicile [commande groupée]";
}
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
override public long Id { get; set; } override public long Id { get; set; }

View File

@ -61,15 +61,8 @@ namespace Yavsc.Server.Models.IT
{ {
return bill; return bill;
} }
string description;
public string Description { get; set; } public override string Description => description;
public override string GetDescription()
{
return Description;
}
public Project() public Project()
{ {

View File

@ -42,10 +42,7 @@ namespace Yavsc.Models.Workflow
[Display(Name="GiveAnExplicitReason")] [Display(Name="GiveAnExplicitReason")]
public string Reason { get; set; } public string Reason { get; set; }
public override string GetDescription () public override string Description => "Rendez-vous";
{
return "Rendez-vous";
}
public RdvQuery() public RdvQuery()
{ {

View File

@ -10,7 +10,6 @@ namespace Yavsc.WebApi.Controllers
using Models; using Models;
using Models.Account; using Models.Account;
using ViewModels.Account; using ViewModels.Account;
using Models.Auth;
using Yavsc.Helpers; using Yavsc.Helpers;
using System.Linq; using System.Linq;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;

View File

@ -10,7 +10,6 @@ using Yavsc.Server.Helpers;
using Yavsc.Models.Workflow; using Yavsc.Models.Workflow;
using Yavsc.Models.Payment; using Yavsc.Models.Payment;
using Yavsc.Server.Models.IT.SourceCode; using Yavsc.Server.Models.IT.SourceCode;
using Microsoft.AspNet.Mvc.Localization;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
namespace Yavsc.Controllers namespace Yavsc.Controllers

View File

@ -40,7 +40,7 @@ namespace Yavsc.Helpers
string evdate = query.EventDate?.ToString("dddd dd/MM/yyyy à hh:mm")??"[pas de date spécifiée]"; string evdate = query.EventDate?.ToString("dddd dd/MM/yyyy à hh:mm")??"[pas de date spécifiée]";
string address = query.Location?.Address??"[pas de lieu spécifié]"; string address = query.Location?.Address??"[pas de lieu spécifié]";
var p = query.Prestation; var p = query.Prestation;
string strprestation = query.GetDescription(); string strprestation = query.Description;
var yaev = query.CreateEvent("NewHairCutQuery", var yaev = query.CreateEvent("NewHairCutQuery",
string.Format(ResourcesHelpers.GlobalLocalizer["HairCutQueryValidation"],query.Client.UserName), string.Format(ResourcesHelpers.GlobalLocalizer["HairCutQueryValidation"],query.Client.UserName),

View File

@ -83,7 +83,7 @@ namespace Yavsc.Helpers
SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType SetExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType
{ {
PaymentDetails = new List<PaymentDetailsType>( new [] { new PaymentDetailsType{ PaymentDetails = new List<PaymentDetailsType>( new [] { new PaymentDetailsType{
OrderDescription = query.GetDescription(), OrderDescription = query.Description,
OrderTotal = new BasicAmountType { OrderTotal = new BasicAmountType {
currencyID = CurrencyCodeType.EUR, currencyID = CurrencyCodeType.EUR,
value = total value = total

View File

@ -1,7 +1,6 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;

View File

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations namespace Yavsc.Migrations

View File

@ -1,8 +1,6 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;
namespace Yavsc.Migrations namespace Yavsc.Migrations

View File

@ -1,23 +1,4 @@
using System.Threading.Tasks;
using MailKit.Net.Smtp;
using MimeKit;
using MailKit.Security;
using System;
using Yavsc.Models.Messaging;
using Yavsc.Models;
using Yavsc.Models.Google.Messaging;
using System.Collections.Generic;
using Yavsc.Models.Haircut;
using Yavsc.Interfaces.Workflow;
using System.Linq;
using Newtonsoft.Json;
using Yavsc.Server.Helpers;
using Yavsc.Abstract.Manage;
using Microsoft.AspNet.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.OptionsModel;
namespace Yavsc.Services namespace Yavsc.Services
{ {
// This class is used by the application to send Email and SMS // This class is used by the application to send Email and SMS

View File

@ -6,7 +6,6 @@ using System.Security.Claims;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using OAuth.AspNet.AuthServer; using OAuth.AspNet.AuthServer;
using Yavsc.Models; using Yavsc.Models;