protected void btnSave_Click(object sender, EventArgs e)
    {
        if (ValidData())
        {
            HospitalObject hospital = new HospitalObject();
            hospital.Name.Value = tbName.Text;
            hospital.Code.Value = tbCode.Text;
            hospital.Address.Value = tbAddress.Text;
            hospital.City.Value = tbCity.Text;
            hospital.ClientId.Value = ddlClients.SelectedValue;
            hospital.Phone.Value = tbPhone.Text;
            hospital.Fax.Value = tbFax.Text;
            hospital.State.Value = ddlStates.SelectedValue;
            hospital.Zip.Value = tbZip.Text;
            hospital.Save(loggedInUserId);

            UserHospitalObject userHospital = new UserHospitalObject();
            userHospital.HospitalId.Value = hospital.HospitalId.Value;
            userHospital.UserId.Value = loggedInUserId;
            userHospital.Save(loggedInUserId);
        }
    }
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ValidData())
     {
         if (Request["hospitalId"] != null)
         {
             HospitalObject hospital = new HospitalObject();
             hospital.HospitalId.Value = Request["hospitalId"];
             if (hospital.IsLoaded)
             {
                 hospital.Name.Value = tbName.Text;
                 hospital.Code.Value = tbCode.Text;
                 hospital.Address.Value = tbAddress.Text;
                 hospital.City.Value = tbCity.Text;
                 hospital.ClientId.Value = ddlClients.SelectedValue;
                 hospital.Fax.Value = tbFax.Text;
                 hospital.Phone.Value = tbPhone.Text;
                 hospital.State.Value = ddlStates.SelectedValue;
                 hospital.Zip.Value = tbZip.Text;
                 hospital.Save(loggedInUserId);
             }
         }
     }
 }