root/trunk/eCard/eCardMVC/adMoto.Payments.Web/Controllers/eCardController.cs @ 977

Wersja 977, 2.5 KB (wprowadzona przez marek, 16 years temu)

re #215 - nowy kontroler dla eCardu

RevLine 
[977]1using System;
2using System.Web.Mvc;
3using adMoto.Payments.Core;
4using adMoto.Payments.Core.Data;
5using adMoto.Payments.Core.Interfaces;
6using Elmah;
7
8namespace adMoto.Payments.Web.Controllers
9{
10// ReSharper disable InconsistentNaming
11    public class eCardController : Controller
12// ReSharper restore InconsistentNaming
13    {
14        private readonly IRepository<PotwierdzeniaEcard> _eCardRepository;
15       
16        public eCardController()
17        {
18            _eCardRepository = new Repository<PotwierdzeniaEcard>(new DataContext());
19        }
20
21        public eCardController(IRepository<PotwierdzeniaEcard> eCardRepository)
22        {
23            _eCardRepository = eCardRepository;
24        }
25       
26        public ActionResult Status()
27        {
28            var content = new ContentResult();
29
30            try
31            {
32                if (System.Web.HttpContext.Current != null)
33                    ErrorSignal.FromCurrentContext().Raise(new Exception(), System.Web.HttpContext.Current);
34
35                var potwierdzenie = new PotwierdzeniaEcard();
36
37                potwierdzenie.MERCHANTNUMBER = Request["MERCHANTNUMBER"];
38                potwierdzenie.ORDERNUMBER = Convert.ToInt32(Request["ORDERNUMBER"]);
39                potwierdzenie.COMMTYPE = Request["COMMTYPE"];
40                potwierdzenie.CURRENTSTATE = Request["CURRENTSTATE"];
41                potwierdzenie.PREVIOUSSTATE = Request["PREVIOUSSTATE"];
42                potwierdzenie.PAYMENTTYPE = Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTTYPE"]));
43                potwierdzenie.EVENTTYPE = Convert.ToBoolean(Convert.ToInt32(Request["EVENTTYPE"]));
44                potwierdzenie.PAYMENTNUMBER = Convert.ToBoolean(Convert.ToInt32(Request["PAYMENTNUMBER"]));
45                potwierdzenie.APPROVALCODE = Request["APPROVALCODE"];
46                potwierdzenie.VALIDATIONCODE = Request["VALIDATIONCODE"];
47                potwierdzenie.BIN = Request["BIN"];
48                potwierdzenie.AUTHTIME = Convert.ToDateTime(Request["AUTHTIME"]);
49                potwierdzenie.TYPE = Request["TYPE"];
50                potwierdzenie.WITHCVC = Request["WITHCVC"];
51
52                _eCardRepository.Insert(potwierdzenie);
53
54                content.Content = "OK";
55            }
56            catch (Exception ex)
57            {
58                ErrorSignal.FromCurrentContext().Raise(ex);
59                content.Content = "FALSE " + ex.Message + " " + ex.GetType();
60            }
61
62            return content;
63        }
64    }
65}
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.