Esempio n. 1
0
 public static KoloWin.CustomerService.Model.KoloMadDetails DoSendMad(ref KoloWin.CustomerService.Model.KoloMadDetails koloMadDetails, out string error)
 {
     error = "";
     try
     {
         var Context = new KoloAndroidEntities();
         ExWebSvc4Mad.KoloMadDetails wsKoloMadDetails = new ExWebSvc4Mad.ExWebSvcSoapClient().SendKoloMad(koloMadDetails.WsKoloMadDetails());
         if (wsKoloMadDetails != null)
         {
             Model.KoloMadDetails.KoloMadDetailsFromWs(ref koloMadDetails, wsKoloMadDetails);
             TransferGravity transfertGravity = koloMadDetails.GenerateTransferGravity();
             Tuple <List <KoloNotification>, List <CustomerBalanceHistory> > tuple = OperationHelper.MakeOperation <TransferGravity>(transfertGravity, Context, out error);
             Context.KoloNotifications.AddRange(tuple.Item1);
             Context.CustomerBalanceHistories.AddRange(tuple.Item2);
             Context.TransferGravities.Add(transfertGravity);
             Context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         error = ExceptionHelper.GetExceptionMessage(ex);
     }
     return(koloMadDetails);
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        public static bool DoTopUp(TopUpDetails topUpDetails, out string error)
        {
            error = "";
            TopUp topUp = topUpDetails.GeneraTopUp();

            ExRMoneySvc.ExRMoneySoapClient exMoneyClient = new ExRMoneySvc.ExRMoneySoapClient();
            if (!CustomerHistoryHelper.CheckCustomerBalance(topUp.IdCustomer, Int32.Parse(topUp.Amount)))
            {
                error = "INSUFFISANT BANLANCE";
                return(false);
            }
            var result = exMoneyClient.SendAirTime(topUpDetails.SelectedPartner, topUpDetails.Amount, topUpDetails.Number);

            error = result.Error;
            if (result.Succes)
            {
                KoloAndroidEntities Context = new KoloAndroidEntities();
                Tuple <List <KoloNotification>, List <CustomerBalanceHistory> > tuple = OperationHelper.MakeOperation <TopUp>(topUp, Context, out error);
                Context.KoloNotifications.AddRange(tuple.Item1);
                Context.CustomerBalanceHistories.AddRange(tuple.Item2);
                Context.TopUps.Add(topUp);
                topUp.OpDate = DateTime.Now;
                try
                {
                    Context.SaveChanges();
                }
                catch (Exception ex)
                {
                    error = ExceptionHelper.GetExceptionMessage(ex);
                }
                Context.Dispose();
            }
            return(result.Succes);
        }