public class arsiv_olustur
{
 
  public string[] aylar ={ "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" };
  public DateTime baslangic_zaman, son_zaman;
 
  OleDbConnection bg;
 
  public arsiv_olustur()
  {
    baslangic_zaman = new DateTime(2008, 1, 1);
    son_zaman = new DateTime(2008, 12, 1);
 
    bg = new OleDbConnection("provider=microsoft.jet.oledb.4.0; data source=" + HttpContext.Current.Server.MapPath("~/arsiv.mdb"));
  }
 
  public int kayit_sayisi(int yil, int ay)
  {
    int sonuc = 0;
    OleDbCommand komut = new OleDbCommand("select count(*) from arsiv where year(tarih)=@yil and month(tarih)=@ay", bg);
    komut.Parameters.AddWithValue("@yil", yil);
    komut.Parameters.AddWithValue("@ay", ay);
    bg.Open();
    sonuc = (int)komut.ExecuteScalar();
    bg.Close();
    return sonuc;
  }
 
  public string arsiv_getir()
  {
    string sonuc = "";
 
    for (int i = son_zaman.Month; i >= baslangic_zaman.Month; i--)
    {
      sonuc += "<a href='arsivim.aspx?tarih=" + son_zaman.Year + "/" + i + "'>" + aylar[i - 1] + " " + son_zaman.Year + " (" + kayit_sayisi(son_zaman.Year, i) + ")" + "</a>";
    }
 
    return sonuc;
  }
 
}