Ejemplo n.º 1
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            Schedule s = new Schedule();
            s.first_half_in = new System.DateTime(1, 1, 1, this.first_half.hour_in, this.first_half.min_in, 0);
            s.first_half_out = new System.DateTime(1, 1, 1, this.first_half.hour_out, this.first_half.min_out, 0);

            s.second_half_in = new System.DateTime(1, 1, 1, this.second_half.hour_in, this.second_half.min_in, 0);
            s.second_half_out = new System.DateTime(1, 1, 1, this.second_half.hour_out, this.second_half.min_out, 0);

            s.template_name = txttemplate_name.Text;

            s.hours_allocated = this.first_half.hoursallocated + this.second_half.hoursallocated;
            //MessageBox.Show(s.am_in.ToLongTimeString());
            if (s.save())
            {
                MessageBox.Show("Successful", "Saving...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                this.Parent.Height = 0;
                this.Parent.Controls.Clear();
                this.Dispose();
            }
            else {
                MessageBox.Show("There was a problem saving this template :" + db.err.Message);
            }
        }