Zbiór zmian 873 dla trunk/eCard/eCardMVC
- Data:
- 2009-11-16 13:41:45 (16 years ago)
- Lokalizacja:
- trunk/eCard/eCardMVC/Platnosci
- Pliki:
-
- 2 dodane
- 3 zmodyfikowane
-
Controllers/PlatnoscController.cs (zmodyfikowane) (7 diffs)
-
Global.asax.cs (zmodyfikowane) (2 diffs)
-
Platnosci.Web.csproj (zmodyfikowane) (2 diffs)
-
Views/Platnosc/Fail.aspx (dodane)
-
Views/Platnosc/Ok.aspx (dodane)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/eCard/eCardMVC/Platnosci/Controllers/PlatnoscController.cs
r872 r873 14 14 using System.Data.Linq; 15 15 using System.Web.Configuration; 16 using System.Web.Routing; 16 17 17 18 namespace Platnosci.Controllers … … 31 32 private string err_nazwisko = ""; 32 33 33 protected override void Initialize( System.Web.Routing.RequestContext requestContext)34 protected override void Initialize(RequestContext requestContext) 34 35 { 35 36 base.Initialize(requestContext); … … 60 61 61 62 language = _func.setLanguage(language); 62 int id1 = 0; 63 try 64 { 65 id1 = (id != null) ? Convert.ToInt32(id) : 0; 66 } 67 catch 68 { 69 } 63 int id1 = ConvertId(id); 64 70 65 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 71 66 ErrorViewData errorViewData = new ErrorViewData(); 72 if (platnosc == null) 73 { 74 errorViewData.error = brakdanych; 75 return View("Error1", errorViewData); 76 } 77 else if (!_func.UserIdentity(platnosc, HttpContext.User.Identity.Name)) 78 { 79 errorViewData.error = weryfikacja; 80 return View("Error1", errorViewData); 81 } 67 if (Iserror(platnosc).error != null) return View("Error1", Iserror(platnosc)); 82 68 83 69 var tablica_potwierdzenia = _rep.FindItemsByIdFaktury(id1); … … 99 85 { 100 86 language = _func.setLanguage(language); 101 int id1 = 0; 102 try 103 { 104 id1 = (payer.Id_faktury != null) ? Convert.ToInt32(payer.Id_faktury) : 0; 105 } 106 catch 107 { 108 } 109 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 110 ErrorViewData errorViewData = new ErrorViewData(); 111 112 if (!_func.UserIdentity(platnosc, HttpContext.User.Identity.Name)) 113 { 114 errorViewData.error = weryfikacja; 115 return View("Error1", errorViewData); 116 } 117 if (platnosc == null) 118 { 119 errorViewData.error = brakdanych; 120 return View("Error1", errorViewData); 121 } 122 else if (!_func.UserIdentity(platnosc, HttpContext.User.Identity.Name)) 123 { 124 errorViewData.error = weryfikacja; 125 return View("Error1", errorViewData); 126 } 127 87 88 vPlatnosciEcard platnosc = _rep.FindInvoiceById(payer.Id_faktury).SingleOrDefault(); 89 if (Iserror(platnosc).error != null) return View("Error1", Iserror(platnosc)); 90 128 91 if (String.IsNullOrEmpty(payer.FirstName)) 129 92 { … … 142 105 } 143 106 if (payer != null) 107 { 108 System.Diagnostics.Debug.WriteLine("P;atnosciController:Show"); 144 109 return RedirectToAction("Merchant", "Merchant", payer); 110 } 111 145 112 else return View("Error"); 146 113 } 147 public ActionResult Potwierdzenie(string id, string status, string language) 148 { 149 language = _func.setLanguage(language); 150 151 int id1 = 0; 152 try 153 { 154 id1 = (id != null) ? Convert.ToInt32(id) : 0; 155 } 156 catch 157 { 158 //id1=0 -> error type = platnoscIsNotExist; 159 } 114 public ActionResult Ok(string id, string language) 115 { 116 language = _func.setLanguage(language); 117 int id1 = ConvertId(id); 160 118 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 161 ErrorViewData errorViewData = new ErrorViewData(); 162 if (platnosc == null) 163 { 164 errorViewData.error = brakdanych; 165 return View("Error1", errorViewData); 166 } 167 else if (!_func.UserIdentity(platnosc, HttpContext.User.Identity.Name)) 168 { 169 errorViewData.error = weryfikacja; 170 return View("Error1", errorViewData); 171 } 172 var invoiceDeatailsViewData = InitInvoiceDetailsViewData(platnosc, null, status, "" ); 119 if (Iserror(platnosc).error != null) return View("Error1", Iserror(platnosc)); 120 121 var invoiceDeatailsViewData = InitInvoiceDetailsViewData(platnosc, null, "" , ""); 173 122 return View(invoiceDeatailsViewData); 174 123 } 175 public void UpdateStatus(int ordernumber, string validationcode) 176 { 177 178 var platnosc = _repPl.FindOne(i => i.ORDERNUMBER == ordernumber); 179 if (platnosc != null && platnosc.Status == true && validationcode == "000") 180 { 181 platnosc.Status = true; 182 platnosc.Status_data = DateTime.Now; 183 _repPl.Update(platnosc); 184 } 124 public ActionResult Fail(string id, string language) 125 { 126 language = _func.setLanguage(language); 127 int id1 = ConvertId(id); 128 vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 129 if (Iserror(platnosc).error != null) return View("Error1", Iserror(platnosc)); 130 131 var invoiceDeatailsViewData = InitInvoiceDetailsViewData(platnosc, null, "", ""); 132 return View(invoiceDeatailsViewData); 133 } 134 public ActionResult Potwierdzenie(string status, string id) 135 { 136 if (status == "ok") return RedirectToAction("Ok", "Platnosc", new {id}); 137 return RedirectToAction("Fail", "Platnosc", new {id}); 185 138 } 186 139 public ActionResult Status() 187 140 { 188 if (string.IsNullOrEmpty(Request.Form["MERCHANTNUMBER"]))189 throw new ArgumentException("MERCHANTNUMBER");190 191 //TODO: validate the Form192 141 string MERCHANTNUMBER = Request.Form["MERCHANTNUMBER"]; 193 142 int ORDERNUMBER = Convert.ToInt32(Request.Form["ORDERNUMBER"]); … … 224 173 225 174 _rep.Insert(potwierdzenie); 175 UpdateStatus(ORDERNUMBER, VALIDATIONCODE); 226 176 return View(); 227 177 } … … 257 207 this.zaplacono = value; 258 208 259 } 260 209 } 210 public int ConvertId(string id) 211 { 212 int id1 = 0; 213 try 214 { 215 id1 = (id != null) ? Convert.ToInt32(id) : 0; 216 } 217 catch 218 { 219 } 220 return id1; 221 } 222 public ErrorViewData Iserror(vPlatnosciEcard platnosc) 223 { 224 ErrorViewData errorViewData = new ErrorViewData(); 225 if (platnosc == null) 226 { 227 errorViewData.error = brakdanych; 228 } 229 else if (!_func.UserIdentity(platnosc, HttpContext.User.Identity.Name)) 230 { 231 errorViewData.error = weryfikacja; 232 } 233 return errorViewData; 234 } 235 public void UpdateStatus(int ordernumber, string validationcode) 236 { 237 var platnosc = _repPl.FindOne(i => i.ORDERNUMBER == ordernumber); 238 if (platnosc != null && platnosc.Status == true && validationcode == "000") 239 { 240 platnosc.Status = true; 241 platnosc.Status_data = DateTime.Now; 242 _repPl.Update(platnosc); 243 } 244 } 261 245 } 262 246 } -
trunk/eCard/eCardMVC/Platnosci/Global.asax.cs
r871 r873 7 7 using System.Threading; 8 8 using System.Globalization; 9 using System.Configuration; 9 10 10 11 namespace Platnosci … … 17 18 public static void RegisterRoutes(RouteCollection routes) 18 19 { 20 19 21 routes.IgnoreRoute("elmah.axd"); 20 22 routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 21 23 24 routes.MapRoute( 25 "potwierdzenie", 26 "id={id}" + "&status={status}", 27 new { controller = "Platnosc", action = "Potwierdzenie"} 28 ); 22 29 routes.MapRoute( 23 30 "eCard", // Route name -
trunk/eCard/eCardMVC/Platnosci/Platnosci.Web.csproj
r867 r873 115 115 <Content Include="Global.asax" /> 116 116 <Content Include="Views\Merchant\Merchant.aspx" /> 117 <Content Include="Views\Platnosc\Potwierdzenie.aspx" />118 117 <Content Include="Views\Platnosc\Show.aspx" /> 119 118 <Content Include="Web.config" /> … … 197 196 <LastGenOutput>tlumaczenia.it.designer.cs</LastGenOutput> 198 197 </Content> 198 <Content Include="Views\Platnosc\Fail.aspx" /> 199 <Content Include="Views\Platnosc\Ok.aspx" /> 199 200 <Content Include="Views\Platnosc\Status.aspx" /> 200 201 </ItemGroup>
