Ejemplo n.º 1
0
        private void lbTimeAttendance_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbTimeAttendance.SelectedItems.Count > 0) {
                Attendance at = new Attendance();
                at.empid = emp.empid;
               String h = lbTimeAttendance.SelectedItem.ToString();
               DateTime t = Convert.ToDateTime(h);
               DateTime date_ = new DateTime(dtdate_.Value.Year, dtdate_.Value.Month, dtdate_.Value.Day, t.Hour, t.Minute, t.Second);

               at.date_time = date_;

               if (MessageBox.Show("Confirm delete this attendance :" + date_.ToString("MMMM dd, yyyy HH:mm:ss") + "?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) {

                   if (at.delete())
                   {
                       LoadThisDatesAttendance();
                   }
                   else
                   {
                       MessageBox.Show("There was a problem deleting this attendance", "Deleting Attendance");
                   }

                }// end if messagebox

            }//end if count >0

             //  MessageBox.Show(date_.ToString("MMMM dd, yyyy HH:mm:ss"));
        }