Zbiór zmian 871 dla trunk/eCard/eCardMVC/Platnosci/Controllers/PlatnoscController.cs
- Data:
- 2009-11-09 16:00:17 (16 years ago)
- Pliki:
-
- 1 zmodyfikowane
-
trunk/eCard/eCardMVC/Platnosci/Controllers/PlatnoscController.cs (zmodyfikowane) (10 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/eCard/eCardMVC/Platnosci/Controllers/PlatnoscController.cs
r870 r871 23 23 private readonly IDataContext _context1; 24 24 private readonly IRepository<PotwierdzeniaEcard> _rep; 25 private readonly IRep <PotwierdzeniaEcard> _repository;25 private readonly IRepository<PlatnosciEcard> _repPl; 26 26 private FunkcjePlatnosci _func; 27 27 private string userIdentity = ""; 28 private string weryfikacja = ""; 29 private string brakdanych = ""; 30 private string zaplacono = ""; 31 private string err_imie = ""; 32 private string err_nazwisko = ""; 33 34 35 protected override void Initialize(System.Web.Routing.RequestContext requestContext) 36 { 37 base.Initialize(requestContext); 38 userIdentity = HttpContext.User.Identity.Name; 39 weryfikacja = HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString(); 40 brakdanych = HttpContext.GetGlobalResourceObject("tlumaczenia", "brakdanych").ToString(); 41 zaplacono = HttpContext.GetGlobalResourceObject("tlumaczenia", "zaplacono").ToString(); 42 err_imie = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_imieWK").ToString(); 43 err_nazwisko = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nazwiskoWK").ToString(); 44 } 28 45 29 46 public PlatnoscController() 30 47 { 31 48 _context = new PlatnosciDataContext(); 32 _rep = new Repository<PotwierdzeniaEcard>(new DataContext1()); 49 _rep = new Repository<PotwierdzeniaEcard>(new DataContext1()); 50 _repPl = new Repository<PlatnosciEcard>(new DataContext1()); 33 51 _func = new FunkcjePlatnosci(); 52 34 53 } 35 54 public PlatnoscController(IDataContext datacontext){ 36 55 _rep = new Repository<PotwierdzeniaEcard>(datacontext); 56 _repPl = new Repository<PlatnosciEcard>(datacontext); 37 57 _context1 = datacontext; 58 _func = new FunkcjePlatnosci(); 38 59 } 39 60 public ActionResult Show(string id, string language) … … 49 70 { 50 71 } 51 72 52 73 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 53 //sprawdzamy czy numer faktury dotyczy zalogowanego usera54 74 ErrorViewData errorViewData = new ErrorViewData(); 55 75 if (platnosc == null) 56 76 { 57 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "brakdanych").ToString();77 errorViewData.error = brakdanych; 58 78 return View("Error1", errorViewData); 59 79 } 60 else if (!_func.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name))61 { 62 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString();80 else if (!_func.UserIdentity(platnosc, userIdentity)) 81 { 82 errorViewData.error = weryfikacja; 63 83 return View("Error1", errorViewData); 64 84 } … … 68 88 { 69 89 string data_zaplaty = String.Format("{0:dd-MM-yyyy}",tablica_potwierdzenia[0].AUTHTIME); 70 errorViewData.error = String.Format( HttpContext.GetGlobalResourceObject("tlumaczenia", "zaplacono").ToString(), platnosc.Faktura_Numer, data_zaplaty);90 errorViewData.error = String.Format(zaplacono, platnosc.Faktura_Numer, data_zaplaty); 71 91 return View("Error1", errorViewData); 72 92 } … … 83 103 { 84 104 language = _func.setLanguage(language); 85 string userName = ControllerContext.HttpContext.User.Identity.Name;86 105 int id1 = 0; 87 106 try … … 94 113 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 95 114 ErrorViewData errorViewData = new ErrorViewData(); 115 116 if (!_func.UserIdentity(platnosc, userIdentity)) 117 { 118 errorViewData.error = weryfikacja; 119 return View("Error1", errorViewData); 120 } 96 121 if (platnosc == null) 97 122 { 98 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "brakdanych").ToString();99 return View("Error1", errorViewData); 100 } 101 else if (!_func.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name))102 { 103 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString();123 errorViewData.error = brakdanych; 124 return View("Error1", errorViewData); 125 } 126 else if (!_func.UserIdentity(platnosc, userIdentity)) 127 { 128 errorViewData.error = weryfikacja; 104 129 return View("Error1", errorViewData); 105 130 } … … 107 132 if (String.IsNullOrEmpty(payer.FirstName)) 108 133 { 109 string err_imieWK = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_imieWK").ToString(); 110 ModelState.AddModelError("Payer.FirstName", err_imieWK); 134 ModelState.AddModelError("Payer.FirstName", err_imie); 111 135 } 112 136 if (String.IsNullOrEmpty(payer.LastName)) 113 137 { 114 string err_nazwiskoWK = HttpContext.GetGlobalResourceObject("tlumaczenia", "err_nazwiskoWK").ToString(); 115 ModelState.AddModelError("Payer.LastName", err_nazwiskoWK); 138 ModelState.AddModelError("Payer.LastName", err_nazwisko); 116 139 } 117 140 if (ModelState.IsValid == false) … … 146 169 return View("Error1", errorViewData); 147 170 } 148 else if (!_func.UserIdentity(platnosc, ControllerContext.HttpContext.User.Identity.Name))149 { 150 errorViewData.error = HttpContext.GetGlobalResourceObject("tlumaczenia", "weryfikacja").ToString();171 else if (!_func.UserIdentity(platnosc, userIdentity)) 172 { 173 errorViewData.error = weryfikacja; 151 174 return View("Error1", errorViewData); 152 175 } … … 154 177 return View(invoiceDeatailsViewData); 155 178 } 179 public void UpdateStatus(int ordernumber, string validationcode) 180 { 181 182 var platnosc = _repPl.FindOne(i => i.ORDERNUMBER == ordernumber); 183 if (platnosc != null && platnosc.Status == true && validationcode == "000") 184 { 185 platnosc.Status = true; 186 platnosc.Status_data = DateTime.Now; 187 _repPl.Update(platnosc); 188 } 189 } 156 190 public ActionResult Status() 157 191 { … … 160 194 161 195 //TODO: validate the Form 162 163 196 string MERCHANTNUMBER = Request.Form["MERCHANTNUMBER"]; 164 197 int ORDERNUMBER = Convert.ToInt32(Request.Form["ORDERNUMBER"]); … … 214 247 return invoiceDeatailsViewData; 215 248 } 249 public void setUserIdentity(string value) 250 { 251 this.userIdentity = value; 252 253 } 254 public void setWeryfikacja(string value) 255 { 256 this.weryfikacja = value; 257 258 } 259 public void setBrakDanych(string value) 260 { 261 this.brakdanych = value; 262 263 } 264 public void setZaplacono(string value) 265 { 266 this.zaplacono = value; 267 268 } 216 269 217 270 }
