public string DoRegistration(string jsonReg) { string error = ""; var inReg = SerializationHelper.DeserializeFromJsonString <Registration>(jsonReg); var context = new KoloAndroidEntities4Serialization(); var outReg = RegistrationHelper.DoRegistration(inReg, context, out error); KoloWsObject <Registration> koloWs = new KoloWsObject <Registration>(error, outReg); context.Dispose(); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string DoConfirmRegistration(string jsonReg) { string error = ""; var registration = SerializationHelper.DeserializeFromJsonString <Registration>(jsonReg); var context = new KoloAndroidEntities4Serialization(); var customer = RegistrationHelper.DoRegistrationConfirmation(registration, context, out error); KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error, customer); context.Dispose(); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string DoLogin(string jsonLogAttempt) { string error = ""; var logAttempt = SerializationHelper.DeserializeFromJsonString <LoginAttempt>(jsonLogAttempt); var context = new KoloAndroidEntities4Serialization(); LoginHelper.DoLogin(ref logAttempt, context, out error); KoloWsObject <LoginAttempt> koloWs = new KoloWsObject <LoginAttempt>(error, logAttempt); context.Dispose(); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public static MobileDevice InsertMobileDevice(ref MobileDevice myMobile, KoloAndroidEntities4Serialization db, out string error) { error = ""; try { db.MobileDevices.Add(myMobile); db.SaveChanges(); } catch (Exception e) { error = ExceptionHelper.GetExceptionMessage(e); } return(myMobile); }
public string GetEneoBillPaymentHistory(int jsonIdCustomer) { string error = ""; List <EneoBillPayment> eBPs = null; var context = new KoloAndroidEntities4Serialization(); Customer customer = context.Customers.FirstOrDefault(c => c.IdCustomer == jsonIdCustomer); eBPs = context.EneoBillPayments.Where(e => e.IdCustomer == jsonIdCustomer).ToList(); List <EneoBillDetails> eBDs = null; if (eBPs != null) { eBDs = eBPs.Select(e => new EneoBillDetails(e)).ToList(); } KoloWsObject <List <EneoBillDetails> > koloWs = new KoloWsObject <List <EneoBillDetails> >(error, eBDs); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
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); } }