/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { string strEmployeeStatus = string.Empty; if (rbtnAll.Checked) { strEmployeeStatus = "All"; } else if (rbtnActive.Checked) { strEmployeeStatus = "Active"; } else if (rbtnInActive.Checked) { strEmployeeStatus = "InActive"; } if (strEmployeeStatus != string.Empty && cmbDesigantion.SelectedIndex > -1) { CreateGrid(); DailyAttendanceMasterSP spDailyAttendanceMaster = new DailyAttendanceMasterSP(); EmployeeSP spEmployee = new EmployeeSP(); DataTable dtblEmployee = new DataTable(); dtblEmployee = spEmployee.EmployeeViewByDesignationAndStatus(cmbDesigantion.Text, strEmployeeStatus); if (dtblEmployee.Rows.Count > 0) { for (int i = 0; i < dtblEmployee.Rows.Count; i++) { dgvMonthlyAttendance.Rows.Add(); dgvMonthlyAttendance.Rows[i].Cells["employeeId"].Value = dtblEmployee.Rows[i]["employeeId"].ToString(); dgvMonthlyAttendance.Rows[i].Cells["SlNo"].Value = i + 1; dgvMonthlyAttendance.Rows[i].Cells["employeeName"].Value = dtblEmployee.Rows[i]["employeeName"].ToString(); dgvMonthlyAttendance.Rows[i].Cells["employeeCode"].Value = dtblEmployee.Rows[i]["employeeCode"].ToString(); DataTable dtblStatus = spDailyAttendanceMaster.MonthlyAttendanceReportFill(dtpMonth.Value, Convert.ToDecimal(dtblEmployee.Rows[i]["employeeId"].ToString())); if (dtblStatus.Rows.Count > 0) { for (int j = 0; j < dtblStatus.Rows.Count; j++) { dgvMonthlyAttendance.Rows[i].Cells[DateTime.Parse(dtblStatus.Rows[j]["date"].ToString()).Day.ToString()].Value = dtblStatus.Rows[j]["status"].ToString(); } } FindTotal(i); } } CheckedChange(); } } catch (Exception ex) { MessageBox.Show("MAR2 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public List <DataTable> MonthlyAttendanceReportFill(DateTime dtMonth, decimal decEmployeeId) { List <DataTable> listObj = new List <DataTable>(); try { listObj = SpDailyAttendanceMaster.MonthlyAttendanceReportFill(dtMonth, decEmployeeId); } catch (Exception ex) { MessageBox.Show("A6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(listObj); }