void Start() { fiyat = GameObject.Find("GameManager2").GetComponent <Fiyat>(); if (PlayerDataHandler.instance.b_Invesments[1] == false) { go_Button1.GetComponent <Button>().interactable = false; } else { go_Button1.GetComponent <Button>().interactable = true; } if (PlayerDataHandler.instance.b_Invesments[2] == false) { go_Button2.GetComponent <Button>().interactable = false; } else { go_Button2.GetComponent <Button>().interactable = true; } if (PlayerDataHandler.instance.b_Invesments[3] == false) { go_Button3.GetComponent <Button>().interactable = false; } else { go_Button3.GetComponent <Button>().interactable = true; } }
public ActionResult DeleteConfirmed(int id) { Fiyat fiyat = db.Fiyat.Find(id); db.Fiyat.Remove(fiyat); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "fiyat_id, fiyat1")] Fiyat fiyat1) { if (ModelState.IsValid) { db.Entry(fiyat1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fiyat1)); }
public override string ToString() { string bisikletBilgileri = "Marka: " + Marka + "\n" + "Model: " + Model + "\n" + "Renk: " + Renk + "\n" + "Tekerlek: " + TekerlekSayisi + "\n" + "Fiyat: " + Fiyat.ToString("C2") + "\n" + "Selesi Var Mı?: " + SelesiVarMi + "\n" + "Vites Sayısı: " + VitesSayisi + " vites"; return(bisikletBilgileri); }
// GET: Fiyats/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Fiyat fiyat = db.Fiyat.Find(id); if (fiyat == null) { return(HttpNotFound()); } return(View(fiyat)); }
public override string ToString() { string aracBilgileri = "Marka: " + Marka + "\n" + "Model: " + Model + "\n" + "Renk: " + Renk + "\n" + "Tekerlek: " + TekerlekSayisi + "\n" + "Fiyat: " + Fiyat.ToString("C2") + "\n" + //c2 = fiyat currency2, virgülden sonra 2 hane ile fiyatı yazdır. "Kapı Sayısı: " + KapiSayisi + " kapi" + "\n" + "Yakıt Türü: " + YakitTuru + "\n" + "Bagaj Hacmi: " + BagajHacmi; return(aracBilgileri); }
public string TutarHesapla() { if (Miktar.Contains(",")) { Miktar = Miktar.Replace(",", "."); } if (Fiyat.Contains(",")) { Fiyat = Fiyat.Replace(",", "."); } var sonuc = (Convert.ToDecimal(Miktar) * Convert.ToDecimal(Fiyat)).ToString(); return(sonuc); }
public ActionResult Create([Bind(Include = "fiyat_id,fiyat1")] Fiyat fiyattable, int id) { if (ModelState.IsValid) { YemFiy kh = new YemFiy(); kh.yem_id = id; kh.fiyat_id = fiyattable.fiyat_id; var yemfiy = db.Yemek.Where(i => i.yem_id == id).SingleOrDefault(); yemfiy.Fiyat.Add(fiyattable); db.Fiyat.Add(fiyattable); db.SaveChanges(); return(RedirectToAction("FiyatGör", new { id = id })); } return(View(fiyattable)); }
public override string ToString() { return(Ad + " | " + Fiyat.ToString()); }
public override string ToString() { return(Fiyat.ToString()); }
public void EpdkSorgula(string ilValue) { List<City> listCityToQuery = new List<City>(); if (ilValue.Equals("-1")) { // tüm iller sorgulanır listCityToQuery.AddRange(ListCity); } else { listCityToQuery.Add(ListCity.Find(r=>r.Value==Convert.ToInt32(ilValue))); } string epdkPage = "http://www.epdk.org.tr/Themes/Theme_002/Pages/PetrolBayiFiyatlar.aspx"; string prm1 = ""; //"1"; // il string prm2 = ""; // ilçe string prm3 = "6074"; // dağıtıcı 6074: opet sunpet string prm4 = ""; // bayi string queryAddressFormat = "http://www.epdk.org.tr/Services/Contents.ashx?Query=petrolprice&1_={0}&2_={1}&3_={2}&4_={3}"; string queryAddress = ""; //var html = new HtmlDocument(); //html.LoadHtml(new WebClient().DownloadString(epdkPage)); //WebClient webClient = new WebClient(); ////html.Load(webClient.DownloadString(epdkPage)); //string page1 = webClient.DownloadString(epdkPage); //queryAddressFormat = string.Format(queryAddressFormat, prm1, prm2, prm3, prm4); //string q1 = webClient.DownloadString(queryAddressFormat); ////WebResponse webResponse = webClient.ResponseHeaders CookieContainer cookieContainer = new CookieContainer(); CookieCollection cookieCollection = new CookieCollection(); HttpWebRequest request = WebRequest.Create(new Uri(epdkPage)) as HttpWebRequest; request.CookieContainer = cookieContainer; HttpWebResponse response = request.GetResponse() as HttpWebResponse; cookieCollection = response.Cookies; // capture the cookies from the response List<Fiyat> listFiyat = new List<Fiyat>(); string html = ""; foreach (City city in listCityToQuery) { Thread.Sleep(new TimeSpan(0,0,3)); // saniye arayla sorgulama prm1 = city.Value.ToString(); //i.ToString(); // il bilgisi queryAddress = string.Format(queryAddressFormat, prm1, prm2, prm3, prm4); request = (HttpWebRequest)WebRequest.Create(new Uri(queryAddress)); request.CookieContainer = cookieContainer; request.CookieContainer.Add(cookieCollection); // add cookies from the previous response to the new request request.Accept = "text/html"; request.Headers.Add("X-Requested-With", "XMLHttpRequest"); request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.58 Safari/537.36"; request.Referer = "http://www.epdk.org.tr/Themes/Theme_002/Pages/PetrolBayiFiyatlar.aspx"; //request.Headers.Add(HttpRequestHeader.AcceptEncoding,"gzip, deflate, sdch"); request.Headers.Add(HttpRequestHeader.AcceptLanguage, "tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4"); response = (HttpWebResponse)request.GetResponse(); //cookieCollection = response.Cookies; // capture the cookies from the response string responseString = String.Empty; using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) { responseString = streamReader.ReadToEnd(); } html += (responseString); HtmlDocument htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(string.Format("<html><body>{0}</body></html>", responseString)); HtmlNode tableHtmlNode = htmlDocument.DocumentNode.SelectSingleNode("//table"); HtmlNodeCollection trHtmlNodeCollection = tableHtmlNode.SelectNodes("//tr[@class='row ']"); foreach (HtmlNode trHtmlNode in trHtmlNodeCollection) { Fiyat fiyat = new Fiyat(); fiyat.Il = city.Label; List<HtmlNode> tdHtmlNodeCollection = trHtmlNode.Descendants().Where(r => r.Name.Equals("td")).ToList(); for (int j = 0; j < 6; j++) { HtmlNode tdHtmlNode = tdHtmlNodeCollection[j]; if (j == 0) { fiyat.Bayi = tdHtmlNode.InnerText; } else if (j == 1) { fiyat.Benzin95Oktan = string.IsNullOrEmpty(tdHtmlNode.InnerText) ? (decimal?)null : Convert.ToDecimal(tdHtmlNode.InnerText); if (tdHtmlNode.Attributes["title"] != null) { fiyat.Benzin95OktanGecerlilikTarihi = string.IsNullOrEmpty(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")) ? (DateTime?)null : Convert.ToDateTime(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")); } } else if (j == 2) { fiyat.Motorin = string.IsNullOrEmpty(tdHtmlNode.InnerText) ? (decimal?)null : Convert.ToDecimal(tdHtmlNode.InnerText); if (tdHtmlNode.Attributes["title"] != null) { fiyat.Benzin95OktanGecerlilikTarihi = string.IsNullOrEmpty(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")) ? (DateTime?)null : Convert.ToDateTime(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")); } } else if (j == 3) { fiyat.BenzinDiger = string.IsNullOrEmpty(tdHtmlNode.InnerText) ? (decimal?)null : Convert.ToDecimal(tdHtmlNode.InnerText); if (tdHtmlNode.Attributes["title"] != null) { fiyat.BenzinDigerGecerlilikTarihi = string.IsNullOrEmpty(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")) ? (DateTime?)null : Convert.ToDateTime(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")); } } else if (j == 4) { fiyat.MotorinDiger = string.IsNullOrEmpty(tdHtmlNode.InnerText) ? (decimal?)null : Convert.ToDecimal(tdHtmlNode.InnerText); if (tdHtmlNode.Attributes["title"] != null) { fiyat.MotorinDigerGecerlilikTarihi = string.IsNullOrEmpty(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")) ? (DateTime?)null : Convert.ToDateTime(tdHtmlNode.Attributes["title"].Value.Replace("Geçerlilik Tarihi : ", "")); } } else if (j == 5) { fiyat.Dagitici = tdHtmlNode.InnerText; } } listFiyat.Add(fiyat); } // end of foreach (HtmlNode trHtmlNode in trHtmlNodeCollection)... } //divContent1.InnerHtml = HttpUtility.HtmlEncode(html); divContent1.InnerHtml = html; lblRecordCount.Text = listFiyat.Count.ToString(); ListFiyat = listFiyat; gv1.DataSource = listFiyat; gv1.DataBind(); // kaynaklar: // How to parse HttpWebResponse.Headers.Keys for a Set-Cookie session id returned: http://stackoverflow.com/questions/1055853/how-to-parse-httpwebresponse-headers-keys-for-a-set-cookie-session-id-returned // Using HtmlAgilityPack to GET and POST web forms: http://refactoringaspnet.blogspot.com.tr/2010/04/using-htmlagilitypack-to-get-and-post.html // http://stackoverflow.com/questions/17982131/cookies-dropped-lost-on-httpwebrequest-getreponse }
public string FiyatYazdir() { return(Fiyat.ToString() + " TL"); }
void Start() { fiyat = GameObject.Find("GameManager2").GetComponent <Fiyat>(); }