protected void btnSave_Click(object sender, EventArgs e)
    {
        List <ATTJudgeWorkList> workList = (List <ATTJudgeWorkList>)Session["Worklist"];

        if (txtWork.Text == "")
        {
            this.lblStatusMessage.Text = "*र्कपया विवरण भर्नुहोस्";
            this.programmaticModalPopup.Show();
            return;
        }
        bool exists = workList.Exists(delegate(ATTJudgeWorkList obj)
        {
            return(obj.JwcName == this.txtWork.Text);
        }
                                      );

        if (exists)
        {
            this.lblStatusMessage.Text = "**सोहि नामको विवरण पहिले नै उपलब्द छ";
            this.programmaticModalPopup.Show();
            this.txtWork.Text = "";
            return;
        }

        string           strUser = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;
        ATTJudgeWorkList objWork = new ATTJudgeWorkList((lstWorks.SelectedIndex >= 0) ? int.Parse(lstWorks.SelectedValue) : 0, txtWork.Text, chkActive.Checked, strUser);

        if (lstWorks.SelectedIndex >= 0)
        {
            objWork.Action = "E";
        }
        else
        {
            objWork.Action = "A";
        }

        if (BLLJudgeWorkList.SaveJudgeWorkList(objWork))
        {
            if (objWork.Action == "A")
            {
                workList.Add(objWork);
                this.lblStatusMessage.Text = "Judge Work List Saved";
                this.programmaticModalPopup.Show();
            }
            else if (objWork.Action == "E")
            {
                workList[lstWorks.SelectedIndex] = objWork;
                this.lblStatusMessage.Text       = "Judge Work List Edited";
                this.programmaticModalPopup.Show();
            }

            Session["WorkList"] = workList;
            lstWorks.DataSource = workList;
            lstWorks.DataBind();

            ClearControls();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtWork.Text == "")
        {
            return;
        }
        string           strUser = "******";
        ATTJudgeWorkList objWork = new ATTJudgeWorkList((lstWorks.SelectedIndex >= 0) ? int.Parse(lstWorks.SelectedValue) : 0, txtWork.Text, chkActive.Checked, strUser);

        if (lstWorks.SelectedIndex >= 0)
        {
            objWork.Action = "E";
        }
        else
        {
            objWork.Action = "A";
        }

        if (BLLJudgeWorkList.SaveJudgeWorkList(objWork))
        {
            List <ATTJudgeWorkList> workList = (List <ATTJudgeWorkList>)Session["Worklist"];
            if (objWork.Action == "A")
            {
                workList.Add(objWork);
            }
            else if (objWork.Action == "E")
            {
                workList[lstWorks.SelectedIndex] = objWork;
            }

            Session["WorkList"] = workList;
            lstWorks.DataSource = workList;
            lstWorks.DataBind();

            ClearControls();
        }
    }