private void AcceptTransaction_Clicked(object sender, EventArgs e)
        {
            decimal pln      = decimal.Parse(PlnAmount.Text);
            string  currency = CurrencySign.Text.ToString();

            WCFKantor.UserDetails user = new WCFKantor.UserDetails()
            {
                UserEmail = Login.emailUser.ToString()
            };
            WCFKantor.Service1Client    client   = new WCFKantor.Service1Client();
            Dictionary <string, string> userData = client.PobierzDane(user);
            string getExchange = client.GetExchangeRate(currency);
            int    a           = getExchange.LastIndexOf("i");

            getExchange = getExchange.Substring(a + 2);
            decimal exchange = decimal.Parse(getExchange, CultureInfo.InvariantCulture);
            decimal score    = decimal.Parse((pln / exchange).ToString("N4"));

            WCFKantor.Transactions transaction = new WCFKantor.Transactions()
            {
                UserID = Int32.Parse(userData["ID"]), Type = "KUP", Pln = pln, Currency = currency, Exchange = exchange, Score = score
            };
            string result = client.SetTransakcje(transaction);

            CheckLabel.Text = result;
            client.CloseAsync();
        }
        private void AcceptFoundBtn_Clicked(object sender, EventArgs e)
        {
            WCFKantor.UserDetails user = new WCFKantor.UserDetails();
            user.UserEmail = Login.emailUser;
            WCFKantor.Service1Client    client   = new WCFKantor.Service1Client();
            Dictionary <string, string> userData = client.PobierzDane(user);

            WCFKantor.AccountDetails currencyPLN = new WCFKantor.AccountDetails()
            {
                UserID = Int32.Parse(userData["ID"]), Currency = "PLN", Amount = Decimal.Parse(AmountPln.Text)
            };
            CheckLabel.Text = client.UpdateStanKonta(currencyPLN);
            client.CloseAsync();
        }
예제 #3
0
        public UserPanel()
        {
            InitializeComponent();
            WCFKantor.UserDetails user = new WCFKantor.UserDetails()
            {
                UserEmail = Login.emailUser
            };
            WCFKantor.Service1Client client = new WCFKantor.Service1Client();
            getUserData   = client.PobierzDane(user);
            UserName.Text = "Witaj " + getUserData["Imie"] + " " + getUserData["Nazwisko"];
            Dictionary <string, decimal> accountData = client.GetStanKonta(user);

            foreach (KeyValuePair <string, decimal> currency in accountData)
            {
                AccountInfo.Children.Add(new Label {
                    Text = currency.Key + ":"
                });
                AccountInfo.Children.Add(new Label {
                    Text = currency.Value.ToString()
                });
            }
            client.CloseAsync();
        }