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 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 loadData(string k) { //MessageBox.Show(k); string query = "select EmpID,Photo,EmpNIC,EmpfName,EmplName,Position,DOB,ContactNo,Email,No,Street,City,JoinDate from Employee where EmpID='" + k + "' ORDER BY EmpID ASC "; SqlDataReader sdr = conn.dataReader(query); while (sdr.Read()) { for (int i = 0; i < fields.Length; i++) { if (i == 12) { fields[i] = sdr.GetDateTime(i).ToString("dd MMM yyyy"); } else { fields[i] = sdr.GetValue(i).ToString(); } //MessageBox.Show(fields[i]); } } lblID.Text = fields[0]; photoBox.Image = Image.FromFile(@"C:\Users\House MoNaRa\Documents\Visual Studio 2015\Projects\EmployeeM\EmployeeM\Images\" + fields[1]); txtNIC.Text = fields[2]; txtfName.Text = fields[3]; txtlName.Text = fields[4]; dropdPos.Text = fields[5]; datetimeBD.Text = fields[6]; txtTele.Text = fields[7]; txtEmail.Text = fields[8]; txtAddressNo.Text = fields[9]; txtAddressStreet.Text = fields[10]; txtAddressCity.Text = fields[11]; lblJoin.Text = fields[12]; conn.closeConnection(); }
public EmpDetAtt() { InitializeComponent(); tbl = new Table(5, Next, Previous, pnltbl, true, 1, 4); tbl.setTblRowsImage(r1, r2, r3, r4, r5); tbl.setQuery1("select EmpID,Photo,EmpNIC,EmpfName+' '+EmplName as FullName,Position from Employee where MarkedStatus='on' ORDER BY EmpID ASC"); tbl.setQuery2("select count(*) from Employee where MarkedStatus='on' "); // tbl.setCBoxs(c1, c2); tbl.setPath(@"C:\Users\House MoNaRa\Documents\Visual Studio 2015\Projects\EmployeeM\EmployeeM\Images\"); tbl.tblTheamSetter(Color.FromArgb(38, 95, 141), Color.FromArgb(47, 50, 67), Color.FromArgb(89, 89, 89, 89), Color.FromArgb(169, 171, 183)); tbl.setSelects(); tbl.enablePagination(); tbl.setPages(); tbl.loadFirstPage(); days = (int)conn.dataReaderScalar("select count(*) from tempAtt where Month='" + datetime.Month + "' and Year='" + datetime.Year + "' group by Date "); //MessageBox.Show(days.ToString()); SqlDataReader dr = conn.dataReader("select EmpID from tempAtt group by EmpID "); for (int i = 0; i < days; i++) { while (dr.Read()) { IDvalues = dr[0].ToString(); //MessageBox.Show(IDvalues); totaldays = (int)conn.dataReaderScalar("select count(*) from tempAtt where Month='" + datetime.Month + "' and Year='" + datetime.Year + "' group by Date "); present = (int)conn.dataReaderScalar("select count(EmpID) from tempAtt where EmpID='" + IDvalues + "' and Month='" + datetime.Month + "' and Year='" + datetime.Year + "' and AttendanceStatus='Present' group by EmpID"); absent = (int)conn.dataReaderScalar("select count(EmpID) from tempAtt where EmpID='" + IDvalues + "' and Month='" + datetime.Month + "' and Year='" + datetime.Year + "' and AttendanceStatus='Absent' group by EmpID"); //MessageBox.Show(totaldays.ToString() + '=' + present.ToString() + '+' + absent.ToString()); monpreavg = (present / (double)totaldays) * 100; //MessageBox.Show(monpreavg.ToString("f2")); //conn.executeQry("INSERT INTO Attendance (Date,EmpID) VALUES ('" + datetime + "','" + IDvalues + "') "); } } fulldays = (int)conn.dataReaderScalar("select COUNT(*) from tempAtt group by EmpID "); //MessageBox.Show(fulldays.ToString()); SqlDataReader sdr = conn.dataReader("select EmpID from tempAtt group by EmpID "); for (int i = 0; i < fulldays; i++) { while (sdr.Read()) { FullIDvalues = sdr[0].ToString(); //MessageBox.Show(FullIDvalues); fulltotaldays = (int)conn.dataReaderScalar("select count(*) from tempAtt where Year='" + datetime.Year + "' group by Year,EmpID "); fullpresent = (int)conn.dataReaderScalar("select count(EmpID) from tempAtt where EmpID='" + FullIDvalues + "' and AttendanceStatus='Present' and Year='" + datetime.Year + "' group by Year,EmpID "); fullabsent = (int)conn.dataReaderScalar("select count(EmpID) from tempAtt where EmpID='" + FullIDvalues + "' and AttendanceStatus='Absent' and Year='" + datetime.Year + "' group by Year,EmpID "); //MessageBox.Show(fulltotaldays.ToString() + '=' + fullpresent.ToString() + '+' + fullabsent.ToString()); yrpreavg = (fullpresent / (double)fulltotaldays) * 100; //MessageBox.Show(yrpreavg.ToString("f2")); //conn.executeQry("INSERT INTO Attendance (Date,EmpID) VALUES ('" + datetime + "','" + IDvalues + "') "); } } conn.closeConnection(); }