//control the numbers public void control_prime_numbers(int bas, int son) { try { for (int i = bas; i < son; i++) { if (function.isPrime(i)) { lblPrimeState.Text = "Prime Number"; using (linqDataContext linq = new linqDataContext()) { var query = (from p in linq.sayilars where p.sayi < Convert.ToInt32(lblMaxValue.Text) select p); int result = 0; foreach (var item in query) { if (Convert.ToInt32(lblChecked.Text) % Convert.ToInt32(item.sayi.ToString()) == 0) { result++; } } if (should_check && result == 0) { should_check = false; sayilar primes = new sayilar(); { primes.sayi = Convert.ToInt32(lblChecked.Text); } linq.sayilars.InsertOnSubmit(primes); linq.SubmitChanges(); lblChecked.Text = (Convert.ToInt32(lblChecked.Text) + 2).ToString(); break; } else { result = 0; lblChecked.Text = (Convert.ToInt32(lblChecked.Text) + 2).ToString(); break; } } } else { lblPrimeState.Text = "Not Prime"; } } } catch { } finally { } }
partial void Updatesayilar(sayilar instance);
partial void Deletesayilar(sayilar instance);
partial void Insertsayilar(sayilar instance);