Esempio n. 1
0
        /// <summary>
        /// this function add all data to the database
        /// </summary>
        /// <param name="attendence">object of Attendence</param>
        public static void MarkAttendence(Attendence attendence)
        {
            int      AttendenceId   = attendence.AttendenceId;
            DateTime LoginTime      = attendence.LoginTime;
            DateTime LogoutTime     = attendence.LogoutTime;
            DateTime AttendenceDate = attendence.AttendenceDate;

            string query = string.Format("Insert Into AttendenceRecord(AttendenceId, LogInTime, LogOutTime, AttendenceDate) Values('{0}', '{1}', '{2}', '{3}')", AttendenceId, LoginTime, LogoutTime, AttendenceDate);

            DataBaseConnection.getInstance().executeQuery(query);
        }
Esempio n. 2
0
        /// <summary>
        /// When event clicked it add the data to the datatable of database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogOut_Click(object sender, EventArgs e)
        {
            Attendence attendence = new Attendence();
            int        check      = DataBaseConnection.getInstance().alreadyPresentInDB(txtId.Text, "EmployeeData", "EmployeeId");

            if (check > 0)
            {
                attendence.AttendenceId   = id;
                attendence.LoginTime      = logInTime;
                attendence.LogoutTime     = DateTime.Now;
                attendence.AttendenceDate = DateTime.Now.Date;
                Employee.MarkAttendence(attendence);
                dgvAttendenceRecord.DataSource = DataBaseConnection.getInstance().ShowData("AttendenceRecord");
                showOnlyTime(1);
                showOnlyTime(2);
                lblMessege.Text = "";
            }
            else
            {
                lblMessege.Text = "There is no employee of this ID";
            }
        }