Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Services;
- using System.IO;
- namespace a10service
- {
- /// <summary>
- /// Summary description for WebService1
- /// </summary>
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [System.ComponentModel.ToolboxItem(false)]
- // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
- // [System.Web.Script.Services.ScriptService]
- public class WebService1 : System.Web.Services.WebService
- {
- [WebMethod]
- public double KiolvasniAzArfolyamotANapon(DateTime Datum, string valuta)
- {
- string dt = Datum.ToString("yyyy.MM.dd. H:mm:ss");
- DateTime datumocska = Convert.ToDateTime(dt);
- string filename = Server.MapPath("~/valuta.txt");
- using (StreamReader reader = new StreamReader(filename))
- {
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- string[] sor = line.Split('|').ToArray();
- if (datumocska == Convert.ToDateTime(sor[0]) && valuta == sor[1])
- {
- return Convert.ToDouble(sor[2]);
- }
- }
- }
- return 0;
- }
- [WebMethod]
- public bool BeirniAzArfolyamotANapon(DateTime Datum, string valuta, double Arfolyam)
- {
- string filename = Server.MapPath("~/valuta.txt");
- string dt = Datum.ToString("yyyy.MM.dd. H:mm:ss");
- string arfolyamszoveg = Arfolyam.ToString();
- string kiirando = dt + "|" + valuta + "|" + arfolyamszoveg;
- using (StreamWriter sw = File.AppendText(filename))
- {
- sw.WriteLine(kiirando);
- return true;
- }
- }
- [WebMethod]
- public List<string> OsszValutaKiolvasasa()
- {
- string filename = Server.MapPath("~/valuta.txt");
- List<string> lista = new List<string>();
- using (StreamReader reader = new StreamReader(filename))
- {
- string line;
- while ((line = reader.ReadLine()) != null)
- {
- string[] sor = line.Split('|').ToArray();
- lista.Add(sor[1]);
- }
- }
- lista = lista.Distinct().ToList<string>();
- return lista;
- }
- }
- }
- ////using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using a10webapp.localhost;
- namespace a10webapp
- {
- public partial class arfolyambevitel : System.Web.UI.Page
- {
- WebService1 c = new WebService1();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- string[] lista = c.OsszValutaKiolvasasa();
- DropDownList1.DataSource = lista;
- DropDownList1.DataBind();
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- string dt = Calendar1.SelectedDate.ToString("yyyy.MM.dd. H:mm:ss");
- DateTime date = Convert.ToDateTime(dt);
- double arfolyam = Convert.ToDouble(TextBox1.Text);
- bool cucc = false;
- cucc = c.BeirniAzArfolyamotANapon(date, DropDownList1.SelectedItem.Text, arfolyam);
- if (cucc)
- {
- Label1.Text = "Hozzaadtad";
- }
- else
- {
- Label1.Text = "Nem sikerult";
- }
- }
- }
- }
- /WebService1 c = new WebService1();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- string[] lista = c.OsszValutaKiolvasasa();
- DropDownList1.DataSource = lista;
- DropDownList1.DataBind();
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- string dt = Calendar1.SelectedDate.ToString("yyyy.MM.dd. H:mm:ss");
- DateTime date = Convert.ToDateTime(dt);
- double valuta = c.KiolvasniAzArfolyamotANapon(date, DropDownList1.SelectedItem.ToString());
- if (valuta > 0)
- {
- Label1.Text = valuta.ToString();
- }
- else
- {
- Label1.Text = "Nincs talalat";
- }
- }
- }
- }
- string[] ciril = { "џ", "љ", "њ", "ж", "ђ", "ћ", "ч", "е", "р", "т", "з", "у", "и", "о", "п", "ш", "л", "к", "ј", "х", "г", "ф", "д", "с", "а", "ц", "в", "б", "н", "м", "Џ", "Љ", "Њ", "Ж", "Ђ", "Ћ", "Ч", "Е", "Р", "Т", "З", "У", "И", "О", "П", "Ш", "Л", "К", "Ј", "Х", "Г", "Ф", "Д", "С", "А", "Ц", "В", "Б", "Н", "М" };
- string[] latin = { "dž", "lj", "nj", "ž", "đ", "ć", "č", "e", "r", "t", "z", "u", "i", "o", "p", "š", "l", "k", "j", "h", "g", "f", "d", "s", "a", "c", "v", "b", "n", "m", "DŽ", "LJ", "NJ", "Ž", "Đ", "Ć", "Č", "E", "R", "T", "Z", "U", "I", "O", "P", "Š", "L", "K", "J", "H", "G", "F", "D", "S", "A", "C", "V", "B", "N", "M" };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement