private void ReLoadGrid(int inspID)
    {
        try
        {
            int rowCount = 0;

            _obj_smhr_Inspection_Schedule = new SMHR_INSPECTION_SCHEDULE();
            _obj_smhr_Inspection_Schedule.INSPECTION_SCHEDULE_INSPECTION_ID = inspID;
            _obj_smhr_Inspection_Schedule.INSPECTION_SCHEDULE_ASSIGNED_TO   = Convert.ToInt32(Session["EMP_ID"]);
            _obj_smhr_Inspection_Schedule.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);

            DataTable dt_getInspection = BLL.GET_INSPECTIONSCHEDULE_ISCOMPLIANT(_obj_smhr_Inspection_Schedule);

            if (dt_getInspection.Rows.Count > 0)
            {
                Rg_Areas_To_Inspected.DataSource = dt_getInspection;
            }

            Rg_Areas_To_Inspected.DataBind();

            for (int i = 0; i < dt_getInspection.Rows.Count; i++)
            {
                string isSelect = Convert.ToString(dt_getInspection.Rows[i]["INSPECTION_AREA_ISCOMPLIANT"]);
                string isComent = Convert.ToString(dt_getInspection.Rows[i]["INSPECTION_AREA_COMMENTS"]);

                if ((isSelect == string.Empty) && (isComent == string.Empty))
                {
                    rowCount++;
                }
            }

            //for (int index = 0; index <= Rg_Areas_To_Inspected.Items.Count - 1; index++)
            //{
            //    CheckBox chkSelect = Rg_Areas_To_Inspected.Items[index].FindControl("chk_Choose") as CheckBox;

            //    if ((chkSelect.Checked) && (Rg_Areas_To_Inspected.Items[index].Enabled == true))
            //        rowCount++;
            //}

            if (rowCount > 0)
            {
                btn_Submit.Enabled = true;
            }
            else
            {
                btn_Submit.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionIsCompliant", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    protected void rad_InspectionName_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        try
        {
            btn_Submit.Enabled = true;

            if (rad_InspectionName.SelectedIndex != 0)
            {
                int inspID = Convert.ToInt32(rad_InspectionName.SelectedValue);
                ViewState["inspID"] = inspID;

                //LoadGridbyInsID(inspID);
                _obj_smhr_Inspection_Schedule = new SMHR_INSPECTION_SCHEDULE();
                _obj_smhr_Inspection_Schedule.INSPECTION_SCHEDULE_INSPECTION_ID = inspID;
                _obj_smhr_Inspection_Schedule.INSPECTION_SCHEDULE_ASSIGNED_TO   = Convert.ToInt32(Session["EMP_ID"]);
                _obj_smhr_Inspection_Schedule.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                DataTable dt_getInspection = BLL.GET_INSPECTIONSCHEDULE_ISCOMPLIANT(_obj_smhr_Inspection_Schedule);
                if (dt_getInspection != null)
                {
                    if (dt_getInspection.Rows.Count > 0)
                    {
                        Rg_Areas_To_Inspected.DataSource = dt_getInspection;
                        Rg_Areas_To_Inspected.DataBind();
                        rdtp_FromDate.SelectedDate = Convert.ToDateTime(dt_getInspection.Rows[0]["INSPECTION_SCHEDULE_FROMDATE"].ToString());
                        rdtp_ToDate.SelectedDate   = Convert.ToDateTime(dt_getInspection.Rows[0]["INSPECTION_SCHEDULE_TODATE"].ToString());
                        rtp_FromTime.SelectedDate  = Convert.ToDateTime(dt_getInspection.Rows[0]["INSPECTION_SCHEDULE_FROMTIME"].ToString());
                        rtp_ToTime.SelectedDate    = Convert.ToDateTime(dt_getInspection.Rows[0]["INSPECTION_SCHEDULE_TOTIME"].ToString());

                        divControls.Visible = true;
                        btn_Submit.Visible  = true;
                        btn_Cancel.Visible  = true;

                        //LoadGrid();
                    }
                }
            }
            else
            {
                divControls.Visible  = false;
                btn_Submit.Visible   = false;
                btn_Cancel.Visible   = false;
                divNoRecords.Visible = false;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionIsCompliant", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Ejemplo n.º 3
0
    private void LoadGrid()
    {
        try
        {
            _obj_smhr_inspection_schedule = new SMHR_INSPECTION_SCHEDULE();
            dtInspectionGrid = new DataTable();

            _obj_smhr_inspection_schedule.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);

            if (rdtp_FromDate.SelectedDate != null)
            {
                _obj_smhr_inspection_schedule.INSPECTION_SCHEDULE_FROMDATE = Convert.ToDateTime(rdtp_FromDate.SelectedDate);
            }
            else
            {
                BLL.ShowMessage(this, "Please Select From Date");
                rdtp_FromDate.Focus();
            }

            if (rdtp_ToDate.SelectedDate != null)
            {
                _obj_smhr_inspection_schedule.INSPECTION_SCHEDULE_TODATE = Convert.ToDateTime(rdtp_ToDate.SelectedDate);
            }
            else
            {
                BLL.ShowMessage(this, "Please Select To Date");
                rdtp_ToDate.Focus();
            }

            empID = Convert.ToInt32(Session["EMP_ID"]);

            if ((empID != 0) && ((rdtp_FromDate.SelectedDate != null)) && ((rdtp_ToDate.SelectedDate != null)))
            {
                dtInspectionGrid = BLL.Get_Past_Inspection_Data(_obj_smhr_inspection_schedule, empID);
            }
            else
            {
                BLL.ShowMessage(this, "There is No Employee to show Records..");
                return;
            }

            Rg_Areas_To_Inspected.DataSource = dtInspectionGrid;
            Rg_Areas_To_Inspected.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_PastInspections", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
    public void LoadGrid()
    {
        try
        {
            _obj_smhr_Inspection_Schedule.OPERATION    = operation.GET_INSPECTIONS_ASSIGNEDTO;
            _obj_smhr_Inspection_Schedule.LOGIN_EMP_ID = Convert.ToInt32(Session["EMP_ID"]);
            _obj_smhr_Inspection_Schedule.INSPECTION_SCHEDULE_INSPECTION_ID = Convert.ToInt32(rad_InspectionName.SelectedValue);
            DataTable dt_Inspections = BLL.get_AllInspectionSchedules2(_obj_smhr_Inspection_Schedule);
            if (dt_Inspections != null)
            {
                if (dt_Inspections.Rows.Count > 0)
                {
                    //rad_InspectionName.SelectedValue = Convert.ToString(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_ID"]);
                    ViewState["ScheduleId"]          = Convert.ToString(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_ID"]);
                    rdtp_FromDate.SelectedDate       = Convert.ToDateTime(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_FROMDATE"]);
                    rdtp_ToDate.SelectedDate         = Convert.ToDateTime(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_TODATE"]);
                    rtp_FromTime.SelectedDate        = Convert.ToDateTime(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_FROMTIME"]);
                    rtp_ToTime.SelectedDate          = Convert.ToDateTime(dt_Inspections.Rows[0]["INSPECTION_SCHEDULE_TOTIME"]);
                    Rg_Areas_To_Inspected.DataSource = dt_Inspections;
                    Rg_Areas_To_Inspected.DataBind();
                    INSPECTION_AREA_ID.Text          = dt_Inspections.Rows[0]["INSPECTION_AREA_ID"].ToString();
                    INSPECTION_AREA_SCHEDULE_ID.Text = dt_Inspections.Rows[0]["INSPECTION_AREA_SCHEDULE_ID"].ToString();
                    AREA_ID.Text = dt_Inspections.Rows[0]["AREA_ID"].ToString();

                    divNoRecords.Visible = false;
                    divControls.Visible  = true;
                    btn_Submit.Visible   = true;
                }
                else
                {
                    divNoRecords.Visible = true;
                    divControls.Visible  = false;
                    btn_Submit.Visible   = false;
                }
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_InspectionIsCompliant", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }