Pokaż
Ignoruj:
Data:
2009-11-24 12:24:57 (16 years ago)
Autor:
alina
Opis:

re #215 zmiana parametrow w konstruktorze PlatnosciController?, dostosowanie testow do zmiany

Pliki:
1 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/eCard/eCardMVC/Platnosci/Controllers/PlatnoscController.cs

    r888 r896  
    2323    { 
    2424        public const string ISPAID = "payment_deposited";       //transakcja potwierdzona do rozliczenia 
    25         private readonly PlatnosciDataContext _context; 
    26         private readonly IDataContext _context1; 
    27         private readonly IRepository<PotwierdzeniaEcard> _rep; 
    28         private readonly IRepository<PlatnosciEcard> _repPl; 
     25        private readonly IRepository<vPlatnosciEcard> _repVPayment;        
     26        private readonly IRepository<PlatnosciEcard> _repPayment; 
     27        private readonly IRepository<PotwierdzeniaEcard> _repConfirm;        
    2928        private FunkcjePlatnosci _func; 
    3029        private string weryfikacja; 
     
    3736        public PlatnoscController() 
    3837        { 
    39             _context = new PlatnosciDataContext(); 
    40             _rep = new Repository<PotwierdzeniaEcard>(new DataContext1()); 
    41             _repPl = new Repository<PlatnosciEcard>(new DataContext1()); 
    42             _func = new FunkcjePlatnosci(); 
    43                        
    44         } 
    45         public PlatnoscController(IDataContext datacontext, int czy_test) 
    46         { 
    47             _rep = new Repository<PotwierdzeniaEcard>(datacontext); 
    48             _repPl = new Repository<PlatnosciEcard>(datacontext); 
    49             _context1 = datacontext; 
     38            _repVPayment = new Repository<vPlatnosciEcard>(new DataContext1()); 
     39            _repPayment = new Repository<PlatnosciEcard>(new DataContext1()); 
     40            _repConfirm = new Repository<PotwierdzeniaEcard>(new DataContext1()); 
     41            _func = new FunkcjePlatnosci();                       
     42        } 
     43        public PlatnoscController(IRepository<vPlatnosciEcard> repVPayment, IRepository<PlatnosciEcard> repPayment, IRepository<PotwierdzeniaEcard> repConfirm, int czy_test) 
     44        { 
     45            _repVPayment = repVPayment; 
     46            _repPayment = repPayment; 
     47            _repConfirm = repConfirm; 
    5048            _func = new FunkcjePlatnosci(); 
    5149            test = czy_test; 
     
    5755            int id1 = ConvertId(id); 
    5856 
    59             vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 
     57            vPlatnosciEcard platnosc = _repVPayment.Find(p => p.ID_faktury == id1).SingleOrDefault(); 
    6058            if (!String.IsNullOrEmpty(Iserror(platnosc).error)) return View("Error1", Iserror(platnosc)); 
    6159 
     
    6563            var invoiceDeatailsViewData = InitInvoiceDetailsViewData(platnosc, payer, "", kwota);   
    6664 
    67             var tablica_potwierdzenia = _rep.FindItemsByIdFaktury(id1); 
     65            var tablica_potwierdzenia = _repConfirm.FindItemsByIdFaktury(id1); 
    6866            if (tablica_potwierdzenia.Count > 0) //platnosc za fakture zostala uregulowana 
    6967            { 
     
    8179            language = _func.setLanguage(language); 
    8280            ustawTlumaczenia(test); 
    83             vPlatnosciEcard platnosc = _rep.FindInvoiceById(payer.Id_faktury).SingleOrDefault(); 
     81            vPlatnosciEcard platnosc = _repVPayment.Find(p => p.ID_faktury == payer.Id_faktury).SingleOrDefault(); 
    8482            if (!String.IsNullOrEmpty(Iserror(platnosc).error)) return View("Error1", Iserror(platnosc)); 
    8583             
     
    111109            ustawTlumaczenia(test); 
    112110            int id1 = ConvertId(id); 
    113             vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 
     111            vPlatnosciEcard platnosc = _repVPayment.Find(p => p.ID_faktury == id1).SingleOrDefault(); 
    114112            if (!String.IsNullOrEmpty(Iserror(platnosc).error)) return View("Error1", Iserror(platnosc));             
    115113             
     
    122120            ustawTlumaczenia(test); 
    123121            int id1 = ConvertId(id); 
    124             vPlatnosciEcard platnosc = _rep.FindInvoiceById(id1).SingleOrDefault(); 
     122            vPlatnosciEcard platnosc = _repVPayment.Find(p => p.ID_faktury == id1).SingleOrDefault(); 
    125123            if (!String.IsNullOrEmpty(Iserror(platnosc).error)) return View("Error1", Iserror(platnosc)); 
    126124             
     
    163161            potwierdzenie.WITHCVC = WITHCVC; 
    164162 
    165             _rep.Insert(potwierdzenie); 
     163            _repConfirm.Insert(potwierdzenie); 
    166164            UpdateStatus(ORDERNUMBER, CURRENTSTATE); 
    167165            return View(); 
     
    229227        public void UpdateStatus(int ordernumber, string currentstate) 
    230228        { 
    231             PlatnosciEcard platnosc = _repPl.FindOne(ordernumber); 
     229            PlatnosciEcard platnosc = _repPayment.Find(p => p.ORDERNUMBER == ordernumber).SingleOrDefault(); 
    232230            if (platnosc != null && currentstate == ISPAID) 
    233231            { 
    234232                platnosc.Status = true; 
    235233                platnosc.Status_data = DateTime.Now; 
    236                 _repPl.SubmitChanges(); 
     234                _repPayment.SubmitChanges(); 
    237235                 
    238236                System.Diagnostics.Debug.WriteLine("IsUpdate");