using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace Zeiterfassung
{
public partial class MainForm : Form
{
private TimeCollect tCol;
private employee emplo;
private projects proj;
public SqlConnection con;
public MainForm()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer, true);
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Rectangle rect = new Rectangle(0, 0, Width, 20);
Brush Brush1 = new LinearGradientBrush(rect, Color.FromArgb(255, 255, 155), Color.FromArgb(255, 168, 82), LinearGradientMode.Vertical);
g.FillRectangle(Brush1, rect);
}
private void Form1_Load(object sender, EventArgs e)
{
button3.Image = Resource1.arrow_down_16;
groupBox1.Visible = false;
button1_Click(this, null);
con = new SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=\"D:\\Zeiterfassung\\Zeiterfassung\\TimeDB.mdf\";Integrated Security=True;Connect Timeout=30;User Instance=True";
try
{
con.Open();
}
catch (
Exception MyException)
{
MessageBox.Show(MyException.ToString());
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
splitContainer1.Panel2.Controls.Clear();
con.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
DateTime dt = new DateTime();
dt = DateTime.Now;
label2.Text = dt.ToLongTimeString();
}
private void button1_Click(object sender, EventArgs e)
{
if (tCol == null)
{
splitContainer1.Panel2.Controls.Clear();
emplo = null;
proj = null;
tCol = new TimeCollect();
tCol.Dock = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(tCol);
tCol.Show();
}
}
private void button5_Click(object sender, EventArgs e)
{
if (emplo == null)
{
splitContainer1.Panel2.Controls.Clear();
tCol = null;
proj = null;
emplo = new employee();
emplo.Dock = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(emplo);
emplo.Show();
}
}
private void button7_Click(object sender, EventArgs e)
{
if (proj == null)
{
splitContainer1.Panel2.Controls.Clear();
tCol = null;
emplo = null;
proj = new projects();
proj.Dock = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(proj);
proj.Show();
}
}
private void button3_Click(object sender, EventArgs e)
{
if (groupBox1.Visible == false)
{
groupBox1.Visible = true;
button3.Image = Resource1.arrow_up_16;
}
else
{
groupBox1.Visible = false;
button3.Image = Resource1.arrow_down_16;
button1.PerformClick();
}
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Rectangle rect = new Rectangle(0, 0, Width, Height);
Brush Brush1 = new LinearGradientBrush(rect, Color.White, Color.Black, LinearGradientMode.Vertical);
g.FillRectangle(Brush1, rect);
}
}
}