using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace FastFoodDemo
{ [ComVisible(true)]
public partial class harita : UserControl
{
public harita()
{
InitializeComponent();
analist.Visible = false;
MyWebBrowser.ScriptErrorsSuppressed = true;
MyWebBrowser.ObjectForScripting = this;
string htmlPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName) + "\\Html\\Map.html";
MyWebBrowser.Navigate(new Uri(htmlPath));
this.Show();
}
private void harita_Load(object sender, EventArgs e)
{
Yenile();
}
void harita_Closed(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem1.mdb");
OleDbCommand cmd = new OleDbCommand();
con.Open();
cmd.Connection = con;
cmd.CommandText = "Delete from sistem2";
cmd.ExecuteNonQuery();
con.Close();
}
public void Yenile()
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem1.mdb");
OleDbCommand cmd = new OleDbCommand();
con.Open();
cmd.Connection = con;
cmd.CommandText = "Select * from sistem2";
cmd.ExecuteReader();
con.Close();
}
private void button1_Click(object sender, EventArgs e)
{
dataGridView3.DataSource = dt.TumListeyiGetir();
try
{
Yenile();
timer1.Enabled = true;
while (true)
{
var DBPath = "sistem1.mdb";
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "Data Source=" + DBPath);
conn.Open();
using (DataTable dt = new DataTable())
{
var x = conn.DataSource;
var y = conn.Database;
using (OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from sistem2", conn))
{
try
{
if (adapter != null)
adapter.Fill(dt);
else
{
MessageBox.Show("Başarıyla Kaydededildi.");
}
}
catch
{
}
}
kucuk.DataSource = dt;
}
int count = 0;
foreach (DataGridViewRow dtr in kucuk.Rows)
{
count++;
var currentCulture = System.Globalization.CultureInfo.InstalledUICulture;
var numberFormat = (System.Globalization.NumberFormatInfo)currentCulture.NumberFormat.Clone();
numberFormat.NumberDecimalSeparator = ".";
double fEnlem;
double fBoylam = 0;
double fisim;
if (count != kucuk.Rows.Count)
{
bool succeededE = double.TryParse(dtr.Cells[2].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fEnlem);
bool succeededF = double.TryParse(dtr.Cells[3].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fBoylam);
bool succeededG = double.TryParse(dtr.Cells[4].Value.ToString(), System.Globalization.NumberStyles.Any, numberFormat, out fisim);
if (succeededE == true && succeededF == true)
{
if (fEnlem > 10)
analist.Rows.Add(dtr.Cells[2].Value, dtr.Cells[3].Value, dtr.Cells[4].Value, dtr.Cells[0].Value, dtr.Cells[1].Value);
}
}
}
MyWebBrowser.Document.InvokeScript("changeCenter", new object[] { analist.Rows[0].Cells[0].Value, analist.Rows[0].Cells[1].Value });
analist.Visible = true;
button1.Visible = false;
string color;
for (int i = 0; i < analist.RowCount; i++)
{
if (analist.Rows[i].Cells[2].Value.ToString() == "GÜVENLİ BÖLGE")
color = "Green";
else color = "Brown";
// Burda Ayırıyor. girde hangi stunu göre sorgu yaoacağını gösterdim ordaki METİN değerine göre kırmızı veya yeşil nokta bırakıor
MyWebBrowser.Document.InvokeScript("updateMapWithPushpins", new object[] { analist.Rows[i].Cells[0].Value, analist.Rows[i].Cells[1].Value, analist.Rows[i].Cells[2].Value, color });
}
break;
}
}
catch (Exception Hata)
{
MessageBox.Show("Harita Koordinatlarını Eklemeden Harita Üzerinde Gösterme İşlemi Sağlayamassınız");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
int alımsayısı = analist.Rows.Count;
label1.Text = alımsayısı.ToString();
timer1.Stop();
}
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sistem1.mdb");
OleDbCommand cmd = new OleDbCommand();
con.Open();
cmd.Connection = con;
cmd.CommandText = "Delete from sistem2";
cmd.ExecuteNonQuery();
con.Close();
}
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
DataSet1TableAdapters.sistem2TableAdapter dt = new DataSet1TableAdapters.sistem2TableAdapter();
private void button3_Click(object sender, EventArgs e)
{
}
}
}
Database'den Çektiğim Veriyi Formda Gösterince SEÇ butonu Tıklayıp Korrodinata gitmesini İstiyorum Gitmiyor Yardım Edebilirmisiniz?