Pokaż
Ignoruj:
Data:
2009-12-23 11:59:36 (16 years ago)
Autor:
marek
Opis:

re #215

Pliki:
1 przeniesione

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/eCard/eCardMVC/Platnosci/Models/PaymentsUtils.cs

    r970 r971  
    1010 
    1111 
    12 namespace Platnosci.Models 
     12namespace adMoto.Payments.Web.Models 
    1313{ 
    14     public class FunkcjePlatnosci 
     14    public class PaymentsUtils 
    1515    { 
    1616        public const string EUR = "978"; 
     
    2121        public const string KOD_POLSKA = "616";         //kod kraju Akceptanta - Polska 
    2222        public const string KODOWANIE = "ISO-8859-2"; 
    23         private IRepository<PlatnosciEcard> _repPayment; 
     23        private readonly IRepository<PlatnosciEcard> _repPayment; 
    2424        private readonly ITranslateManager _translateManager; 
    2525 
    26         public FunkcjePlatnosci() 
     26        public PaymentsUtils() 
    2727        { 
    2828            _repPayment = new Repository<PlatnosciEcard>(new DataContext()); 
     
    3030        } 
    3131 
    32         public FunkcjePlatnosci(IRepository<PlatnosciEcard> repPayment) 
     32        public PaymentsUtils(IRepository<PlatnosciEcard> repPayment) 
    3333        { 
    3434            _repPayment = repPayment; 
    3535            _translateManager = new Translation();     
    3636        } 
    37         public FunkcjePlatnosci(IRepository<PlatnosciEcard> repPayment, ITranslateManager translate) 
     37        public PaymentsUtils(IRepository<PlatnosciEcard> repPayment, ITranslateManager translate) 
    3838        { 
    3939            _repPayment = repPayment; 
     
    5858        public Waluta SetAmount(Invoice platnosc) 
    5959        { 
    60             var waluta = new Waluta(); 
    61             waluta.Currency = GetCurrency(platnosc.waluta_miano); 
     60            var waluta = new Waluta {Currency = GetCurrency(platnosc.waluta_miano)}; 
    6261 
    63             if (waluta.Currency == PLN) 
    64                 waluta.Amount = Convert.ToInt32(platnosc.Brutto * 100); 
    65             else 
    66                 waluta.Amount = Convert.ToInt32(platnosc.waluta_brutto * 100); 
     62            waluta.Amount = waluta.Currency == PLN ? Convert.ToInt32(platnosc.Brutto * 100) : Convert.ToInt32(platnosc.waluta_brutto * 100); 
    6763             
    6864            return waluta; 
     
    174170        } 
    175171 
    176         public ErrorViewData IsError(Invoice platnosc, String UserName) 
     172        public ErrorViewData IsError(Invoice platnosc, String userName) 
    177173        { 
    178174            var errortxt = ""; 
     
    180176            if (platnosc == null) 
    181177                errortxt = _translateManager.Translate("tlumaczenia", "brakdanych"); 
    182             else if (!UserIdentity(platnosc, UserName)) 
     178            else if (!UserIdentity(platnosc, userName)) 
    183179                errortxt = _translateManager.Translate("tlumaczenia", "weryfikacja"); 
    184180