protected void btnSaveNewBusinessUnit_Click(object sender, EventArgs e)
        {
            bool   isFormFilled            = true;
            string display                 = "";
            BusinessUnitReportingChild li  = new BusinessUnitReportingChild();
            string businessUnitCode        = newBusinessUnitCode.Text;
            string businessUnitName        = newBusinessUnitName.Text;
            string businessUnitManagerName = newBusinessUnitManagerName.SelectedValue.ToString();
            string companyName             = newCompanyName.SelectedValue.ToString();
            string effectiveDate           = Request.Form[newEffectiveDate.UniqueID];


            if (String.IsNullOrEmpty(effectiveDate) || String.IsNullOrEmpty(businessUnitCode) ||
                String.IsNullOrEmpty(businessUnitName) || String.IsNullOrEmpty(businessUnitManagerName) || companyName.Equals("Select One"))
            {
                display = "Please select all the mandatory fields ";
                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                isFormFilled = false;
            }


            if (isFormFilled)
            {
                if (memberships == 1 || memberships == 2)
                {
                    DataSet result = li.AddNewBusinessUnit(businessUnitCode, businessUnitName, businessUnitManagerName, companyName, effectiveDate);

                    string res = Convert.ToString(result.Tables[0].Rows[0].ItemArray[0]);
                    if (res.Contains("Effective Date should be after"))
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + res + "');", true);
                        isFormFilled = false;
                        ModalPopupExtender1.Show();
                    }
                    else if (res.Equals("Duplicate BusinessUnitCode"))
                    {
                        display = "Business Unit Code already exists in the database";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }
                    else if (res.Equals("Duplicate BusinessUnitName"))
                    {
                        display = "Business Unit Name already exists in the database";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }
                    else if (res.Equals("Success"))
                    {
                        display = "A new Business Unit is successfully added in the database";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = true;
                    }
                    if (isFormFilled)
                    {
                        newBusinessUnitCode.Text = "";
                        newBusinessUnitName.Text = "";
                        ddlBusinessUnitManagerName.DataSource    = li.BusinessUnitManagerNameList().Tables[0];
                        ddlBusinessUnitManagerName.DataTextField = "BusinessUnitManagerName";
                        ddlBusinessUnitManagerName.DataBind();

                        ddlCompanyName.DataSource    = li.CompanyNameList().Tables[0];
                        ddlCompanyName.DataTextField = "CompanyName";
                        ddlCompanyName.DataBind();
                        BindGridView();
                    }
                }

                else
                {
                    display = "You must be a member of Consolidated Sales Reporting – Admin or Consolidated Sales Reporting – Finance  groups to Add New Business Units.";
                    ClientScript.RegisterStartupScript(this.GetType(), "yourMessage", "alert('" + display + "');", true);
                }
            }
        }