void LoadCaseStatus()
 {
     try
     {
         Session["CaseStatus"] = BLLCaseStatus.GetCaseStatus(null, null, 0);
         List <ATTCaseStatus> CaseStatusList = (List <ATTCaseStatus>)Session["CaseStatus"];
         this.lstCaseStatus.DataSource     = CaseStatusList;
         this.lstCaseStatus.DataTextField  = "CaseStatusName";
         this.lstCaseStatus.DataValueField = "CaseStatusID";
         this.lstCaseStatus.DataBind();
     }
     catch (Exception ex)
     {
         this.lblStatusMessage.Text = ex.Message;
         this.programmaticModalPopup.Show();
     }
 }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (txtCaseStatus_RQD.Text == "")
        {
            lblStatusMessage.Text = "मुदाको ञव्स्था लेख्नुस";
            programmaticModalPopup.Show();
            return;
        }

        int CaseStatus = 0;

        if (lstCaseStatus.SelectedIndex != -1)
        {
            CaseStatus = int.Parse(lstCaseStatus.SelectedValue);
        }

        foreach (ListItem lst in lstCaseStatus.Items)
        {
            if (lst.Selected == true)
            {
                continue;
            }
            if (lst.Text.Trim().ToLower() == txtCaseStatus_RQD.Text.Trim().ToLower())
            {
                this.lblStatusMessage.Text = "Case Ststus Already Exists";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        ATTCaseStatus objCaseStatus = new ATTCaseStatus(CaseStatus, this.txtCaseStatus_RQD.Text.Trim(), this.chkActive.Checked == true ? "Y" : "N");

        objCaseStatus.EntryBy = strUser;
        if (this.lstCaseStatus.SelectedIndex > -1)
        {
            objCaseStatus.Action = "E";
        }
        else
        {
            objCaseStatus.Action = "A";
        }

        try
        {
            List <ATTCaseStatus> ListCaseStatusList = (List <ATTCaseStatus>)Session["CaseStatus"];
            BLLCaseStatus.SaveCaseStatus(objCaseStatus);
            if (this.lstCaseStatus.SelectedIndex > -1)
            {
                ListCaseStatusList[this.lstCaseStatus.SelectedIndex].CaseStatusID   = objCaseStatus.CaseStatusID;
                ListCaseStatusList[this.lstCaseStatus.SelectedIndex].CaseStatusName = objCaseStatus.CaseStatusName;
                ListCaseStatusList[this.lstCaseStatus.SelectedIndex].Active         = objCaseStatus.Active;
            }
            else
            {
                ListCaseStatusList.Add(objCaseStatus);
            }
            ClearControls();
            this.lstCaseStatus.DataSource = ListCaseStatusList;
            this.lstCaseStatus.DataBind();
            this.lblStatusMessage.Text = "Case Status Successfully Saved.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }