public paymentEntity createBillHelp(inTimeReqPara para) { var billNoTmp = para.ReqId + DateTime.Now.Ticks; var res = new paymentEntity { BillNo = billNoTmp }; var bankEnt = new bankEntity { PayId = billNoTmp }; var t = Task.Factory.StartNew(() => { using (var req = new BankServiceClient()) { req.processPaymentHelp(bankEnt); } }); var ip = "jimmyMStation";//"172.16.144.70"; var port = 6379; using (var help = helpBase.init(ip, port, new TimeSpan(0, 5, 0))) { var ts = new TimeSpan(0, 5, 0); help.set(bankEnt.PayId, para.ReqId, ts); } t.Wait(100); return(res); }
public List <BankDto> GetBankList() { UserDto currentUserDto = (UserDto)Session[Constants.SKCURRENTUSER]; Query query = new Query(); if (Helper.IsCAIdNotNull(currentUserDto)) { query.CAId = Convert.ToInt32(Helper.GetCAIdOfUser(currentUserDto)); } if (Helper.IsCAIdNotNull(currentUserDto)) { Criterion criteriaCAId = new Criterion(Constants.CAID, Helper.GetCAIdOfUser(currentUserDto), CriteriaOperator.Equal); query.Add(criteriaCAId); Criterion criteriaCAIdNULL = new Criterion(Constants.CAID, null, CriteriaOperator.IsNullOrZero); query.Add(criteriaCAIdNULL); query.QueryOperator = QueryOperator.Or; } else { Criterion criteriaCAIdNULL = new Criterion(Constants.CAID, null, CriteriaOperator.IsNullOrZero); query.Add(criteriaCAIdNULL); query.QueryOperator = QueryOperator.And; } Bankclient = new BankServiceClient(); var Banks = Bankclient.FindByQuery(query); Bankclient.Close(); return(Banks.Entities.ToList()); }
public override bool Execute() { if (IdBankAccount <= 0) { Information = StringSource.BankAccountNotFound(); return(false); } using (var service = new BankServiceClient()) { BankAccount = service.GetBankAccountById(IdBankAccount); if (BankAccount != null) { service.RemoveBankAccount(BankAccount); Information = StringSource.BankAccountRemoved(); return(true); } else { Information = StringSource.BankAccountNotFound(); return(false); } } }
public paymentEntity createBill(inTimeReqPara para) { var billNoTmp = para.ReqId + DateTime.Now.Ticks; var res = new paymentEntity { BillNo = billNoTmp }; var bankEnt = new bankEntity { PayId = billNoTmp }; var t = Task.Factory.StartNew(() => { using (var req = new BankServiceClient()) { req.processPayment(bankEnt); } } ); var ip = "jimmyMStation";//"172.16.144.70"; var port = 6379; try { using (var help = helpBase.init(ip, port, new TimeSpan(0, 5, 0))) { var strTmp = JsonSerializer.SerializeToString(new { reqId = para.ReqId, billno = billNoTmp }); var ts = new TimeSpan(0, 5, 0); help.set(bankEnt.PayId, strTmp, ts); } } catch (Exception e) { Console.WriteLine(e); } t.Wait(100); return res; }
public async Task <IActionResult> History(string id) { var bankService = new BankServiceClient(); var operations = await bankService.GetAccountHistoryAsync(id); return(View(operations)); }
public async Task <IActionResult> Transfer(string id, TransferViewModel transferViewModel, string returnUrl) { if (!ModelState.IsValid) { ViewData["ReturnUrl"] = returnUrl; return(View(transferViewModel)); } var bankService = new BankServiceClient(); var operation = new Operation { SourceId = id, DestinationId = transferViewModel.DestinationId, Amount = transferViewModel.Amount, Title = transferViewModel.Title, OperationType = Operation.OperationTypes.Transfer }; try { await bankService.ExecuteOperationAsync(operation); } catch (FaultException exception) { ViewData["Error"] = exception.Message; return(View()); } return(RedirectToAction("Overview")); }
public async Task <IActionResult> Payment(string id, PaymentViewModel paymentViewModel, string returnUrl) { if (!ModelState.IsValid) { ViewData["ReturnUrl"] = returnUrl; ViewData["Title"] = "Payment"; return(View(paymentViewModel)); } var bankService = new BankServiceClient(); var operation = new Operation { Amount = paymentViewModel.Amount, DestinationId = id, SourceId = "Payment", Title = "Payment", OperationType = Operation.OperationTypes.Payment }; try { await bankService.ExecuteOperationAsync(operation); } catch (FaultException exception) { ViewData["Title"] = "Payment"; ViewData["Error"] = exception.Message; return(View("Payment")); } return(RedirectToAction("Overview")); }
public async Task <IActionResult> CreateAccount() { var bankService = new BankServiceClient(); var result = await bankService.CreateAccountAsync(await HttpContext.Authentication.GetSessionId()); return(RedirectToAction("Overview")); }
public async Task <IActionResult> DeleteAccount(string id) { var bankService = new BankServiceClient(); var result = await bankService.DeleteAccountAsync(id); return(RedirectToAction("Overview")); }
static void Main(string[] args) { BankServiceClient client = new BankServiceClient(); var x = client.GetMessage(); List <DataContracts.BankMaster> lstBank = GetBankDetails("ICICI"); }
public Customer GetCustomerByTcNo(long tcNo) { Customer c = new Customer(); c.TCNo = tcNo; BankServiceClient bankService = new BankServiceClient(); List <Gateway.BankServiceReferance.WorkingBank> workingBanks = bankService.GetWorkingBankByTcNo(tcNo).ToList(); List <Bank> banks = new List <Bank>(); banks = workingBanks.Select(i => new Bank() { BankID = i.BankId, BankaAdi = i.BankName }).ToList(); c.WorkingBanks = banks; CreditNoteServiceClient creditNoteService = new CreditNoteServiceClient(); c.CreditNote = creditNoteService.GetCreditNote(tcNo); CustomerModel cm = new CustomerModel(); c.CustomerName = cm.GetCustomerNameByTcNo(tcNo); return(c); }
static void Main(string[] args) { using (TransactionScope scope = new TransactionScope()) { using (BankServiceClient proxy = new BankServiceClient()) { double money; do { Console.WriteLine("Enter money: "); money = Convert.ToDouble(Console.ReadLine()); try { proxy.FillAccount(money); Console.WriteLine("Account: " + proxy.GetBalance()); } catch (CommunicationException ex) { Console.WriteLine(ex.Message); } } while (money >= -1); } scope.Complete(); } }
public override bool Execute() { if (IdOperator <= 0) { Information = StringSource.OperatorNotFound(); return(false); } using (var bankservice = new BankServiceClient()) { Operator = bankservice.GetEmployeeById(IdOperator); if (Operator != null) { bankservice.RemoveEmployee(Operator); Information = StringSource.OperatorRemoved(); return(true); } else { Information = StringSource.OperatorNotFound(); return(false); } } }
protected void Button3_Click(object sender, EventArgs e) { int t3 = 2; if (Label4.Text == null) { RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please find the Bus stations first....');</script>"); } BankServiceClient ip1 = new BankServiceClient(); string t1 = TextBox1.Text; string t2 = TextBox2.Text; //Stores the input string string d = null; if (t2.Trim() == "" || t2.Trim() == "." || t2.Trim() == "-") { RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please enter a valid name from the list');</script>"); } else { d = String.Join("", ip1.GetData(t2, t1, t3)); } if (string.IsNullOrEmpty(d)) //If no store available { Label7.Text = "No Number available"; } else { Label7.Text = d; } }
protected void Button1_Click(object sender, EventArgs e) { Label4.Text = null; BankServiceClient ip = new BankServiceClient(); int t1 = 0; string name = null; string t = TextBox1.Text; //Stores the input string if (t.Trim() == "" || t.Trim() == "." || t.Trim() == "-") { RegisterStartupScript("startupScript", "<script language=JavaScript>alert('Please enter a valid ZipCode or Address');</script>"); } else { string d = String.Join("", ip.GetData(name, t, t1)); if (string.IsNullOrEmpty(d)) //If no store available { Label4.Text = "Please find the ATMs first"; //ViewState["Acc"] = 1; } else { Label4.Text = d; // ViewState["Acc"] = 1; } } }
public async Task <IActionResult> Overview() { var bankService = new BankServiceClient(); var sessionId = await HttpContext.Authentication.GetSessionId(); var accounts = await bankService.GetAccountsAsync(sessionId); return(View(accounts)); }
/// <summary> /// Gets list of client banks /// </summary> /// <param name="bankType">Bank type should be of client type</param> /// <returns>Returns banks of client type on page load.</returns> private BankSearchItem[] GetBanks(DataConstants.BankSearchTypes bankType) { BankServiceClient bankService = null; BankSearchItem[] banks = null; try { CollectionRequest collectionRequest = new CollectionRequest(); BankSearchCriteria criteria = new BankSearchCriteria(); criteria.IncludeArchived = false; criteria.BankSearchTypes = (int)bankType; bankService = new BankServiceClient(); BankSearchReturnValue returnValue = bankService.BankSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { banks = returnValue.Banks.Rows; } else { throw new Exception(returnValue.Message); } return(banks); } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; return(banks); } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; return(banks); } finally { if (bankService != null) { if (bankService.State != System.ServiceModel.CommunicationState.Faulted) { bankService.Close(); } } } }
//public async Task<IActionResult> Register(string userName, string password, string returnUrl) public async Task <IActionResult> Register(RegisterViewModel registerViewModel, string returnUrl) { if (!ModelState.IsValid) { return(View(registerViewModel)); } var bankService = new BankServiceClient(); var newUser = new User { UserName = registerViewModel.UserName, Password = registerViewModel.Password }; try { var serviceResponse = await bankService.RegisterUserAsync(newUser); var sessionId = await bankService.CreateSessionAsync(registerViewModel.UserName); if (serviceResponse) { //var claims = new List<Claim> { new Claim(ClaimTypes.Name, newUser.UserName) }; //var claimsIdentity = new ClaimsIdentity(claims, "password"); //var claimsPrinciple = new ClaimsPrincipal(claimsIdentity); //await HttpContext.Authentication.SignInAsync("Cookies", claimsPrinciple); //await HttpContext.Authentication.SignInAsync(registerViewModel.UserName); await HttpContext.Authentication.SignInAsync(sessionId); if (Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } return(Redirect("/")); } } catch (FaultException exception) { ViewData["ReturnUrl"] = returnUrl; ViewData["Error"] = exception.Message; return(View()); } return(View()); }
public bool RemoveClientInformationById(int IdClient, bool isRemoveClient = false) { Customer client; using (var localrepos = new Repositories()) { client = localrepos.Customers.GetSingle(IdClient); if (client == null) { return(false); } } if (client != null) { CardAccount[] cardaccounts = null; BankAccount bankaccount = null; using (var bankservice = new BankServiceClient()) { cardaccounts = bankservice.GetCardAccountsByCustomerId(client.CustomerID); if (cardaccounts != null) { for (int i = 0; i < cardaccounts.Length; i++) { bankaccount = bankservice.GetBankAccountById(cardaccounts[i].BankAccountID); if (bankaccount != null) { bankservice.RemoveBankAccount(bankaccount); } bankservice.RemoveCardAccount(cardaccounts[i]); } } } if (isRemoveClient) { using (var localrepos = new Repositories()) { localrepos.Customers.Remove(client); localrepos.SaveChanges(); } } } else { return(false); } return(true); }
static void Main(string[] args) { BankServiceClient proxy = new BankServiceClient(); Console.WriteLine("Enter sum of deposit:"); double sum = Convert.ToDouble(Console.ReadLine()); while (sum > 0) { proxy.ToDeposit(sum); sum = Convert.ToDouble(Console.ReadLine()); } Console.WriteLine("Press Enter to end...\n\n"); Console.ReadLine(); }
static void Main(string[] args) { using (TransactionScope scope = new TransactionScope()) { using (BankServiceClient client = new BankServiceClient()) { double money; do { Console.WriteLine("Enter money: "); money = Convert.ToInt32(Console.ReadLine()); } while (money > 0); } scope.Complete(); } }
public VMmanager(Utilizador logged) { this.serv = new BankServiceClient(); SelectedMail = null; SelectedContacto = null; SelectedUtilizadorAdicionar = null; UserLogged = logged; PesquisaContactos = ""; PesquisaMensagensNaoLidas = ""; PesquisaMensagensLidas = ""; PesquisaMensagensEnviadas = ""; PesquisaMensagensRascunhos = ""; PesquisaMensagensEliminados = ""; initCommand(); }
public override bool Execute() { if (!Verifier.CheckLogin(Login)) { Information = StringSource.LoginStructureError(); return(false); } if (!Verifier.CheckPassword(Password) || !Verifier.CheckPassword(NewPassword) || !Verifier.CheckPassword(NewPasswordCheck)) { Information = StringSource.PasswordStructureError(); return(false); } if (NewPassword != NewPasswordCheck) { Information = StringSource.PasswordNotIndentical(); return(false); } Employee admin = null; using (var bankservice = new BankServiceClient()) { var admines = bankservice.GetAllAdminEmployees(); if (admines != null && admines.Length > 0) { admines = admines.Where(el => el.Login == Login).ToArray(); if (admines.Length > 0) { admin = admines[0]; } } if (admin == null) { Information = StringSource.AdminNotFound(); return(false); } admin.Password = NewPassword; bankservice.UpdateEmployee(admin); } Information = StringSource.EditedIsTrue(); return(true); }
public override bool Execute() { if (IdBankAccount <= 0) { Information = StringSource.BankAccountNotFound(); return(false); } //if (IdCurrency <= 0) { // Information = StringSource.CurrencyNotFound(); // return false; //} if (!Verifier.CheckBalance(Balance)) { Information = StringSource.BalanceStructureError(); return(false); } //if (!Verifier.CheckPassword(Password)) { // Information = StringSource.PasswordStructureError(); // return false; //} using (var bankservice = new BankServiceClient()) { BankAccount = bankservice.GetBankAccountById(IdBankAccount); if (BankAccount != null) { //if (Password != BankAccount.Password) { // Information = StringSource.PasswordError(); // return false; //} BankAccount.Balance += double.Parse(Balance); //BankAccount.CurrencyID = IdCurrency; bankservice.UpdateBankAccount(BankAccount); BankAccountNumber = BankAccount.AcountNumber; Information = StringSource.BankAccountBalanceUp(); return(true); } } Information = StringSource.BankAccountNotFound(); return(false); }
static void Main(string[] args) { using (BankServiceClient proxy = new BankServiceClient(new InstanceContext(new CallbackHandler()))) { double money; Console.WriteLine("Enter name:"); proxy.IsLogin(Console.ReadLine()); // return; do { Console.WriteLine("Введіть суму грошей:"); money = Convert.ToDouble(Console.ReadLine()); proxy.PutMoney(money); Console.WriteLine("Balance: {0}", proxy.GetBalance()); } while (money > 0); proxy.Disconnect(); } }
static void Main(string[] args) { BankServiceClient proxy = new BankServiceClient(); Console.WriteLine("Введіть суму:"); double sum = Convert.ToDouble(Console.ReadLine()); double result = 0; while (sum > 0) { proxy.ToDeposit(sum); result = proxy.GetBalance(); Console.WriteLine("Депозит = {0}", result); Console.WriteLine("Введіть суму:"); sum = Convert.ToDouble(Console.ReadLine()); } Console.ReadLine(); }
static void Main(string[] args) { BankServiceClient proxy = new BankServiceClient(); Console.WriteLine("Укажите сумму депозита:"); double sum = Convert.ToDouble(Console.ReadLine()); double result = 0; while (sum > 0) { proxy.ToDeposit(sum); result = proxy.GetBalance(); Console.WriteLine("Депозит = {0}", result); Console.WriteLine("Укажите сумму депозита:"); sum = Convert.ToDouble(Console.ReadLine()); } Console.WriteLine("Для завершения нажмите<ENTER>\n\n"); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Welcome to the bank"); using (BankServiceClient proxy = new BankServiceClient()) { decimal value = proxy.GetBalance(); Console.WriteLine("The account balance is " + value); proxy.Deposit(400); value = proxy.GetBalance(); Console.WriteLine("We deposited some money, and the new balance is " + value); AccountInfo info = proxy.GetAccountInfo(); Console.WriteLine("Account is owned by " + info.OwnerName + " and has " + info.Balance + " money."); } Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
static void Main(string[] args) { BankServiceClient proxy = new BankServiceClient(new System.ServiceModel.InstanceContext(new CallbackHandler())); Console.WriteLine("Enter name:"); if (!proxy.IsLogIn(Console.ReadLine())) { return; } Console.WriteLine("Enter money:"); double money = Convert.ToDouble(Console.ReadLine()); while (money > 0) { proxy.PutMoney(money); Console.WriteLine("Balance: " + proxy.GetBalance()); Console.WriteLine("Enter money:"); money = Convert.ToDouble(Console.ReadLine()); } }
public override bool Execute() { using (var bankservice = new BankServiceClient()) { AllCurrencies = bankservice.GetAllCurrency(); } CurrenciesNames = new List <string>(); CurrenciesShortNames = new List <string>(); CurrenciesIds = new List <string>(); CurrenciesRates = new List <string>(); foreach (var el in AllCurrencies) { CurrenciesIds.Add(el.CurrencyID.ToString()); CurrenciesNames.Add(el.Name); CurrenciesRates.Add(el.Rate.ToString()); CurrenciesShortNames.Add(el.ShortName); } return(true); }
static void Main(string[] args) { using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { BankServiceClient proxy = new BankServiceClient(); Console.WriteLine("Укажите сумму депозита:"); double sum = Convert.ToDouble(Console.ReadLine()); double result = 0; while (sum > 0) { proxy.ToDeposit(sum); result = proxy.GetBalance(); Console.WriteLine("Депозит = {0}", result); Console.WriteLine("Укажите сумму депозита:"); sum = Convert.ToDouble(Console.ReadLine()); } scope.Complete(); } Console.WriteLine("Для завершения нажмите<ENTER>\n\n"); Console.ReadLine(); }
public paymentEntity createBill(inTimeReqPara para) { var billNoTmp = para.ReqId + DateTime.Now.Ticks; var res = new paymentEntity { BillNo = billNoTmp }; var bankEnt = new bankEntity { PayId = billNoTmp }; var t = Task.Factory.StartNew(() => { using (var req = new BankServiceClient()) { req.processPayment(bankEnt); } } ); var ip = "jimmyMStation";//"172.16.144.70"; var port = 6379; try { using (var help = helpBase.init(ip, port, new TimeSpan(0, 5, 0))) { var strTmp = JsonSerializer.SerializeToString(new { reqId = para.ReqId, billno = billNoTmp }); var ts = new TimeSpan(0, 5, 0); help.set(bankEnt.PayId, strTmp, ts); } } catch (Exception e) { Console.WriteLine(e); } t.Wait(100); return(res); }
public override bool Execute() { if (!Verifier.CheckLogin(Login)) { Information = StringSource.LoginStructureError(); return(false); } if (!Verifier.CheckPassword(Password) || !Verifier.CheckPassword(PasswordCheck)) { Information = StringSource.PasswordStructureError(); return(false); } if (Password != PasswordCheck) { Information = StringSource.PasswordNotIndentical(); return(false); } using (var bankservice = new BankServiceClient()) { Operator = bankservice.GetEmployeeByLogin(Login); } if (Operator != null) { Information = StringSource.LoginIsContains(); return(false); } using (var bankservice = new BankServiceClient()) { Operator = new Employee { Login = Login, Password = Password, IsAdmin = false }; bankservice.AddEmployee(Operator); } IdOperator = Operator.EmployeeID; Information = StringSource.OperatorRegistred(); return(true); }
public override bool Execute() { if (IdOperator <= 0) { Information = StringSource.OperatorNotFound(); return(false); } if (!Verifier.CheckLogin(Login)) { Information = StringSource.LoginStructureError(); return(false); } if (!Verifier.CheckPassword(Password)) { Information = StringSource.PasswordStructureError(); return(false); } using (var bankservice = new BankServiceClient()) { Operator = bankservice.GetEmployeeById(IdOperator); if (Operator == null) { Information = StringSource.OperatorNotFound(); return(false); } Operator.Login = Login; Operator.Password = Password; //Operator.IsAdmin=Is bankservice.UpdateEmployee(Operator); } Information = StringSource.OperatorEdited(); return(true); }
public Customer GetCustomerByTcNo(long tcNo) { Customer c = new Customer(); c.TCNo = tcNo; BankServiceClient bankService = new BankServiceClient(); List<Gateway.BankServiceReferance.WorkingBank> workingBanks=bankService.GetWorkingBankByTcNo(tcNo).ToList(); List<Bank> banks = new List<Bank>(); banks = workingBanks.Select(i => new Bank() { BankID=i.BankId, BankaAdi=i.BankName }).ToList(); c.WorkingBanks = banks; CreditNoteServiceClient creditNoteService = new CreditNoteServiceClient(); c.CreditNote=creditNoteService.GetCreditNote(tcNo); CustomerModel cm = new CustomerModel(); c.CustomerName= cm.GetCustomerNameByTcNo(tcNo); return c; }
/// <summary> /// Gets list of client banks /// </summary> /// <param name="bankType">Bank type should be of client type</param> /// <returns>Returns banks of client type on page load.</returns> private BankSearchItem[] GetBanks(DataConstants.BankSearchTypes bankType) { BankServiceClient bankService = null; BankSearchItem[] banks = null; try { CollectionRequest collectionRequest = new CollectionRequest(); BankSearchCriteria criteria = new BankSearchCriteria(); criteria.IncludeArchived = false; criteria.BankSearchTypes = (int)bankType; bankService = new BankServiceClient(); BankSearchReturnValue returnValue = bankService.BankSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { banks = returnValue.Banks.Rows; } else { throw new Exception(returnValue.Message); } return banks; } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; return banks; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; return banks; } finally { if (bankService != null) { if (bankService.State != System.ServiceModel.CommunicationState.Faulted) bankService.Close(); } } }
public paymentEntity createBillHelp(inTimeReqPara para) { var billNoTmp = para.ReqId + DateTime.Now.Ticks; var res = new paymentEntity { BillNo = billNoTmp }; var bankEnt = new bankEntity { PayId = billNoTmp }; var t = Task.Factory.StartNew(() => { using (var req = new BankServiceClient()) { req.processPaymentHelp(bankEnt); } }); var ip = "jimmyMStation";//"172.16.144.70"; var port = 6379; using (var help = helpBase.init(ip, port, new TimeSpan(0, 5, 0))) { var ts = new TimeSpan(0, 5, 0); help.set(bankEnt.PayId, para.ReqId, ts); } t.Wait(100); return res; }