- Data:
- 2009-12-08 10:09:39 (16 years ago)
- Lokalizacja:
- branches/Emisje
- Pliki:
-
- 2 zmodyfikowane
-
. (zmodyfikowane) (1 prop)
-
eCard/eCardMVC/Platnosci/Controllers/AccountController.cs (zmodyfikowane) (5 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
branches/Emisje
- Property svn:mergeinfo
-
old new 3 3 /branches/ReklamaReorganizacja:568-731 4 4 /tags/BazaReklam_1.1.28:831 5 /trunk:774-893 5 /trunk:774-893,896-936
-
- Property svn:mergeinfo
-
branches/Emisje/eCard/eCardMVC/Platnosci/Controllers/AccountController.cs
r895 r939 1 1 using System; 2 2 using System.Linq; 3 using System.Text;4 3 using System.Web.Mvc; 5 4 using System.Web.Security; 6 using System.Collections.Generic;7 5 using Platnosci.Core.Linq; 8 6 using Platnosci.Models; 9 using System.Globalization;10 using System.Threading;11 7 using Platnosci.Core.Interface; 12 using System.Resources;13 using Platnosci.Core;14 8 15 9 namespace Platnosci.Controllers 16 { 17 10 { 18 11 [HandleError] 19 12 public class AccountController : Controller 20 13 { 14 private readonly IRepository<vPlatnosciEcard> _repository; 15 private readonly FunkcjePlatnosci _funkcjePlatnosci; 21 16 22 private readonly IRepository<vPlatnosciEcard> _repository;23 private readonly PlatnosciDataContext _context;24 private FunkcjePlatnosci _func;25 26 17 public IFormsAuthentication FormsAuth 27 18 { … … 34 25 _repository = new Repository<vPlatnosciEcard>(new DataContext1()); 35 26 FormsAuth = new FormsAuthenticationService(); 36 _context = new PlatnosciDataContext(); 37 _func = new FunkcjePlatnosci(); 27 _funkcjePlatnosci = new FunkcjePlatnosci(); 38 28 } 39 29 40 public AccountController(IFormsAuthentication formsAuth, IRepository<vPlatnosciEcard> repository, PlatnosciDataContext context,FunkcjePlatnosci func)30 public AccountController(IFormsAuthentication formsAuth, IRepository<vPlatnosciEcard> repository, FunkcjePlatnosci func) 41 31 { 42 32 _repository = repository; 43 33 FormsAuth = formsAuth ?? new FormsAuthenticationService(); 44 _context = context; 45 _func = func; 34 _funkcjePlatnosci = func; 46 35 } 47 36 48 37 public ActionResult LogOn(string language) 49 38 { 50 language = _func.setLanguage(language);39 _funkcjePlatnosci.setLanguage(language); 51 40 return View(); 52 41 } … … 55 44 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", 56 45 Justification = "Needs to take same parameter type as Controller.Redirect()")] 57 public ActionResult LogOn(string nip, string numer _faktury, string returnUrl, string language)46 public ActionResult LogOn(string nip, string numerFaktury, string returnUrl, string language) 58 47 { 59 60 language = _func.setLanguage(language); 61 vPlatnosciEcard platnosc = new vPlatnosciEcard(); 62 if (!ValidateLogOn(nip, numer_faktury)) 48 _funkcjePlatnosci.setLanguage(language); 49 var platnosc = new vPlatnosciEcard(); 50 if (!ValidateLogOn(nip, numerFaktury)) 63 51 { 64 52 return View(); 65 53 } 66 else 67 { 68 var Login = _repository.FindInvoiceByNipNumber(nip, numer_faktury).SingleOrDefault(); 69 platnosc = Login; 70 if (platnosc == null) return View(); 71 } 72 _func.SetUserLogger(nip, numer_faktury); 54 55 var login = _repository.FindInvoiceByNipNumber(nip, numerFaktury).SingleOrDefault(); 56 platnosc = login; 57 if (platnosc == null) return View(); 58 _funkcjePlatnosci.SetUserLogger(nip, numerFaktury); 73 59 74 60 FormsAuth.SignIn(nip, false); … … 78 64 return Redirect(returnUrl); 79 65 } 80 else return RedirectToAction("Show", "Platnosc", new { id = platnosc.ID_faktury }); 66 67 return RedirectToAction("Show", "Platnosc", new { id = platnosc.ID_faktury }); 81 68 } 69 82 70 public ActionResult LogOff() 83 71 { … … 86 74 } 87 75 88 private bool ValidateLogOn(string nip, string numer _faktury)76 private bool ValidateLogOn(string nip, string numerFaktury) 89 77 { 90 78 if (String.IsNullOrEmpty(nip)) 91 79 { 92 string err_nip = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nip").ToString();93 ModelState.AddModelError("nip", err _nip);80 var errNip = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nip").ToString(); 81 ModelState.AddModelError("nip", errNip); 94 82 } 95 if (String.IsNullOrEmpty(numer _faktury))83 if (String.IsNullOrEmpty(numerFaktury)) 96 84 { 97 string err_faktura = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_faktura").ToString();98 ModelState.AddModelError("numer _faktury", err_faktura);85 var errFaktura = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_faktura").ToString(); 86 ModelState.AddModelError("numerFaktury", errFaktura); 99 87 } 100 88 if (ModelState.IsValid) 101 89 { 102 bool DaneOk = _repository.Exists(u => u.Faktura_Numer == numer_faktury && u.nip == nip);103 if ( DaneOk == false)90 var daneOk = _repository.Exists(u => u.Faktura_Numer == numerFaktury && u.nip == nip); 91 if (daneOk == false) 104 92 { 105 string err_logowanie = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_logowanie").ToString();106 ModelState.AddModelError("_FORM", err _logowanie);107 } 93 var errLogowanie = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_logowanie").ToString(); 94 ModelState.AddModelError("_FORM", errLogowanie); 95 } 108 96 } 109 97 return ModelState.IsValid;
