protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.txtSewaName.Text == "")
        {
            this.lblStatus.Text = "Please enter Sewa name.";
            this.lblStatus.Focus();
            return;
        }

        ATTSewa sewa;

        if (this.lstSewa.SelectedIndex <= -1)
        {
            sewa = (ATTSewa)Session["sewa"];

            sewa.SewaID   = 0;
            sewa.SewaName = this.txtSewaName.Text;
            sewa.EntryBy  = "suraj";
            sewa.EntryOn  = DateTime.Now;
            sewa.Action   = "A";
        }
        else
        {
            sewa = ((List <ATTSewa>)Session["sewa_list"])[this.lstSewa.SelectedIndex];

            sewa.SewaName = this.txtSewaName.Text;
        }

        try
        {
            BLLSewa.AddSewa(sewa);

            if (this.lstSewa.SelectedIndex <= -1)
            {
                ((List <ATTSewa>)Session["sewa_list"]).Add(sewa);
            }
            else
            {
                ((List <ATTSewa>)Session["sewa_list"])[this.lstSewa.SelectedIndex] = sewa;
            }

            this.lstSewa.DataSource     = Session["sewa_list"];
            this.lstSewa.DataTextField  = "SewaName";
            this.lstSewa.DataValueField = "SewaID";
            this.lstSewa.DataBind();

            this.ClearThisObject();
            this.lstSewa.SelectedIndex = -1;
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.ToString();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.txtSewaName.Text == "")
        {
            this.lblStatusMessage.Text = "**सेवाको नाम राख्न्नुहोस्";
            this.programmaticModalPopup.Show();
            return;
        }
        if (this.txtSamuha.Text == "" && this.txtUpaSamuha.Text != "")
        {
            this.lblStatusMessage.Text = "**समुहको नाम राख्नुहोस्";
            this.programmaticModalPopup.Show();
            this.txtUpaSamuha.Text = "";
            return;
        }

        ATTSewa sewa = (ATTSewa)Session["Sewa"];

        if (sewa == null)
        {
            this.lblStatusMessage.Text = "**र्कपया सेवा राख्नुहोस्";
            this.programmaticModalPopup.Show();
            return;
        }
        else
        {
            sewa.SewaName = txtSewaName.Text;

            foreach (ATTSamuha VAR in sewa.LstSamuha)
            {
                if (VAR.LstUpaSamuha.Count < 1)
                {
                    ATTUpaSamuha obj = new ATTUpaSamuha();
                    obj.UpaSamuhaName = VAR.SamuhaName;
                    obj.Action        = "A";
                    obj.EntryBy       = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;

                    VAR.LstUpaSamuha.Add(obj);
                }
            }


            try
            {
                if (BLLSewa.AddSewa(sewa))
                {
                    //if (sewa.Action == "A")
                    //{
                    this.lblStatusMessage.Text = "Sewa Saved Successfully.";
                    this.programmaticModalPopup.Show();
                    //}
                    //else
                    //{
                    //    this.lblStatusMessage.Text = "Sewa Edited Successfully";
                    //    this.programmaticModalPopup.Show();
                    //}
                }
                if (this.lstSewa.SelectedIndex == -1)
                {
                    ((List <ATTSewa>)Session["sewa_list"]).Add(sewa);
                }
                else
                {
                    ((List <ATTSewa>)Session["sewa_list"])[this.lstSewa.SelectedIndex] = sewa;
                }

                this.lstSewa.DataSource     = Session["sewa_list"];
                this.lstSewa.DataTextField  = "SewaName";
                this.lstSewa.DataValueField = "SewaID";
                this.lstSewa.DataBind();
                this.ClearThisObject();
                this.lstSewa.SelectedIndex = -1;
                this.txtSewaName.Focus();
            }
            catch (Exception ex)
            {
                this.lblStatusMessage.Text = ex.ToString();
                this.programmaticModalPopup.Show();
                return;
            }
        }
    }