public string ConvertToBusinessAccount(string jsonCustomer) { string error = ""; Customer customer = SerializationHelper.DeserializeFromJsonString <Customer>(jsonCustomer); if (customer.Business == null) { error = "Aucun paramtres de Compte Business Entrée"; KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error); var result = SerializationHelper.SerializeToJson(koloWs); return(result); } else if (customer.Person == null) { error = "Aucun paramtres de la personne Entrée"; KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error); var result = SerializationHelper.SerializeToJson(koloWs); return(result); } else { var context = new KoloAndroidEntities(); Business business = context.Businesses.Add(customer.Business); BusinessContact businessContact = context.BusinessContacts.Add(new BusinessContact() { IdBusiness = customer.IdCustomer, IdContact = customer.IdCustomer }); context.SaveChanges(); KoloWsObject <Business> koloWs = new KoloWsObject <Business>(error, business); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); } }
public string GetCustomerByIdCustomerAndNumber(int idCustomer, string number) { var Context = new KoloAndroidEntities(); SimpleContact simpleContact = new SimpleContact() { FirstName = "name...", LastName = "Full", Telephone = "Phone number..." }; Customer outCustomer; var customerQuery = Context.Customers.Include("MobileDevice").Include("Person").Include("Registration"); if (idCustomer > 0) { outCustomer = customerQuery.Where(e => e.IdCustomer == idCustomer).FirstOrDefault(); } else { outCustomer = customerQuery.Where(e => e.Registration.PhoneNumber == number).FirstOrDefault(); } if (outCustomer != null) { simpleContact = new SimpleContact(outCustomer); } KoloWsObject <SimpleContact> koloWs = new KoloWsObject <SimpleContact>("", simpleContact); var result = SerializationHelper.SerializeToJson(koloWs); Context.Dispose(); return(result); }
public string DoAcceptTransfertA2A(string jsonP2pTransfertDetails) { string error = ""; var Context = new KoloAndroidEntities(); var p2pTransfertDetails = SerializationHelper.DeserializeFromJsonString <P2pTransferDetails>(jsonP2pTransfertDetails); var p2P = Context.TransfertP2p.FirstOrDefault(t => t.IdReceiverCustomer == p2pTransfertDetails.ReceiverIdCustomer && t.IdSendingCustomer == p2pTransfertDetails.ReceiverIdCustomer && t.Reference == p2pTransfertDetails.Reference); if (p2P.NeedsConfirmation) { p2P = TransfertP2PHelper.AskConfirmationOfTransfertA2A(p2P, Context, out error); } if (!p2P.NeedsConfirmation) { p2P = TransfertP2PHelper.ConfirmTransfertA2A(p2P, Context, out error); } if (string.IsNullOrEmpty(p2P.Secret)) { p2P.Secret = "HIDDEN BY CYBERIX"; } p2pTransfertDetails = new P2pTransferDetails(p2P); KoloWsObject <P2pTransferDetails> koloWs = new KoloWsObject <P2pTransferDetails>(error, p2pTransfertDetails); var result = SerializationHelper.SerializeToJson(koloWs); Context.Dispose(); return(result); }
public string UpdateBusinessAccount(string jsonBusinessAccount) { string error = ""; Business business = SerializationHelper.DeserializeFromJsonString <Business>(jsonBusinessAccount); if (business == null) { error = "Aucun paramtres de Compte Business Entrée"; KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error); var result = SerializationHelper.SerializeToJson(koloWs); return(result); } else { var context = new KoloAndroidEntities(); Business businessAccount = context.Businesses.FirstOrDefault(b => b.IdCustomer == business.IdCustomer); businessAccount.BusinessName = businessAccount.BusinessName ?? businessAccount.BusinessName; businessAccount.IndustryCategoryCode = business.IndustryCategoryCode ?? businessAccount.IndustryCategoryCode; businessAccount.RefIndustryCategory = business.RefIndustryCategory ?? businessAccount.RefIndustryCategory; context.SaveChanges(); KoloWsObject <Business> koloWs = new KoloWsObject <Business>(error, businessAccount); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); } }
public string GetMADFees(int montant) { string error = ""; var idMad = Madhelper.GetMADFees(montant, out error); KoloWsObject <int> koloWs = new KoloWsObject <int>(error, idMad); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string FindManagerCustomerByCustomerCode(string customerCode) { string error = ""; var managerCustomer = Madhelper.FindManagerCustomerByCustomerCode(customerCode, out error); KoloWsObject <string> koloWs = new KoloWsObject <string>(error, managerCustomer); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string GetEneoBillsByBillAccount(string jsonBillAccount) { string error = ""; List <EneoBillDetails> eBDs = EneoHelper.GetEneoBillsByBillAccount(jsonBillAccount, out error); KoloWsObject <List <EneoBillDetails> > koloWs = new KoloWsObject <List <EneoBillDetails> >(error, eBDs); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string DoPayEneoBill(string jsonBillNumber, string jsonCustomer) { string error = ""; var reference = EneoHelper.DoPayENEO(jsonBillNumber, jsonCustomer, out error); KoloWsObject <string> koloWs = new KoloWsObject <string>(error, reference); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string GetExternalAccountsHistoriesGlobal(int jsonIdCustomer) { string error = ""; List <ExternalAccountHistory> externalAccountHistories = ExternalAccountHelper.GetExternalAccountsHistoriesGlobal(jsonIdCustomer, out error); KoloWsObject <List <ExternalAccountHistory> > koloWs = new KoloWsObject <List <ExternalAccountHistory> >(error, externalAccountHistories); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string DoTopUp(string jsonTopUp) { string error = ""; TopUpDetails topDetails = SerializationHelper.DeserializeFromJsonString <TopUpDetails>(jsonTopUp); var success = TopUpHelper.DoTopUp(topDetails, out error); KoloWsObject <TopUpDetails> koloWs = new KoloWsObject <TopUpDetails>(success, error, topDetails); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string GetExternalAccountsHistoriesSpecific(string jsonExternalAccount) { string error = ""; ExternalAccount externalAccount = SerializationHelper.DeserializeFromJsonString <ExternalAccount>(jsonExternalAccount); List <ExternalAccountHistory> externalAccountHistories = ExternalAccountHelper.GetExternalAccountsHistoriesSpecific(externalAccount, out error); KoloWsObject <List <ExternalAccountHistory> > koloWs = new KoloWsObject <List <ExternalAccountHistory> >(error, externalAccountHistories); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string UpdateExternalAccount(string jsonExternalAccount) { string error = ""; ExternalAccount externalAccount = SerializationHelper.DeserializeFromJsonString <ExternalAccount>(jsonExternalAccount); var tmp = ExternalAccountHelper.UpdateExternalAccount(externalAccount, out error); KoloWsObject <ExternalAccount> koloWs = new KoloWsObject <ExternalAccount>(error, tmp); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string RemoveExternalAccount(string jsonExternalAccount) { string error = ""; ExternalAccount externalAccount = SerializationHelper.DeserializeFromJsonString <ExternalAccount>(jsonExternalAccount); var isRemoved = ExternalAccountHelper.RemoveExternalAccount(externalAccount, out error); KoloWsObject <ExternalAccount> koloWs = new KoloWsObject <ExternalAccount>(isRemoved, error, externalAccount); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string FindCustomerMad(string jsonMadCustomer) { string error = ""; KoloMadCustomer madCustomer = SerializationHelper.DeserializeFromJsonString <KoloMadCustomer>(jsonMadCustomer); Madhelper.FindCustomerMad(ref madCustomer, out error); KoloWsObject <KoloMadCustomer> koloWs = new KoloWsObject <KoloMadCustomer>("", madCustomer); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string DoSendMad(string jsonKoloMadDetails) { string error = ""; KoloMadDetails koloMadDetails = SerializationHelper.DeserializeFromJsonString <KoloMadDetails>(jsonKoloMadDetails); Madhelper.DoSendMad(ref koloMadDetails, out error); KoloWsObject <KoloMadDetails> koloWs = new KoloWsObject <KoloMadDetails>(error, koloMadDetails); var result = SerializationHelper.SerializeToJson(koloWs); return(result); }
public string GetCustomerAccount(int idCustomer) { var Context = new KoloAndroidEntities(); Customer outCustomer = Context.Customers .Include("MobileDevice").Include("Person").Include("Registration") .FirstOrDefault(e => e.IdCustomer == idCustomer); KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>("", outCustomer); var result = SerializationHelper.SerializeToJson(koloWs); Context.Dispose(); return(result); }
public string GetParameters() { var Context = new KoloAndroidEntities(); ParameterInfo parameters = new ParameterInfo(); String error; parameters.Refresh(Context, out error); KoloWsObject <ParameterInfo> koloWs = new KoloWsObject <ParameterInfo>(error, parameters); var result = SerializationHelper.SerializeToJson(koloWs); Context.Dispose(); return(result); }
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 GetCustomerBalanceHistory(int jsonIdCustomer) { string error = ""; List <CustomerBalanceHistory> cBHs = null; var context = new KoloAndroidEntities(); cBHs = context.CustomerBalanceHistories.Where(c => c.IdCustomerAccount == jsonIdCustomer).ToList(); KoloWsObject <List <CustomerBalanceHistory> > koloWs = new KoloWsObject <List <CustomerBalanceHistory> >(error, cBHs); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); 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 UpdateProfileImage(string jsonIdCustomer) { string error = ""; List <KoloNotification> cBHs = null; var context = new KoloAndroidEntities(); cBHs = context.KoloNotifications.Where(c => c.IdCustomer == 1).ToList(); KoloWsObject <List <KoloNotification> > koloWs = new KoloWsObject <List <KoloNotification> >(error, cBHs); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
public string CancelBill(int jsonIdBill) { KoloAndroidEntities context = new KoloAndroidEntities(); Bill bill = context.Bills.FirstOrDefault(b => b.IdBill == jsonIdBill); bill.CodeRefBillStatus = KoloConstants.Operation.BillStatus.CANCELED.ToString(); context.SaveChanges(); KoloWsObject <Bill> koloWs = new KoloWsObject <Bill>(true, "", null); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); 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 string AddMobileDevice(string jsonMobileDevice) { string error = ""; MobileDevice mobileDevice = SerializationHelper.DeserializeFromJsonString <MobileDevice>(jsonMobileDevice); var context = new KoloAndroidEntities(); context.MobileDevices.Add(mobileDevice); context.SaveChanges(); KoloWsObject <MobileDevice> koloWs = new KoloWsObject <MobileDevice> (error, mobileDevice); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
public string GetCustomerNotifications(int jsonIdCustomer) { string error = ""; List <KoloNotification> cBHs = null; var context = new KoloAndroidEntities(); context.Configuration.ProxyCreationEnabled = false; cBHs = context.KoloNotifications.Where(c => c.IdCustomer == jsonIdCustomer).ToList(); KoloWsObject <List <KoloNotification> > koloWs = new KoloWsObject <List <KoloNotification> >(error, cBHs); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
public string DoTransfertA2A(string jsonTransfertP2p) { string error = ""; var tP2P = SerializationHelper.DeserializeFromJsonString <TransfertP2p>(jsonTransfertP2p); var Context = new KoloAndroidEntities(); tP2P = TransfertP2PHelper.SendTransfertA2A(tP2P, Context, out error); if (string.IsNullOrEmpty(tP2P.Secret)) { tP2P.Secret = "HIDDEN BY CYBERIX"; } KoloWsObject <TransfertP2p> koloWs = new KoloWsObject <TransfertP2p>(error, tP2P); var result = SerializationHelper.SerializeToJson(koloWs); Context.Dispose(); return(result); }
public string SendBill(string jsonBillDetails) { BillDetails billDetails = SerializationHelper.DeserializeFromJsonString <BillDetails>(jsonBillDetails); KoloAndroidEntities context = new KoloAndroidEntities(); Tuple <Bill, BillDetail> tuple = billDetails.GetBillAndDetails(); Bill bill = tuple.Item1; BillDetail billDetail = tuple.Item2; bill.BillDetails.Add(billDetail); context.Bills.Add(bill); context.SaveChanges(); KoloWsObject <Bill> koloWs = new KoloWsObject <Bill>("", bill); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
public string RevokeMobileDevice(string jsonIdMobileDevice) { string error = ""; MobileDevice mobileDevice = SerializationHelper.DeserializeFromJsonString <MobileDevice>(jsonIdMobileDevice); var context = new KoloAndroidEntities(); context.Configuration.ProxyCreationEnabled = false; var tmp = context.MobileDevices.FirstOrDefault(c => c.IdMobileDevice == mobileDevice.IdMobileDevice); tmp.isActive = false; context.SaveChanges(); KoloWsObject <MobileDevice> koloWs = new KoloWsObject <MobileDevice>(error, tmp); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
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 string UpdateCustomerAccount(string jsonCustomer) { string error = ""; Customer customer = SerializationHelper.DeserializeFromJsonString <Customer>(jsonCustomer); var context = new KoloAndroidEntities(); var tmp = context.Customers.Include("Person").FirstOrDefault(c => c.IdCustomer == customer.IdCustomer); MobileDevice mobileDevice = null; if (customer.MobileDevices[0] != null) { mobileDevice = context.MobileDevices.FirstOrDefault(m => m.IdCustomer == customer.IdCustomer && m.IdMobileDevice == customer.MobileDevices[0].IdMobileDevice); } CustomerHelper.UpdateCustomerAccount(ref tmp, customer, ref mobileDevice, context, out error); context.SaveChanges(); KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error, tmp); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }