public EneoBillDetails(EneoBillPayment eBP) { this.DueDate = eBP.PaymentDate; this.Amount = eBP.BillAmount; this.BillNumber = eBP.BillNumber; this.ContractNumber = eBP.ContractNo; this.Reference = eBP.Reference; }
public static string DoPayENEO(string numeroFacture, string idCustomer, out string error) { error = ""; try { int id = Int32.Parse(idCustomer); var Context = new KoloAndroidEntities4Serialization(); Customer c = Context.Customers.Include("Person").Include("MobileDevices").FirstOrDefault(customer => customer.IdCustomer == id); ExEneoSvc.ExEneoSoapClient exWS4Kolo = new ExEneoSvc.ExEneoSoapClient(); var tmp = exWS4Kolo.PayENEO(c.MobileDevices[0].LineNumber, numeroFacture, c.Person.Firstname + " " + c.Person.Lastname); EneoBillPayment eBP = new EneoBillPayment(); if (tmp.IsSucces) { eBP.BillAmount = (int)tmp.DataObject.PaidAmount; eBP.BillNumber = numeroFacture; eBP.Ccion = (int)tmp.DataObject.Ccions; eBP.ContractNo = tmp.DataObject.BillAccountNumber; eBP.IdCustomer = c.IdCustomer; eBP.Customer = c; eBP.PaymentDate = tmp.DataObject.PaidDate; eBP.Reference = tmp.DataObject.TransactionId; } else { error = tmp.ErrorMessage; return(null); } Tuple <List <KoloNotification>, List <CustomerBalanceHistory> > tuple = OperationHelper.MakeOperation <EneoBillPayment>(eBP, Context, out error); Context.KoloNotifications.AddRange(tuple.Item1); Context.CustomerBalanceHistories.AddRange(tuple.Item2); Context.EneoBillPayments.Add(eBP); Context.SaveChanges(); Context.Dispose(); return(tmp.DataObject.TransactionId); } catch (Exception ex) { error = ExceptionHelper.GetExceptionMessage(ex); return(null); } }