shah Momin

shah Momin

  • NA
  • 176
  • 21.4k

How To Pass SelectedValue ViewReport to Manual Adjustment

May 31 2022 9:59 PM

This DataGirdView Value Pass In Manual Adjustment Form

private void DgvAttendanceGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
    AdjustmentBLL adjustmentBLL = new AdjustmentBLL();
    ManualAttendance attendance = new ManualAttendance();

    foreach (DataGridViewRow selectedRow in (BaseCollection)dgvAttendanceGrid.SelectedRows)
    {
        iAttendanceLogID = int.Parse(selectedRow.Cells["ATTENDANCELOGID"].Value.ToString());
        DataSet dataSet = adjustmentBLL.FetchAttendanceByLogID(iAttendanceLogID);
        if (dataSet.Tables[0].Rows.Count > 0)
        {
            DataRow row = dataSet.Tables[0].Rows[0];
            attendance.ddlShiftAdjust.Text = row["SHIFT"].ToString();
           attendance.ddlVolunteerNameAdjust.SelectedValue = row["VOLUNTEERID"].ToString();
            if (row["DUTYDATETIME"].ToString() != "")
                attendance.dtp_DutyDuaTime.Value = (DateTime)row["DUTYDATETIME"];
            if (row["CHECKINDATETIME"].ToString() != "")
                attendance.dtp_CheckInDateTime.Value = (DateTime)row["CHECKINDATETIME"];
            if (row["CHECKOUTDATETIME"].ToString() != "")
                attendance.dtp_CheckOutDateTime.Value = (DateTime)row["CHECKOUTDATETIME"];
            attendance.ddlTypeAdjust.Text = row["TYPE"].ToString();
            attendance.ddlPointsAdjust.Text = row["POINTS"].ToString();

            if (row["DUTYSPOT1"].ToString() != "")
                attendance.ddlDutySpot1.SelectedValue = row["DUTYSPOT1"].ToString();
            else
                attendance.ddlDutySpot1.SelectedValue = -1;

            if (row["DUTYSPOT2"].ToString() != "")
                attendance.ddlDutySpot2.SelectedValue = row["DUTYSPOT2"].ToString();
            else
                attendance.ddlDutySpot2.SelectedValue = -1;

            if (row["DUTYSPOT3"].ToString() != "")
                attendance.ddlDutySpot3.SelectedValue = row["DUTYSPOT3"].ToString();
            else
                attendance.ddlDutySpot3.SelectedValue = -1;
        }
        attendance.Show();
    }
}