Exemplo n.º 1
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            //CREATE A NEW PASS SLIP INSTANCE
            PassSlip ps = new PassSlip();

            ps.empid = emp.empid;

            ps.destination = txtdestination.Text;
            ps.passtype = cbopasstype.Text;
            ps.allowance = Convert.ToDecimal(txtallowance.Text);
            //GET DATA FOR TIME IN
            //year,month,day,hour,minute,second
            int yr, mnth, dy, hr, min, sec;
            yr = dtdate.Value.Year;
            mnth=dtdate.Value.Month;
            dy = dtdate.Value.Day;
            hr = dttimein.Value.Hour;
            min = dttimein.Value.Minute;
            sec = dttimein.Value.Second;

            ps.datetime_in = new DateTime(yr,mnth,dy,hr,min,sec);

            //GET DATA FOR TIME OUT
            hr = dttimeout.Value.Hour;
            min = dttimeout.Value.Minute;
            sec = dttimeout.Value.Second;

            ps.datetime_out = new DateTime(yr, mnth, dy, hr, min, sec);

            if (ps.save())
            {
                MessageBox.Show("Successful");
            }
            else {
                MessageBox.Show("There was a problem saving pass slip : \n" + db.err.Message);
            }
        }