예제 #1
0
      private void InfoForm_Load(object sender, EventArgs e) {
         try {
            using(var objProvider = new BankProvider()) {
               List<Bank> objBanks = objProvider.GetAllBanks();
               comboBox1.Items.AddRange(objBanks.ToArray());

               CurrencyExchanger objExchanger = objProvider.GetExchangerById(iExchangerId);
               comboBox1.SelectedIndex = comboBox1.Items.IndexOf(objExchanger.Bank);
               textBox1.Text = objExchanger.X.ToString();
               textBox2.Text = objExchanger.Y.ToString();
               textBox3.Text = objExchanger.Phone;
               textBox4.Text = objExchanger.Address;
               textBox6.Text = objExchanger.WorkTime;
               textBox5.Text = objExchanger.OpenDate.ToString();
               if(objExchanger.Number != null) {
                  numericUpDown1.Value = (decimal)objExchanger.Number;
               }

               //usd
               label14.Text = objProvider.GetRateByBank("USD", objExchanger.Bank).Buy.ToString();
               label15.Text = objProvider.GetRateByBank("USD", objExchanger.Bank).Sale.ToString();
               //eur
               label16.Text = objProvider.GetRateByBank("EUR", objExchanger.Bank).Buy.ToString();
               label17.Text = objProvider.GetRateByBank("EUR", objExchanger.Bank).Sale.ToString();
               //rur
               label18.Text = objProvider.GetRateByBank("RUR", objExchanger.Bank).Buy.ToString();
               label19.Text = objProvider.GetRateByBank("RUR", objExchanger.Bank).Sale.ToString();
            }
         }
         catch(Exception ex) {
            MessageBox.Show(ex.Message);
         }
      }
예제 #2
0
      /// <summary>
      /// draw all CurrencyExchangers markers on map
      /// </summary>
      private void DrawMarkers() {
         try {
            using(var objProvider = new BankProvider()) {
               objMarkersOverlay.Clear();
               List<CurrencyExchanger> objExchangers = objProvider.GetAllExchangers();

               foreach(var exchanger in objExchangers) {
                  ExchangeRate objUsd = objProvider.GetRateByBank("USD", exchanger.Bank);
                  ExchangeRate objEur = objProvider.GetRateByBank("EUR", exchanger.Bank);
                  ExchangeRate objRur = objProvider.GetRateByBank("RUR", exchanger.Bank);

                  var objMarker = new GMarkerGoogle(new PointLatLng(exchanger.X, exchanger.Y), GMarkerGoogleType.yellow) {
                     ToolTipText = String.Format(
                        "{0} office:{1}\nBuy\n" +
                           "USD:{2}\nEUR:{3}\nRUR:{4}\n" +
                           "Sell\n" +
                           "USD:{5}\nEUR:{6}\nRUR:{7}",
                        exchanger.Bank.Name,
                        exchanger.Number,
                        objUsd.Buy,
                        objEur.Buy,
                        objRur.Buy,
                        objUsd.Sale,
                        objEur.Sale,
                        objRur.Sale
                        ),
                     Tag = exchanger.Id
                  };

                  objMarkersOverlay.Markers.Add(objMarker);
                  gMapControl1.UpdateMarkerLocalPosition(objMarker);
               }
            }
            gMapControl1.Overlays.Clear();
            gMapControl1.Overlays.Add(objMarkersOverlay);
         }
         catch(Exception ex) {
            MessageBox.Show(ex.Message);
         }
      }
예제 #3
0
      /// <summary>
      /// update marker info
      /// </summary>
      private void UpdateMarkers() {
         try {
            using(var objProvider = new BankProvider()) {
               foreach(var marker in objMarkersOverlay.Markers) {
                  CurrencyExchanger objExchanger = objProvider.GetExchangerById((int)marker.Tag);

                  ExchangeRate objUsd = objProvider.GetRateByBank("USD", objExchanger.Bank);
                  ExchangeRate objEur = objProvider.GetRateByBank("EUR", objExchanger.Bank);
                  ExchangeRate objRur = objProvider.GetRateByBank("RUR", objExchanger.Bank);

                  marker.ToolTipText = String.Format(
                     "{0} office:{1}\nBuy\n" +
                        "USD:{2}\nEUR:{3}\nRUR:{4}\n" +
                        "Sell\n" +
                        "USD:{5}\nEUR:{6}\nRUR:{7}",
                     objExchanger.Bank.Name,
                     objExchanger.Number,
                     objUsd.Buy,
                     objEur.Buy,
                     objRur.Buy,
                     objUsd.Sale,
                     objEur.Sale,
                     objRur.Sale
                     );

                  var objPositon = new PointLatLng(objExchanger.X, objExchanger.Y);
                  if(marker.Position != objPositon) {
                     marker.Position = objPositon;
                  }
                  gMapControl1.UpdateMarkerLocalPosition(marker);
               }
            }
         }
         catch(Exception ex) {
            MessageBox.Show(ex.Message);
         }
      }