/// <summary> /// When the client select the user that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with /// the data of the selected user. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { label2.Show(); label3.Show(); label4.Show(); label5.Show(); label6.Show(); label7.Show(); TbxAddressNumber.Show(); TbxAdressName.Show(); TbxLat.Show(); TbxLong.Show(); TbxPostalCode.Show(); CmbMunicipality.Show(); BtnEdit.Show(); label1.Hide(); CmbLocation.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbLocation.SelectedValue)); TbxAdressName.Text = SelectedData.Rows[0]["Address_Name"].ToString(); TbxAddressNumber.Text = SelectedData.Rows[0]["Address_Number"].ToString(); TbxLat.Text = SelectedData.Rows[0]["Lat"].ToString(); TbxLong.Text = SelectedData.Rows[0]["Long"].ToString(); TbxPostalCode.Text = SelectedData.Rows[0]["Postal_Code"].ToString(); CmbMunicipality.DataSource = DCom.GetData("SELECT * FROM municipality"); CmbMunicipality.DisplayMember = "Municipality_Name"; CmbMunicipality.ValueMember = "Municipality_Name"; CmbMunicipality.Text = SelectedData.Rows[0]["Municipality"].ToString(); }
public EdiBusinessForm() { InitializeComponent(); LblBusinessDescription.Hide(); LblBusinessName.Hide(); LblCategory.Hide(); LblPrice.Hide(); LblRating.Hide(); LblTelephone.Hide(); LblUser.Hide(); LblWebsite.Hide(); LblWorkHours.Hide(); LblBusinessType.Hide(); LblLocation.Hide(); TbxBusinessName.Hide(); TbxCategory.Hide(); TbxDescription.Hide(); TbxPrice.Hide(); TbxRating.Hide(); TbxTelephone.Hide(); TbxWebsite.Hide(); CmbLocation.Hide(); CmbTypes.Hide(); CmbUser.Hide(); CmbWorkHours.Hide(); ChbReservation.Hide(); BtnEdit.Hide(); CmbBusinesses.DataSource = DCom.GetData("SELECT businesses.ID, CONCAT(businesses.Business_Name, ', ', location.Address_Name, ', ', location.Municipality) AS NAME FROM businesses, location WHERE businesses.Location_ID = location.ID"); CmbBusinesses.DisplayMember = "NAME"; CmbBusinesses.ValueMember = "ID"; }