示例#1
0
 protected void btnAddHospital_Click(object sender, EventArgs e)
 {
     foreach (ListItem listItem in lbNotHospitals.Items)
     {
         if (listItem.Selected)
         {
             UserHospitalObject userHospital = new UserHospitalObject();
             userHospital.UserId.Value = Request["userId"];
             userHospital.HospitalId.Value = listItem.Value;
             userHospital.Save();
         }
     }
     lbHospitals.DataBind();
     lbNotHospitals.DataBind();
 }
示例#2
0
 protected void btnRemoveHospital_Click(object sender, EventArgs e)
 {
     foreach (ListItem listItem in lbHospitals.Items)
     {
         if (listItem.Selected)
         {
             UserHospitalObject userHospital = new UserHospitalObject();
             userHospital.UserId.Value = Request["userId"];
             userHospital.HospitalId.Value = listItem.Value;
             userHospital.Load(loggedInUserId);
             if (userHospital.IsLoaded)
             {
                 userHospital.Remove(loggedInUserId);
             }
         }
     }
     lbHospitals.DataBind();
     lbNotHospitals.DataBind();
 }
    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);
        }
    }