private void button1_Click(object sender, EventArgs e) { ConverterSoapClient client = new ConverterSoapClient(); Double output = client.cTof(Convert.ToInt32(textBoxInput.Text)); sertviceOutput.Text = Convert.ToString(output); }
public string getCurrencyRate(String cur1, string cur2) { BasicHttpBinding httpBinding = new BasicHttpBinding(); EndpointAddress endPoint = new EndpointAddress(@"http://currencyconverter.kowabunga.net/converter.asmx"); var soapClient = new ConverterSoapClient(httpBinding, endPoint); var usdToinr = soapClient.GetConversionRate(cur1.ToString(), cur2.ToString(), DateTime.Now); return(usdToinr.ToString()); }
public decimal GetConversionRate() { decimal dConversionRate; ConverterSoapClient converterService = new ConverterSoapClient(); dConversionRate = converterService.GetConversionRate(DOLLAR_CURRENCY_CODE, SHEKEL_CURRENCY_CODE, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)); return(dConversionRate); }
public decimal convert(String fromCurrency, String toCurrency, decimal amount) { ConverterSoapClient converter = new ConverterSoapClient(); if (fromCurrency == "EUR") { return((converter.GetCurrencyRate(toCurrency, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day))) * amount); } else { return((converter.GetCurrencyRate(fromCurrency, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day))) / amount); } }
public ConverterSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(ConverterSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public ConverterSoapClient(EndpointConfiguration endpointConfiguration) : base(ConverterSoapClient.GetBindingForEndpoint(endpointConfiguration), ConverterSoapClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public void ConsumeSoapService(int x, int y) { ConverterSoapClient client = new ConverterSoapClient(ConverterSoapClient.EndpointConfiguration.ConverterSoap); Console.WriteLine(client.SimpleAdditionAsync(x, y).GetAwaiter().GetResult()); }
public void BindCourseGridView() { /// string selectedCoursesCodes = string.Join(",", (HashSet <int>)Session["SelectedCourseTimeCode"]); if (string.IsNullOrEmpty(selectedCoursesCodes)) { selectedCoursesCodes = "-1"; CurrencyDropDown.Visible = false; ContToPayID.Visible = false; totalPriceLabel.Visible = false; totalPriceText.Visible = false; } else { CurrencyDropDown.Visible = true; if (PayBtnID.Visible == false) { ContToPayID.Visible = true; } totalPriceLabel.Visible = true; totalPriceText.Visible = true; } AccessDataSource DS = new AccessDataSource(); DS.DataFile = "~/App_Data/Matnas_Database.accdb"; DS.SelectCommand = @"SELECT TimeTable.CourseTimeCode, Courses.CourseName, Guides.FirstName + ' ' + Guides.LastName As 'Guide Name', WorkingDays.Name, WorkingHours.HourName , Courses.PricePerMonth, Courses.Description FROM (((((Courses INNER JOIN GuidesInCourses ON Courses.CourseCode = GuidesInCourses.CourseCode) INNER JOIN Guides ON GuidesInCourses.GuideCode = Guides.GuideCode) INNER JOIN TimeTable ON GuidesInCourses.GuideCourseCode = TimeTable.GuideCourseCode) INNER JOIN WorkingDays ON TimeTable.[Day] = WorkingDays.DayCode) INNER JOIN WorkingHours ON TimeTable.[Hour] = WorkingHours.HourCode) WHERE TimeTable.CourseTimeCode in (" + selectedCoursesCodes + ")"; AddedCoursesGridView.DataSource = DS; AddedCoursesGridView.DataBind(); if (AddedCoursesGridView.Rows.Count > 0) { AddedCoursesGridView.HeaderRow.Cells[1].Visible = false; AddedCoursesGridView.HeaderRow.Cells[2].Text = "Course Name"; AddedCoursesGridView.HeaderRow.Cells[3].Text = "Guide Name"; AddedCoursesGridView.HeaderRow.Cells[4].Text = "Day"; AddedCoursesGridView.HeaderRow.Cells[5].Text = "Hour"; AddedCoursesGridView.HeaderRow.Cells[6].Text = "Price"; } //הפעלת שירות רשת חיצוני - המרה משקל לדולר/הפוך ConverterSoapClient moneyConv = new ConverterSoapClient("ConverterSoap"); CultureInfo info = new CultureInfo(CurrencyDropDown.SelectedItem.Value); string currencySymbol = info.NumberFormat.CurrencySymbol; decimal totalprice = 0.0m; for (int i = 0; i < AddedCoursesGridView.Rows.Count; ++i) { AddedCoursesGridView.Rows[i].Cells[1].Visible = false; decimal price = (decimal)double.Parse(AddedCoursesGridView.Rows[i].Cells[6].Text); if (CurrencyDropDown.SelectedItem.Value == "en-US") { // Translate to USD price = moneyConv.GetConversionAmount("ILS", "USD", moneyConv.GetLastUpdateDate(), price); AddedCoursesGridView.Rows[i].Cells[6].Text = price.ToString("0,0.00"); } totalprice += price; AddedCoursesGridView.Rows[i].Cells[6].Text += currencySymbol; } totalPriceText.Text = totalprice.ToString("0,0.00") + currencySymbol; }