private void makeAttendance() { conn = new conDB(); int count = (int)conn.dataReaderScalar("select count(AtID) from Attendance where Date = '" + datetime + "' "); //MessageBox.Show(count.ToString()); if (count == 0) { int x = (int)conn.dataReaderScalar("select count(EmpID) from Employee where MarkedStatus='on' "); //MessageBox.Show(x.ToString()); SqlDataReader dr = conn.dataReader("select EmpID from Employee where MarkedStatus='on' "); for (int i = 0; i < x; i++) { while (dr.Read()) { IDvalues = dr[0].ToString(); //MessageBox.Show(IDvalues); conn = new conDB(); conn.executeQry("INSERT INTO Attendance (Date,EmpID) VALUES ('" + datetime + "','" + IDvalues + "') "); } } } conn.closeConnection(); }
private void pbSearchAll_MouseClick(object sender, MouseEventArgs e) { if (txtSearchAll.Text == "") { MessageBox.Show("Search Box is Empty"); } else { try { conn = new conDB(); SqlDataReader rdr = conn.dataReader("select * from ViewAllAttendance where FullName like '%" + txtSearchAll.Text + "%' "); BindingSource bs = new BindingSource(); bs.DataSource = rdr; bunifuCustomDataGrid1.DataSource = bs; conn.closeConnection(); txtSearchAll.ResetText(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void lblSetAtt_MouseClick(object sender, MouseEventArgs e) { string datetime = DateTime.Now.ToString(); for (int i = 0; i < bunifuCustomDataGrid1.Rows.Count; i++) { String status = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value; MessageBox.Show(status); String EmpID = bunifuCustomDataGrid1.Rows[i].Cells[1].Value.ToString(); MessageBox.Show(EmpID); String leavestatus = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value; //MessageBox.Show(leavestatus); try { if (leavestatus != null) { conn = new conDB(); conn.executeQry("update Attendance set LeaveStates='" + status + "',LeaveTime='" + datetime + "' where EmpID='" + EmpID + "' and Date ='" + datetime + "' "); MessageBox.Show("Successful"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } tableLoad(); }
private void tableLoad() { conn = new conDB(); SqlDataReader rdr = conn.dataReader("select * from ViewAllAttendance "); BindingSource bs = new BindingSource(); bs.DataSource = rdr; bunifuCustomDataGrid1.DataSource = bs; conn.closeConnection(); }
private void tableLoad() { conn = new conDB(); SqlDataReader rdr = conn.dataReader("select e.EmpID,e.EmpfName,e.EmplName,a.Date,a.ArivalTime,a.AttendanceStatus from Attendance a,Employee e where e.EmpID=a.EmpID and a.AttendanceStatus='Present' and MarkedStatus='on' and Date ='" + datetime + "' and LeaveStates is null "); BindingSource bs = new BindingSource(); bs.DataSource = rdr; bunifuCustomDataGrid1.DataSource = bs; conn.closeConnection(); }
public void TableLoad() { conn = new conDB(); SqlDataReader rdr = conn.dataReader("select e.EmpID,e.EmpfName,e.EmplName,e.Position from Attendance a,Employee e where e.EmpID=a.EmpID and e.MarkedStatus='on' and AttendanceStatus='Waiting' and Date='" + datetime + "' and a.ArivalTime is null "); BindingSource bs = new BindingSource(); bs.DataSource = rdr; bunifuCustomDataGrid1.DataSource = bs; conn.closeConnection(); }
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { try { conn = new conDB(); SqlDataReader rdr = conn.dataReader("select * from ViewAllAttendance where Date = '" + dateTimePicker1.Value + "' "); BindingSource bs = new BindingSource(); bs.DataSource = rdr; bunifuCustomDataGrid1.DataSource = bs; conn.closeConnection(); txtSearchAll.ResetText(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void lblSet_MouseClick(object sender, MouseEventArgs e) { for (int i = 0; i < bunifuCustomDataGrid1.Rows.Count; i++) { try { conn = new conDB(); String status = (String)bunifuCustomDataGrid1.Rows[i].Cells[0].Value; //MessageBox.Show(status); String EmpID = bunifuCustomDataGrid1.Rows[i].Cells[1].Value.ToString(); //MessageBox.Show(EmpID); if (status == "Present") { conn.executeQry("update Attendance set ArivalTime='" + datetime + "', AttendanceStatus='Present' where EmpID='" + EmpID + "' and Date='" + datetime + "' "); } else if (status == "Absent") { conn.executeQry("update Attendance set AttendanceStatus='Absent' where EmpID='" + EmpID + "' and Date='" + datetime + "' "); } else { conn.executeQry("update Attendance set AttendanceStatus='Waiting' where EmpID='" + EmpID + "' and Date='" + datetime + "' "); } MessageBox.Show("Successful"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } TableLoad(); }