using System;
using System.Windows.Forms;
public partial class Form1 : Form
{
// Bugünün tarihi
private DateTime today = DateTime.Today;
// Bugünkü tıklama sayısı
private int clickCount = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Tarih kontrol et.
if (today != DateTime.Today)
{
// Tarih farklıysa, tıklama sayısı sıfırla
clickCount = 0;
today = DateTime.Today;
}
// Tıklama sayısı kontrol et.
if (clickCount < 1)
{
// Tıklama sayısı 1 den azsa, veri ekle
// veritabanına veri ekleme kodu
clickCount++;
}
else
{
// Tıklama sayısı 1 den fazla ise, uyarı ver
MessageBox.Show("Bugün için veri ekleme izniniz doldu.");
}
}
}