protected void btnSubmit_Click(object sender, EventArgs e)
    {
        List <ATTEmployeeDeputaion> LSTEmpDeputation = (List <ATTEmployeeDeputaion>)Session["EmpDepReturn"];

        int countErr = 0;

        for (int j = 0; j <= this.grdEmpDepReturn.Rows.Count - 1; j++)
        {
            bool val = true;
            LSTEmpDeputation[j].ReturnDate = ((TextBox)grdEmpDepReturn.Rows[j].FindControl("TextBox1")).Text;

            string leavedate  = LSTEmpDeputation[j].LeaveDate;
            string returndate = LSTEmpDeputation[j].ReturnDate;

            if (returndate.Trim() != "")
            {
                val = (CheckDateIsValid(leavedate, returndate));
            }
            if (!val)
            {
                countErr++;
            }


            LSTEmpDeputation[j].Action = "ER";
        }
        try
        {
            if (countErr == 0)
            {
                List <ATTEmployeeDeputaion> LST = LSTEmpDeputation.FindAll(
                    delegate(ATTEmployeeDeputaion obj)
                {
                    return(obj.ReturnDate != "");
                }
                    );
                if (BLLEmployeeDeputation.SaveEmpForDeputation(LST))
                {
                    this.lblStatusMessage.Text = "**Employee Deputation Return Successfully Save";
                    this.programmaticModalPopup.Show();
                    int    orgid  = int.Parse(Session["Orgid"].ToString());
                    string active = "Y";
                    List <ATTEmployeeDeputaion> LSTEmpDepReturn = BLLEmployeeDeputation.GetEmpForDeputationReturn(orgid, active);
                    this.grdEmpDepReturn.DataSource = LSTEmpDepReturn;
                    this.grdEmpDepReturn.DataBind();
                    return;
                }
            }
            else
            {
                this.lblStatusMessage.Text = countErr.ToString() + ".  data has invalid date<br/>**Leave Date Is Greater Than Return Date";
                this.programmaticModalPopup.Show();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void LoadEmpDepReturn()
    {
        int    orgid  = int.Parse(Session["Orgid"].ToString());
        string active = "Y";
        List <ATTEmployeeDeputaion> LSTEmpDepReturn = BLLEmployeeDeputation.GetEmpForDeputationReturn(orgid, active);

        Session["EmpDepReturn"]         = LSTEmpDepReturn;
        this.grdEmpDepReturn.DataSource = LSTEmpDepReturn;
        this.grdEmpDepReturn.DataBind();
    }