/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo(); DailyAttendanceDetailsSP spDailyAttendanceDetails = new DailyAttendanceDetailsSP(); DailyAttendanceMasterInfo infoDailyAttendanceMaster = new DailyAttendanceMasterInfo(); DailyAttendanceMasterSP spDailyAttendanceMaster = new DailyAttendanceMasterSP(); string strDate = txtCompanyCurrentdate.Text; if (spDailyAttendanceMaster.DailyAttendanceMasterMasterIdSearch(strDate)) { DataTable dtblAttendance = new DataTable(); infoDailyAttendanceMaster.Date = Convert.ToDateTime(txtCompanyCurrentdate.Text.ToString()); dtblAttendance = spDailyAttendanceDetails.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString()); dgvAttendance.DataSource = dtblAttendance; btnDelete.Enabled = true; btnSave.Text = "Update"; int inRowCount = dgvAttendance.RowCount; string strMasterNarration = string.Empty; for (int i = 0; i < inRowCount; i++) { if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != "") { strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString(); } } txtNarrationInMaster.Text = strMasterNarration; } else { DataTable dtblAttendance = new DataTable(); dtblAttendance = spDailyAttendanceDetails.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString()); dgvAttendance.DataSource = dtblAttendance; btnDelete.Enabled = false; btnSave.Text = "Save"; int inRowCount = dgvAttendance.RowCount; string strMasterNarration = string.Empty; for (int i = 0; i < inRowCount; i++) { if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != null) { strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString(); } } txtNarrationInMaster.Text = strMasterNarration; } } catch (Exception ex) { MessageBox.Show("A1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo(); DailyAttendanceDetailsSP spDailyAttendanceDetails = new DailyAttendanceDetailsSP(); DailyAttendanceMasterInfo infoDailyAttendanceMaster = new DailyAttendanceMasterInfo(); DailyAttendanceMasterSP spDailyAttendanceMaster = new DailyAttendanceMasterSP(); string strDate = txtCompanyCurrentdate.Text; if (spDailyAttendanceMaster.DailyAttendanceMasterMasterIdSearch(strDate)) { DataTable dtblAttendance = new DataTable(); infoDailyAttendanceMaster.Date = Convert.ToDateTime(txtCompanyCurrentdate.Text.ToString()); dtblAttendance = spDailyAttendanceDetails.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString()); dgvAttendance.DataSource = dtblAttendance; btnDelete.Enabled = true; btnSave.Text = "Update"; int inRowCount = dgvAttendance.RowCount; string strMasterNarration = string.Empty; for (int i = 0; i < inRowCount; i++) { if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != "") { strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString(); } } txtNarrationInMaster.Text = strMasterNarration; } else { DataTable dtblAttendance = new DataTable(); dtblAttendance = spDailyAttendanceDetails.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString()); dgvAttendance.DataSource = dtblAttendance; btnDelete.Enabled = false; btnSave.Text = "Save"; int inRowCount = dgvAttendance.RowCount; string strMasterNarration = string.Empty; for (int i = 0; i < inRowCount; i++) { if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != null) { strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString(); } } txtNarrationInMaster.Text = strMasterNarration; } } catch (Exception ex) { MessageBox.Show("A1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }