private void button2_Click(object sender, EventArgs e) { المستشفيات hosp = new المستشفيات(); try { hosp.رمز_المستشفى = int.Parse(ID.Text); hosp.اسم_المستشفى = Hos_Name.Text; hosp.رمز_المنطقة = int.Parse(Region.SelectedValue.ToString()); hosp.الطابق_السفلي = (short)numericUpDown1.Value; hosp.الطابق_العلوي = (short)numericUpDown2.Value; hosp.العنوان = Info.Text; hosp.الهاتف = phone.Text; hosp.الحالة = "متاح"; } catch { } if (BAL.Hospitals.AddHospital(hosp, s.Section)) { } else { } dataGridView1.DataSource = BAL.Hospitals.Get_Hospitals(); }
private void ID_TextChanged(object sender, EventArgs e) { try { int HosID = int.Parse(ID.Text); المستشفيات hosp = BAL.Hospitals.GetHospital(HosID); ID.Text = hosp.رمز_المستشفى.ToString(); Hos_Name.Text = hosp.اسم_المستشفى; City.SelectedValue = BAL.Hospitals.GetCityId(hosp.رمز_المنطقة); Region.SelectedValue = hosp.رمز_المنطقة; numericUpDown1.Value = (decimal)hosp.الطابق_السفلي; numericUpDown2.Value = (decimal)hosp.الطابق_العلوي; Info.Text = hosp.العنوان; phone.Text = hosp.الهاتف; } catch { Hos_Name.Text = ""; City.SelectedValue = ""; Region.SelectedValue = ""; numericUpDown1.Value = 0; numericUpDown2.Value = 0; Info.Text = ""; phone.Text = ""; } if (Hos_Name.Text == "") { button1.Enabled = false; } else { button1.Enabled = true; } }