protected void lstCaseType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (lstOrganization.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कार्यालय छान्नुस";
            this.programmaticModalPopup.Show();
            return;
        }
        ClearControls();

        try
        {
            List <ATTOrgCaseRegistrationType> LstOrgCaseRegType = BLLOrgCaseRegistrationType.GetOrgCaseRegType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue), null, "Y", 0);

            this.lstRegistrationType.DataSource     = LstOrgCaseRegType;
            this.lstRegistrationType.DataTextField  = "RegTypeName";
            this.lstRegistrationType.DataValueField = "RegTypeID";
            this.lstRegistrationType.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    void LoadOrgRegType()
    {
        try
        {
            List <ATTOrgCaseRegistrationType> LstOrgRegType = BLLOrgCaseRegistrationType.GetOrgCaseRegType(orgID, int.Parse(DDLCaseType.SelectedValue), null, "Y", 0);

            chkRegType.DataSource     = LstOrgRegType;
            chkRegType.DataTextField  = "RegTypeName";
            chkRegType.DataValueField = "RegTypeID";
            chkRegType.DataBind();
        }
        catch (Exception ex)
        {
            lblStatusMessage.Text = ex.Message;
            programmaticModalPopup.Show();
        }
    }
    protected void lstCaseType_SelectedIndexChanged(object sender, EventArgs e)
    {
        ClearControls();

        if (lstOrganization.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कृपया कार्यालय छान्नुहोस. ";
            this.programmaticModalPopup.Show();
            return;
        }

        try
        {
            List <ATTOrgCaseRegistrationType> LstOrgCaseRegType = BLLOrgCaseRegistrationType.GetOrgCaseRegType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue), null, null, 0);

            foreach (ATTOrgCaseRegistrationType att in LstOrgCaseRegType)
            {
                foreach (GridViewRow row in grdRegType.Rows)
                {
                    CheckBox cbActive = (CheckBox)(row.Cells[0].FindControl("chkSelect"));

                    if ((att.RegTypeID == int.Parse(row.Cells[1].Text)) && (att.Active == "Y"))
                    {
                        cbActive.Checked  = true;
                        row.Cells[3].Text = "Y";
                    }
                    else if ((att.RegTypeID == int.Parse(row.Cells[1].Text)) && (att.Active == "N"))
                    {
                        cbActive.Checked  = false;
                        row.Cells[3].Text = "N";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblStatusMessage.Text = ex.Message;
            programmaticModalPopup.Show();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lstOrganization.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कृपया कार्यालय छान्नुहोस. ";
            this.programmaticModalPopup.Show();
            return;
        }

        if (lstCaseType.SelectedIndex == -1)
        {
            this.lblStatusMessage.Text = "कृपया दर्ता किताब छान्नुहोस. ";
            this.programmaticModalPopup.Show();
            return;
        }



        List <ATTOrgCaseRegistrationType> OrgCaseRegTypeList = new List <ATTOrgCaseRegistrationType>();
        ATTOrgCaseRegistrationType        objOrgCaseRegType  = new ATTOrgCaseRegistrationType();

        foreach (GridViewRow row in grdRegType.Rows)
        {
            CheckBox cbSelect = (CheckBox)(row.Cells[0].FindControl("chkSelect"));

            if (cbSelect.Checked == true && row.Cells[3].Text == "")
            {
                objOrgCaseRegType = new ATTOrgCaseRegistrationType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue), int.Parse(row.Cells[1].Text), "", "Y", "A");
            }

            else if (cbSelect.Checked == false && row.Cells[3].Text == "Y")
            {
                objOrgCaseRegType = new ATTOrgCaseRegistrationType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue), int.Parse(row.Cells[1].Text), "", "N", "E");
            }

            else if (cbSelect.Checked == true && row.Cells[3].Text == "N")
            {
                objOrgCaseRegType = new ATTOrgCaseRegistrationType(int.Parse(lstOrganization.SelectedValue), int.Parse(lstCaseType.SelectedValue), int.Parse(row.Cells[1].Text), "", "Y", "E");
            }
            else
            {
                continue;
            }

            objOrgCaseRegType.EntryBy = strUser;
            OrgCaseRegTypeList.Add(objOrgCaseRegType);

            if (OrgCaseRegTypeList.Count == 0)
            {
                return;
            }
        }
        try
        {
            if (BLLOrgCaseRegistrationType.SaveOrgCaseRegType(OrgCaseRegTypeList))
            {
                this.lblStatusMessage.Text = "Successfully Saved. ";
                this.programmaticModalPopup.Show();
                ClearControls();
                lstCaseType.SelectedIndex = -1;
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }