Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Services;
  6. using System.IO;
  7.  
  8. namespace a10service
  9. {
  10. /// <summary>
  11. /// Summary description for WebService1
  12. /// </summary>
  13. [WebService(Namespace = "http://tempuri.org/")]
  14. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  15. [System.ComponentModel.ToolboxItem(false)]
  16. // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
  17. // [System.Web.Script.Services.ScriptService]
  18. public class WebService1 : System.Web.Services.WebService
  19. {
  20.  
  21. [WebMethod]
  22. public double KiolvasniAzArfolyamotANapon(DateTime Datum, string valuta)
  23. {
  24. string dt = Datum.ToString("yyyy.MM.dd. H:mm:ss");
  25. DateTime datumocska = Convert.ToDateTime(dt);
  26. string filename = Server.MapPath("~/valuta.txt");
  27. using (StreamReader reader = new StreamReader(filename))
  28. {
  29. string line;
  30. while ((line = reader.ReadLine()) != null)
  31. {
  32. string[] sor = line.Split('|').ToArray();
  33. if (datumocska == Convert.ToDateTime(sor[0]) && valuta == sor[1])
  34. {
  35. return Convert.ToDouble(sor[2]);
  36. }
  37. }
  38. }
  39. return 0;
  40. }
  41.  
  42. [WebMethod]
  43. public bool BeirniAzArfolyamotANapon(DateTime Datum, string valuta, double Arfolyam)
  44. {
  45. string filename = Server.MapPath("~/valuta.txt");
  46.  
  47. string dt = Datum.ToString("yyyy.MM.dd. H:mm:ss");
  48. string arfolyamszoveg = Arfolyam.ToString();
  49. string kiirando = dt + "|" + valuta + "|" + arfolyamszoveg;
  50. using (StreamWriter sw = File.AppendText(filename))
  51. {
  52. sw.WriteLine(kiirando);
  53. return true;
  54. }
  55.  
  56. }
  57.  
  58. [WebMethod]
  59. public List<string> OsszValutaKiolvasasa()
  60. {
  61. string filename = Server.MapPath("~/valuta.txt");
  62. List<string> lista = new List<string>();
  63. using (StreamReader reader = new StreamReader(filename))
  64. {
  65. string line;
  66. while ((line = reader.ReadLine()) != null)
  67. {
  68. string[] sor = line.Split('|').ToArray();
  69. lista.Add(sor[1]);
  70. }
  71. }
  72. lista = lista.Distinct().ToList<string>();
  73.  
  74. return lista;
  75. }
  76. }
  77. }
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. ////using System;
  85. using System.Collections.Generic;
  86. using System.Linq;
  87. using System.Web;
  88. using System.Web.UI;
  89. using System.Web.UI.WebControls;
  90. using a10webapp.localhost;
  91. namespace a10webapp
  92. {
  93. public partial class arfolyambevitel : System.Web.UI.Page
  94. {
  95. WebService1 c = new WebService1();
  96. protected void Page_Load(object sender, EventArgs e)
  97. {
  98. if (!IsPostBack)
  99. {
  100. string[] lista = c.OsszValutaKiolvasasa();
  101. DropDownList1.DataSource = lista;
  102. DropDownList1.DataBind();
  103. }
  104. }
  105.  
  106. protected void Button1_Click(object sender, EventArgs e)
  107. {
  108. string dt = Calendar1.SelectedDate.ToString("yyyy.MM.dd. H:mm:ss");
  109. DateTime date = Convert.ToDateTime(dt);
  110. double arfolyam = Convert.ToDouble(TextBox1.Text);
  111. bool cucc = false;
  112. cucc = c.BeirniAzArfolyamotANapon(date, DropDownList1.SelectedItem.Text, arfolyam);
  113. if (cucc)
  114. {
  115. Label1.Text = "Hozzaadtad";
  116. }
  117.  
  118. else
  119. {
  120. Label1.Text = "Nem sikerult";
  121. }
  122. }
  123. }
  124. }
  125.  
  126. /WebService1 c = new WebService1();
  127. protected void Page_Load(object sender, EventArgs e)
  128. {
  129. if (!IsPostBack)
  130. {
  131. string[] lista = c.OsszValutaKiolvasasa();
  132. DropDownList1.DataSource = lista;
  133. DropDownList1.DataBind();
  134. }
  135.  
  136. }
  137.  
  138. protected void Button1_Click(object sender, EventArgs e)
  139. {
  140.  
  141.  
  142.  
  143. string dt = Calendar1.SelectedDate.ToString("yyyy.MM.dd. H:mm:ss");
  144. DateTime date = Convert.ToDateTime(dt);
  145. double valuta = c.KiolvasniAzArfolyamotANapon(date, DropDownList1.SelectedItem.ToString());
  146. if (valuta > 0)
  147. {
  148. Label1.Text = valuta.ToString();
  149. }
  150.  
  151. else
  152. {
  153. Label1.Text = "Nincs talalat";
  154. }
  155.  
  156. }
  157. }
  158. }
  159.  
  160.  
  161.  
  162.  
  163. string[] ciril = { "џ", "љ", "њ", "ж", "ђ", "ћ", "ч", "е", "р", "т", "з", "у", "и", "о", "п", "ш", "л", "к", "ј", "х", "г", "ф", "д", "с", "а", "ц", "в", "б", "н", "м", "Џ", "Љ", "Њ", "Ж", "Ђ", "Ћ", "Ч", "Е", "Р", "Т", "З", "У", "И", "О", "П", "Ш", "Л", "К", "Ј", "Х", "Г", "Ф", "Д", "С", "А", "Ц", "В", "Б", "Н", "М" };
  164. 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