- Data:
- 2009-12-07 12:04:45 (16 years ago)
- Lokalizacja:
- trunk/eCard/eCardMVC
- Pliki:
-
- 4 zmodyfikowane
-
Platnosci.Tests/Web/UIAccountTest.cs (zmodyfikowane) (2 diffs)
-
Platnosci.Tests/Web/UIPlatnosciTests.cs (zmodyfikowane) (2 diffs)
-
Platnosci/Controllers/AccountController.cs (zmodyfikowane) (5 diffs)
-
Platnosci/Views/Account/LogOn.aspx (zmodyfikowane) (1 diff)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/eCard/eCardMVC/Platnosci.Tests/Web/UIAccountTest.cs
r931 r932 12 12 { 13 13 var ie = new IE("http://localhost:3646/pl/Account/LogOn"); 14 ie.TextField(Find.ByName("numer _faktury")).TypeText("24/HOL/2009");14 ie.TextField(Find.ByName("numerFaktury")).TypeText("24/HOL/2009"); 15 15 ie.TextField(Find.ByName("nip")).TypeText("501379568"); 16 16 ie.Button(Find.ById("loguj")).Click(); … … 23 23 { 24 24 var ie = new IE("http://localhost:3646/pl/Account/LogOn"); 25 ie.TextField(Find.ByName("numer _faktury")).TypeText("");25 ie.TextField(Find.ByName("numerFaktury")).TypeText(""); 26 26 ie.TextField(Find.ByName("nip")).TypeText(""); 27 27 ie.Button(Find.ById("loguj")).Click(); -
trunk/eCard/eCardMVC/Platnosci.Tests/Web/UIPlatnosciTests.cs
r930 r932 13 13 const string test = "test"; 14 14 var ie = new IE("http://localhost:3646/pl/Account/LogOn"); 15 ie.TextField(Find.ByName("numer _faktury")).TypeText("27/ASZ/2009");15 ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009"); 16 16 ie.TextField(Find.ByName("nip")).TypeText("854956281"); 17 17 ie.Button(Find.ById("loguj")).Click(); … … 29 29 const string test = "test"; 30 30 var ie = new IE("http://localhost:3646/pl/Account/LogOn"); 31 ie.TextField(Find.ByName("numer _faktury")).TypeText("27/ASZ/2009");31 ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009"); 32 32 ie.TextField(Find.ByName("nip")).TypeText("854956281"); 33 33 ie.Button(Find.ById("loguj")).Click(); -
trunk/eCard/eCardMVC/Platnosci/Controllers/AccountController.cs
r930 r932 8 8 9 9 namespace Platnosci.Controllers 10 { 11 10 { 12 11 [HandleError] 13 12 public class AccountController : Controller 14 13 { 14 private readonly IRepository<vPlatnosciEcard> _repository; 15 private readonly FunkcjePlatnosci _funkcjePlatnosci; 15 16 16 private readonly IRepository<vPlatnosciEcard> _repository;17 private readonly PlatnosciDataContext _context;18 private FunkcjePlatnosci _func;19 20 17 public IFormsAuthentication FormsAuth 21 18 { … … 28 25 _repository = new Repository<vPlatnosciEcard>(new DataContext1()); 29 26 FormsAuth = new FormsAuthenticationService(); 30 _context = new PlatnosciDataContext(); 31 _func = new FunkcjePlatnosci(); 27 _funkcjePlatnosci = new FunkcjePlatnosci(); 32 28 } 33 29 34 public AccountController(IFormsAuthentication formsAuth, IRepository<vPlatnosciEcard> repository, PlatnosciDataContext context,FunkcjePlatnosci func)30 public AccountController(IFormsAuthentication formsAuth, IRepository<vPlatnosciEcard> repository, FunkcjePlatnosci func) 35 31 { 36 32 _repository = repository; 37 33 FormsAuth = formsAuth ?? new FormsAuthenticationService(); 38 _context = context; 39 _func = func; 34 _funkcjePlatnosci = func; 40 35 } 41 36 42 37 public ActionResult LogOn(string language) 43 38 { 44 language = _func.setLanguage(language);39 _funkcjePlatnosci.setLanguage(language); 45 40 return View(); 46 41 } … … 49 44 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", 50 45 Justification = "Needs to take same parameter type as Controller.Redirect()")] 51 public ActionResult LogOn(string nip, string numer _faktury, string returnUrl, string language)46 public ActionResult LogOn(string nip, string numerFaktury, string returnUrl, string language) 52 47 { 53 54 language = _func.setLanguage(language); 55 vPlatnosciEcard platnosc = new vPlatnosciEcard(); 56 if (!ValidateLogOn(nip, numer_faktury)) 48 _funkcjePlatnosci.setLanguage(language); 49 var platnosc = new vPlatnosciEcard(); 50 if (!ValidateLogOn(nip, numerFaktury)) 57 51 { 58 52 return View(); 59 53 } 60 else 61 { 62 var Login = _repository.FindInvoiceByNipNumber(nip, numer_faktury).SingleOrDefault(); 63 platnosc = Login; 64 if (platnosc == null) return View(); 65 } 66 _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); 67 59 68 60 FormsAuth.SignIn(nip, false); … … 72 64 return Redirect(returnUrl); 73 65 } 74 else return RedirectToAction("Show", "Platnosc", new { id = platnosc.ID_faktury }); 66 67 return RedirectToAction("Show", "Platnosc", new { id = platnosc.ID_faktury }); 75 68 } 69 76 70 public ActionResult LogOff() 77 71 { … … 80 74 } 81 75 82 private bool ValidateLogOn(string nip, string numer _faktury)76 private bool ValidateLogOn(string nip, string numerFaktury) 83 77 { 84 78 if (String.IsNullOrEmpty(nip)) 85 79 { 86 string err_nip = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nip").ToString();87 ModelState.AddModelError("nip", err _nip);80 var errNip = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nip").ToString(); 81 ModelState.AddModelError("nip", errNip); 88 82 } 89 if (String.IsNullOrEmpty(numer _faktury))83 if (String.IsNullOrEmpty(numerFaktury)) 90 84 { 91 string err_faktura = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_faktura").ToString();92 ModelState.AddModelError("numer _faktury", err_faktura);85 var errFaktura = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_faktura").ToString(); 86 ModelState.AddModelError("numerFaktury", errFaktura); 93 87 } 94 88 if (ModelState.IsValid) 95 89 { 96 bool DaneOk = _repository.Exists(u => u.Faktura_Numer == numer_faktury && u.nip == nip);97 if ( DaneOk == false)90 var daneOk = _repository.Exists(u => u.Faktura_Numer == numerFaktury && u.nip == nip); 91 if (daneOk == false) 98 92 { 99 string err_logowanie = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_logowanie").ToString();100 ModelState.AddModelError("_FORM", err _logowanie);101 } 93 var errLogowanie = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_logowanie").ToString(); 94 ModelState.AddModelError("_FORM", errLogowanie); 95 } 102 96 } 103 97 return ModelState.IsValid; -
trunk/eCard/eCardMVC/Platnosci/Views/Account/LogOn.aspx
r911 r932 44 44 <tr> 45 45 <td> 46 <%= Html.TextBox("numer _faktury")%>47 <%= Html.ValidationMessage("numer _faktury","*")%>46 <%= Html.TextBox("numerFaktury")%> 47 <%= Html.ValidationMessage("numerFaktury", "*")%> 48 48 </td> 49 49 </tr>
