AGENDA

agenda

Download:

Agenda (MSI-Datei 319KB)

Source:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace agenda
{

/// <summary>
/// Zusammenfassung für Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{

private System.Windows.Forms.Button btn_Ende;
private System.Windows.Forms.Button btn_schreibe;
private System.Windows.Forms.DateTimePicker dtp_begdat;
string HeadString="\"Betreff\",\"Beginnt am\",\"Beginnt um\",\"Endet am\",\"Endet um\",\"Ganztaegiges Ereignis\",\"Erinnerung Ein/Aus\",\"Erinnerung am\",\"Erinnerung um\",\"Besprechungsplanung\",\"Erforderliche Teilnehmer\",\"Optionale Teilnehmer\",\"Besprechungsressourcen\",\"Abrechnungsinformationen\",\"Beschreibung\",\"Kategorien\",\"Ort\",\"Priorit?t\",\"Privat\",\"Reisekilometer\",\"Vertraulichkeit\",\"Zeitspanne zeigen als\"";
string Termin="";
string begdat;
string begtim;
string enddat;
string endtim;
int AnzTerm=0;
private System.Windows.Forms.DateTimePicker dtp_begtim;
private System.Windows.Forms.GroupBox grp_Ende;
private System.Windows.Forms.DateTimePicker dtp_enddat;
private System.Windows.Forms.DateTimePicker dtp_endtim;
private System.Windows.Forms.GroupBox grp_Beginn;
private System.Windows.Forms.GroupBox grp_betr;
private System.Windows.Forms.TextBox txt_betr;
private System.Windows.Forms.GroupBox grp_beschreibung;
private System.Windows.Forms.TextBox txt_beschr;
private System.Windows.Forms.GroupBox grp_kat;
private System.Windows.Forms.ComboBox cmb_kat;
private System.Windows.Forms.Label lbl_newkat;
private System.Windows.Forms.TextBox txt_newkat;
private System.Windows.Forms.Button btn_newkat;
private System.Windows.Forms.GroupBox grp_ort;
private System.Windows.Forms.TextBox txt_ort;
private System.Windows.Forms.Button btn_Termin;
private System.Windows.Forms.GroupBox grp_TermAnz;
private System.Windows.Forms.TextBox txt_TermAnz;
private System.Windows.Forms.CheckBox chk_ganzTag;
private System.Windows.Forms.Button btn_woche;
private System.Windows.Forms.Button btn_Tag;
private System.Windows.Forms.Button btn_50;
/// <summary>
/// Erforderliche Designervariable.
/// </summary>

private System.ComponentModel.Container components = null;

public Form1()
{

//
// Erforderlich für die Windows Form-Designerunterstützung
//

InitializeComponent();

//
// TODO: Fügen Sie den Konstruktorcode nach dem Aufruf von InitializeComponent hinzu
//

}

/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>

protected override void Dispose( bool disposing )
{

if( disposing )
{

if (components != null)
{

components.Dispose();

}

}
base.Dispose( disposing );

}

#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>

private void InitializeComponent()
{

System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.btn_Ende = new System.Windows.Forms.Button();
this.btn_schreibe = new System.Windows.Forms.Button();
this.dtp_begdat = new System.Windows.Forms.DateTimePicker();
this.dtp_begtim = new System.Windows.Forms.DateTimePicker();
this.grp_Ende = new System.Windows.Forms.GroupBox();
this.btn_50 = new System.Windows.Forms.Button();
this.dtp_endtim = new System.Windows.Forms.DateTimePicker();
this.dtp_enddat = new System.Windows.Forms.DateTimePicker();
this.grp_Beginn = new System.Windows.Forms.GroupBox();
this.chk_ganzTag = new System.Windows.Forms.CheckBox();
this.grp_betr = new System.Windows.Forms.GroupBox();
this.txt_betr = new System.Windows.Forms.TextBox();
this.grp_beschreibung = new System.Windows.Forms.GroupBox();
this.txt_beschr = new System.Windows.Forms.TextBox();
this.grp_kat = new System.Windows.Forms.GroupBox();
this.btn_newkat = new System.Windows.Forms.Button();
this.txt_newkat = new System.Windows.Forms.TextBox();
this.lbl_newkat = new System.Windows.Forms.Label();
this.cmb_kat = new System.Windows.Forms.ComboBox();
this.grp_ort = new System.Windows.Forms.GroupBox();
this.txt_ort = new System.Windows.Forms.TextBox();
this.btn_Termin = new System.Windows.Forms.Button();
this.grp_TermAnz = new System.Windows.Forms.GroupBox();
this.txt_TermAnz = new System.Windows.Forms.TextBox();
this.btn_woche = new System.Windows.Forms.Button();
this.btn_Tag = new System.Windows.Forms.Button();
this.grp_Ende.SuspendLayout();
this.grp_Beginn.SuspendLayout();
this.grp_betr.SuspendLayout();
this.grp_beschreibung.SuspendLayout();
this.grp_kat.SuspendLayout();
this.grp_ort.SuspendLayout();
this.grp_TermAnz.SuspendLayout();
this.SuspendLayout();
//
// btn_Ende
//

this.btn_Ende.Location = new System.Drawing.Point(288, 384);
this.btn_Ende.Name = "btn_Ende";
this.btn_Ende.Size = new System.Drawing.Size(120, 32);
this.btn_Ende.TabIndex = 0;
this.btn_Ende.Text = "B&eenden";
this.btn_Ende.Click += new System.EventHandler(this.btn_Ende_Click);
//
// btn_schreibe
//

this.btn_schreibe.Location = new System.Drawing.Point(160, 344);
this.btn_schreibe.Name = "btn_schreibe";
this.btn_schreibe.Size = new System.Drawing.Size(120, 32);
this.btn_schreibe.TabIndex = 1;
this.btn_schreibe.Text = "Datei &schreiben";
this.btn_schreibe.Click += new System.EventHandler(this.btn_schreibe_Click);
//
// dtp_begdat
//

this.dtp_begdat.CustomFormat = "";
this.dtp_begdat.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtp_begdat.Location = new System.Drawing.Point(16, 16);
this.dtp_begdat.Name = "dtp_begdat";
this.dtp_begdat.Size = new System.Drawing.Size(96, 20);
this.dtp_begdat.TabIndex = 2;
this.dtp_begdat.ValueChanged += new System.EventHandler(this.dtp_begdat_ValueChanged);
//
// dtp_begtim
//

this.dtp_begtim.CustomFormat = "HH:mm";
this.dtp_begtim.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtp_begtim.Location = new System.Drawing.Point(120, 16);
this.dtp_begtim.Name = "dtp_begtim";
this.dtp_begtim.ShowUpDown = true;
this.dtp_begtim.Size = new System.Drawing.Size(56, 20);
this.dtp_begtim.TabIndex = 4;
this.dtp_begtim.Value = new System.DateTime(2006, 6, 30, 10, 0, 0, 0);
this.dtp_begtim.ValueChanged += new System.EventHandler(this.dtp_begtim_ValueChanged);
//
// grp_Ende
//

this.grp_Ende.Controls.Add(this.btn_50);
this.grp_Ende.Controls.Add(this.dtp_endtim);
this.grp_Ende.Controls.Add(this.dtp_enddat);
this.grp_Ende.Location = new System.Drawing.Point(216, 72);
this.grp_Ende.Name = "grp_Ende";
this.grp_Ende.Size = new System.Drawing.Size(192, 72);
this.grp_Ende.TabIndex = 5;
this.grp_Ende.TabStop = false;
this.grp_Ende.Text = "Ende:";
//
// btn_50
//

this.btn_50.Location = new System.Drawing.Point(120, 40);
this.btn_50.Name = "btn_50";
this.btn_50.Size = new System.Drawing.Size(56, 24);
this.btn_50.TabIndex = 6;
this.btn_50.Text = "+ 50\'";
this.btn_50.Click += new System.EventHandler(this.btn_50_Click);
//
// dtp_endtim
//

this.dtp_endtim.CustomFormat = "HH:mm";
this.dtp_endtim.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtp_endtim.Location = new System.Drawing.Point(120, 16);
this.dtp_endtim.Name = "dtp_endtim";
this.dtp_endtim.ShowUpDown = true;
this.dtp_endtim.Size = new System.Drawing.Size(56, 20);
this.dtp_endtim.TabIndex = 5;
this.dtp_endtim.Value = new System.DateTime(2006, 6, 30, 0, 0, 0, 0);
this.dtp_endtim.ValueChanged += new System.EventHandler(this.dtp_endtim_ValueChanged);
//
// dtp_enddat
//

this.dtp_enddat.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtp_enddat.Location = new System.Drawing.Point(16, 16);
this.dtp_enddat.Name = "dtp_enddat";
this.dtp_enddat.Size = new System.Drawing.Size(96, 20);
this.dtp_enddat.TabIndex = 0;
this.dtp_enddat.ValueChanged += new System.EventHandler(this.dtp_enddat_ValueChanged);
//
// grp_Beginn
//

this.grp_Beginn.Controls.Add(this.chk_ganzTag);
this.grp_Beginn.Controls.Add(this.dtp_begdat);
this.grp_Beginn.Controls.Add(this.dtp_begtim);
this.grp_Beginn.Location = new System.Drawing.Point(8, 72);
this.grp_Beginn.Name = "grp_Beginn";
this.grp_Beginn.Size = new System.Drawing.Size(192, 72);
this.grp_Beginn.TabIndex = 6;
this.grp_Beginn.TabStop = false;
this.grp_Beginn.Text = "Beginn:";
//
// chk_ganzTag
//

this.chk_ganzTag.Location = new System.Drawing.Point(16, 40);
this.chk_ganzTag.Name = "chk_ganzTag";
this.chk_ganzTag.Size = new System.Drawing.Size(160, 16);
this.chk_ganzTag.TabIndex = 7;
this.chk_ganzTag.Text = "ganztägig";
this.chk_ganzTag.CheckedChanged += new System.EventHandler(this.chk_ganzTag_CheckedChanged);
//
// grp_betr
//

this.grp_betr.Controls.Add(this.txt_betr);
this.grp_betr.Location = new System.Drawing.Point(8, 8);
this.grp_betr.Name = "grp_betr";
this.grp_betr.Size = new System.Drawing.Size(400, 56);
this.grp_betr.TabIndex = 7;
this.grp_betr.TabStop = false;
this.grp_betr.Text = "Betreff:";
//
// txt_betr
//

this.txt_betr.Location = new System.Drawing.Point(16, 24);
this.txt_betr.Name = "txt_betr";
this.txt_betr.Size = new System.Drawing.Size(368, 20);
this.txt_betr.TabIndex = 0;
this.txt_betr.Text = "";
//
// grp_beschreibung
//

this.grp_beschreibung.Controls.Add(this.txt_beschr);
this.grp_beschreibung.Location = new System.Drawing.Point(8, 152);
this.grp_beschreibung.Name = "grp_beschreibung";
this.grp_beschreibung.Size = new System.Drawing.Size(192, 80);
this.grp_beschreibung.TabIndex = 8;
this.grp_beschreibung.TabStop = false;
this.grp_beschreibung.Text = "Beschreibung:";
//
// txt_beschr
//

this.txt_beschr.Location = new System.Drawing.Point(8, 16);
this.txt_beschr.Multiline = true;
this.txt_beschr.Name = "txt_beschr";
this.txt_beschr.Size = new System.Drawing.Size(176, 56);
this.txt_beschr.TabIndex = 0;
this.txt_beschr.Text = "";
//
// grp_kat
//

this.grp_kat.Controls.Add(this.btn_newkat);
this.grp_kat.Controls.Add(this.txt_newkat);
this.grp_kat.Controls.Add(this.lbl_newkat);
this.grp_kat.Controls.Add(this.cmb_kat);
this.grp_kat.Location = new System.Drawing.Point(216, 152);
this.grp_kat.Name = "grp_kat";
this.grp_kat.Size = new System.Drawing.Size(192, 136);
this.grp_kat.TabIndex = 9;
this.grp_kat.TabStop = false;
this.grp_kat.Text = "Kategorie:";
//
// btn_newkat
//

this.btn_newkat.Location = new System.Drawing.Point(72, 104);
this.btn_newkat.Name = "btn_newkat";
this.btn_newkat.Size = new System.Drawing.Size(48, 24);
this.btn_newkat.TabIndex = 3;
this.btn_newkat.Text = "OK";
this.btn_newkat.Click += new System.EventHandler(this.btn_newkat_Click);
//
// txt_newkat
//

this.txt_newkat.Location = new System.Drawing.Point(8, 80);
this.txt_newkat.Name = "txt_newkat";
this.txt_newkat.Size = new System.Drawing.Size(168, 20);
this.txt_newkat.TabIndex = 2;
this.txt_newkat.Text = "";
//
// lbl_newkat
//

this.lbl_newkat.Location = new System.Drawing.Point(8, 64);
this.lbl_newkat.Name = "lbl_newkat";
this.lbl_newkat.Size = new System.Drawing.Size(168, 16);
this.lbl_newkat.TabIndex = 1;
this.lbl_newkat.Text = "Neue Kategorie hinzufügen:";
//
// cmb_kat
//

this.cmb_kat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmb_kat.Items.AddRange(new object[] {
"Privat",
"TGM"});
this.cmb_kat.Location = new System.Drawing.Point(12, 16);
this.cmb_kat.Name = "cmb_kat";
this.cmb_kat.Size = new System.Drawing.Size(168, 21);
this.cmb_kat.Sorted = true;
this.cmb_kat.TabIndex = 0;
//
// grp_ort
//

this.grp_ort.Controls.Add(this.txt_ort);
this.grp_ort.Location = new System.Drawing.Point(8, 240);
this.grp_ort.Name = "grp_ort";
this.grp_ort.Size = new System.Drawing.Size(192, 48);
this.grp_ort.TabIndex = 10;
this.grp_ort.TabStop = false;
this.grp_ort.Text = "Ort:";
//
// txt_ort
//

this.txt_ort.Location = new System.Drawing.Point(8, 16);
this.txt_ort.Name = "txt_ort";
this.txt_ort.Size = new System.Drawing.Size(176, 20);
this.txt_ort.TabIndex = 0;
this.txt_ort.Text = "";
//
// btn_Termin
//

this.btn_Termin.Location = new System.Drawing.Point(160, 304);
this.btn_Termin.Name = "btn_Termin";
this.btn_Termin.Size = new System.Drawing.Size(120, 32);
this.btn_Termin.TabIndex = 11;
this.btn_Termin.Text = "&Termin speichern";
this.btn_Termin.Click += new System.EventHandler(this.btn_Termin_Click);
//
// grp_TermAnz
//

this.grp_TermAnz.Controls.Add(this.txt_TermAnz);
this.grp_TermAnz.Location = new System.Drawing.Point(8, 296);
this.grp_TermAnz.Name = "grp_TermAnz";
this.grp_TermAnz.Size = new System.Drawing.Size(144, 40);
this.grp_TermAnz.TabIndex = 12;
this.grp_TermAnz.TabStop = false;
this.grp_TermAnz.Text = "Gespeicherte Termine:";
//
// txt_TermAnz
//

this.txt_TermAnz.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txt_TermAnz.Location = new System.Drawing.Point(48, 16);
this.txt_TermAnz.Name = "txt_TermAnz";
this.txt_TermAnz.ReadOnly = true;
this.txt_TermAnz.Size = new System.Drawing.Size(48, 20);
this.txt_TermAnz.TabIndex = 0;
this.txt_TermAnz.Text = "0";
this.txt_TermAnz.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// btn_woche
//

this.btn_woche.Location = new System.Drawing.Point(288, 344);
this.btn_woche.Name = "btn_woche";
this.btn_woche.Size = new System.Drawing.Size(120, 32);
this.btn_woche.TabIndex = 13;
this.btn_woche.Text = "&Woche addieren";
this.btn_woche.Click += new System.EventHandler(this.btn_woche_Click);
//
// btn_Tag
//

this.btn_Tag.Location = new System.Drawing.Point(288, 304);
this.btn_Tag.Name = "btn_Tag";
this.btn_Tag.Size = new System.Drawing.Size(120, 32);
this.btn_Tag.TabIndex = 14;
this.btn_Tag.Text = "&Tag addieren";
this.btn_Tag.Click += new System.EventHandler(this.btn_Tag_Click);
//
// Form1
//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(416, 422);
this.Controls.Add(this.btn_Tag);
this.Controls.Add(this.btn_woche);
this.Controls.Add(this.grp_TermAnz);
this.Controls.Add(this.btn_Termin);
this.Controls.Add(this.grp_ort);
this.Controls.Add(this.grp_kat);
this.Controls.Add(this.grp_beschreibung);
this.Controls.Add(this.grp_betr);
this.Controls.Add(this.grp_Beginn);
this.Controls.Add(this.grp_Ende);
this.Controls.Add(this.btn_schreibe);
this.Controls.Add(this.btn_Ende);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Agenda";
this.Load += new System.EventHandler(this.Form1_Load);
this.grp_Ende.ResumeLayout(false);
this.grp_Beginn.ResumeLayout(false);
this.grp_betr.ResumeLayout(false);
this.grp_beschreibung.ResumeLayout(false);
this.grp_kat.ResumeLayout(false);
this.grp_ort.ResumeLayout(false);
this.grp_TermAnz.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>

[STAThread]
static void Main()
{

Application.Run(new Form1());

}

private void btn_Ende_Click(object sender, System.EventArgs e)
{

this.Close();

}

private void btn_schreibe_Click(object sender, System.EventArgs e)
{

SaveFileDialog MyDialog = new SaveFileDialog();
MyDialog.Title = "Datei speichern unter";
MyDialog.Filter = "Textdatei (*.csv)|*.csv|beliebige Datei (*.*)|*.*";

if(MyDialog.ShowDialog() == DialogResult.OK)
{

System.IO.StreamWriter sw = new System.IO.StreamWriter(MyDialog.FileName);
// Add some text to the file.
sw.Write(HeadString);
sw.Write(Termin);
sw.Close();

}

}
private void dtp_begdat_ValueChanged(object sender, System.EventArgs e)
{

begdat=Convert.ToString(dtp_begdat.Value);
begdat=begdat.Substring(0,10);
if(chk_ganzTag.Checked)
{

dtp_enddat.Value=dtp_begdat.Value.AddDays(1);

}
else
{

dtp_enddat.Value=dtp_begdat.Value;

}

}

private void dtp_begtim_ValueChanged(object sender, System.EventArgs e)
{

begtim=Convert.ToString(dtp_begtim.Value);
begtim=begtim.Substring(11,5);
dtp_endtim.Value=dtp_begtim.Value;

}

private void dtp_enddat_ValueChanged(object sender, System.EventArgs e)
{

enddat=Convert.ToString(dtp_enddat.Value);
enddat=enddat.Substring(0,10);

}

private void dtp_endtim_ValueChanged(object sender, System.EventArgs e)
{

endtim=Convert.ToString(dtp_endtim.Value);
endtim=endtim.Substring(11,5);

}

private void Form1_Load(object sender, System.EventArgs e)
{

dtp_begdat.Value=DateTime.Today;
dtp_begtim.Value=DateTime.Now;
dtp_enddat.Value=DateTime.Today;
dtp_endtim.Value=DateTime.Now;

}

private void btn_newkat_Click(object sender, System.EventArgs e)
{

cmb_kat.Items.Add(txt_newkat.Text);
txt_newkat.Text="";

}

private void btn_Termin_Click(object sender, System.EventArgs e)
{

Termin+="\r\n"+"\""+txt_betr.Text+"\",\""+begdat+"\",\""+begtim+"\",\""+enddat+"\",\""+endtim+"\",\"Aus\",\"Aus\",,,,,,,,\""+txt_beschr.Text+"\",\""+cmb_kat.Text+"\",\""+txt_ort.Text+"\",,,,,";
AnzTerm++;
txt_TermAnz.Text=Convert.ToString(AnzTerm);

}

private void chk_ganzTag_CheckedChanged(object sender, System.EventArgs e)
{

if(chk_ganzTag.Checked)
{

dtp_enddat.Value=dtp_begdat.Value.AddDays(1);
//Erzeugen der Zeit 00:00
dtp_begtim.Value=dtp_begtim.Value.AddHours(-dtp_begtim.Value.Hour);
dtp_begtim.Value=dtp_begtim.Value.AddMinutes(-dtp_begtim.Value.Minute);
dtp_enddat.Enabled=false;
dtp_endtim.Enabled=false;

}
else
{

dtp_enddat.Value=dtp_begdat.Value;
dtp_enddat.Enabled=true;
dtp_endtim.Enabled=true;

}

}

private void btn_woche_Click(object sender, System.EventArgs e)
{

dtp_begdat.Value=dtp_begdat.Value.AddDays(7);

}

private void btn_Tag_Click(object sender, System.EventArgs e)
{

dtp_begdat.Value=dtp_begdat.Value.AddDays(1);

}

private void btn_50_Click(object sender, System.EventArgs e)
{

dtp_endtim.Value=dtp_endtim.Value.AddMinutes(50);

}

}

}

<<zurück>>