protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateCourtFee() == false)
        {
            return;
        }

        List <ATTCourtFee> CourtFeeLST = new List <ATTCourtFee>();
        double?            ToAmount;

        foreach (GridViewRow gvRow in this.grdCourtFee.Rows)
        {
            ATTCourtFee objCourtFee = new ATTCourtFee();
            objCourtFee.FromAmount = double.Parse(((TextBox)gvRow.FindControl("txtFromAmount")).Text);
            if (((TextBox)gvRow.FindControl("txtAmountTo")).Text == "")
            {
                ToAmount = null;
            }
            else
            {
                ToAmount = double.Parse(((TextBox)gvRow.FindControl("txtAmountTo")).Text);
            }
            objCourtFee.ToAmount   = ToAmount;
            objCourtFee.AmtPer     = double.Parse(((TextBox)gvRow.FindControl("txtFee")).Text);
            objCourtFee.AmtPerType = ((DropDownList)gvRow.FindControl("ddlAmtPerType")).SelectedValue;//)?0: ((TextBox)gvRow.FindControl("ddlAmtPerType")).Text;
            objCourtFee.EntryBy    = "manoz";
            CourtFeeLST.Add(objCourtFee);
        }

        if (BLLCourtFee.SaveCourtFee(CourtFeeLST))
        {
            LoadCourtFee();
        }
    }
    //protected void GridViewInsert(object sender, EventArgs e)
    protected void GridViewInsert()
    {
        if (ValidateCourtFee() == false)
        {
            return;
        }

        List <ATTCourtFee> CourtFeeLST = new List <ATTCourtFee>();

        TextBox      tbFromAmount;
        TextBox      tbToAmount;
        TextBox      tbFee;
        DropDownList ddl;

        //
        foreach (GridViewRow gvRow in this.grdCourtFee.Rows)
        {
            tbFromAmount = (TextBox)gvRow.FindControl("txtFromAmount");
            tbToAmount   = (TextBox)gvRow.FindControl("txtAmountTo");
            tbFee        = (TextBox)gvRow.FindControl("txtFee");
            ddl          = (DropDownList)gvRow.FindControl("ddlAmtPerType");

            ATTCourtFee objCourtFee = new ATTCourtFee();
            objCourtFee.FromDate   = "";
            objCourtFee.FromAmount = double.Parse(tbFromAmount.Text);
            if (tbToAmount.Text == "")
            {
                objCourtFee.ToAmount = null;
            }
            else
            {
                objCourtFee.ToAmount = double.Parse(tbToAmount.Text);
            }
            objCourtFee.AmtPer     = double.Parse(tbFee.Text);
            objCourtFee.AmtPerType = ddl.SelectedValue;
            objCourtFee.FromToAmt  = "";

            CourtFeeLST.Add(objCourtFee);
        }
        //Session["CourtFee"] = CourtFeeLST;


        ATTCourtFee obj = new ATTCourtFee();

        obj.AmtPerType = "0";
        CourtFeeLST.Add(obj);
        //Session["CourtFee"] = CourtFeeLST;
        grdCourtFee.DataSource = CourtFeeLST;
        grdCourtFee.DataBind();

        Session["CourtFee"] = CourtFeeLST;
    }
        public static List <ATTCourtFee> GetCourtFee(int defaultFlag)
        {
            List <ATTCourtFee> CourtFeeLST = new List <ATTCourtFee>();

            try
            {
                foreach (DataRow row in DLLCourtFee.GetCourtFee().Rows)
                {
                    ATTCourtFee objCourtFee = new ATTCourtFee();
                    objCourtFee.FromDate   = row["FROM_DATE"].ToString();
                    objCourtFee.FromAmount = double.Parse(row["FROM_AMOUNT"].ToString());
                    if (row["TO_AMOUNT"] == System.DBNull.Value)
                    {
                        objCourtFee.ToAmount = null;
                    }
                    else
                    {
                        objCourtFee.ToAmount = double.Parse(row["TO_AMOUNT"].ToString());
                    }
                    objCourtFee.AmtPer     = double.Parse(row["AMT_PER"].ToString());
                    objCourtFee.AmtPerType = row["AMT_PER_TYPE"].ToString();
                    objCourtFee.FromToAmt  = row["AMOUNT_RANGE"].ToString();

                    CourtFeeLST.Add(objCourtFee);
                }

                if (defaultFlag > 0)
                {
                    //ATTCourtFee obj = new ATTCourtFee();
                    //obj.BenchTypeID = 0;
                    //obj.BenchTypeName = "छान्नुहोस";
                    //BenchTypeLST.Insert(0, obj);
                }
                return(CourtFeeLST);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }