public int AddSchoolDetails(tblSchoolDetail tblSchoolDetail)
        {
            string sqlquery = "INSERT INTO [dbo].[tblSchoolDetails] " +
                              "([Sch_Name],[Sch_Code],[Sch_Contact_Person],[Sch_Type_Id],[Sch_CountryId],[Sch_StateId],[Sch_DistrictId]" +
                              ",[Sch_DistrictName],[Sch_CityName],[Sch_PINCode],[Sch_Address1],[Sch_Address2],[Sch_PhNo1],[Sch_Alt_PhNo],[Sch_MobileNo]" +
                              ",[Sch_EmailId],[Sch_Sector],[Sch_University],[Univ_Code],[Sch_Std_Range_Code],[Demo]," +
                              "[ContactPreference],Landmark)" +
                              "VALUES" +
                              "(@Sch_Name,@Sch_Code,@Sch_Contact_Person,@Sch_Type_Id,@Sch_CountryId,@Sch_StateId,@Sch_DistrictId" +
                              ",@Sch_DistrictName,@Sch_CityName,@Sch_PINCode,@Sch_Address1,@Sch_Address2,@Sch_PhNo1,@Sch_Alt_PhNo,@Sch_MobileNo" +
                              ",@Sch_EmailId,@Sch_Sector,@Sch_University,@Univ_Code,@Sch_Std_Range_Code,@Demo," +
                              "@ContactPreference,@Landmark);SELECT CAST(SCOPE_IDENTITY() as int) as RecordId";

            var returnId = db.Query(sqlquery, tblSchoolDetail).SingleOrDefault();

            tblSchoolDetail.RecordId = Convert.ToInt32(returnId.RecordId);
            return(tblSchoolDetail.RecordId);
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            tblSchoolDetail tblSchoolDetail = new tblSchoolDetail
            {
                Sch_Name           = txtInstName.Text,
                Sch_Code           = txtInstCode.Text,
                Sch_Contact_Person = txtContactPerson.Text,
                Sch_Type_Id        = ddlInstType.SelectedValue,
                Sch_CountryId      = ddlCountry.SelectedValue,
                Sch_StateId        = ddlState.SelectedValue,
                Sch_DistrictId     = ddlDistrict.SelectedValue,
                Sch_DistrictName   = ddlDistrict.SelectedItem.Text,
                Sch_CityName       = txtCity.Text,
                Sch_PINCode        = Convert.ToInt32(txtPincode.Text),
                Sch_Address1       = txtAddress1.Text,
                Sch_Address2       = txtAddress2.Text,
                Sch_PhNo1          = txtInstPhNo.Text,
                Sch_Alt_PhNo       = txtAlternatePhNo.Text,
                Sch_MobileNo       = txtPhNo.Text,
                Sch_EmailId        = txtInstEmailId.Text,
                Sch_Sector         = radioSector.SelectedValue,
                Univ_Code          = ddlAffilUniversity.SelectedValue,
                Sch_University     = ddlAffilUniversity.SelectedItem.Text,
                Sch_Std_Range_Code = Convert.ToInt32(ddlStudentRange.SelectedValue),
                Demo = (radioDemoRequired.SelectedValue == "0" ? false : true),
                ContactPreference = ddlHowToReach.SelectedValue,
                Landmark          = txtLandMark.Text
            };
            int success = schoolSetupPagesClass.AddSchoolDetails(tblSchoolDetail);

            if (success > 0)
            {
                string script = "alert(\"School - " + tblSchoolDetail.Sch_Name + " added successfully\");";
                ScriptManager.RegisterStartupScript(this, GetType(),
                                                    "ServerControlScript", script, true);
                ClearAllFields();
            }
        }