private void BtnSelect_Click(object sender, EventArgs e) { LblBusinessDescription.Show(); LblBusinessName.Show(); LblCategory.Show(); LblPrice.Show(); LblRating.Show(); LblTelephone.Show(); LblUser.Show(); LblWebsite.Show(); LblWorkHours.Show(); LblBusinessType.Show(); LblLocation.Show(); TbxBusinessName.Show(); TbxCategory.Show(); TbxDescription.Show(); TbxPrice.Show(); TbxRating.Show(); TbxTelephone.Show(); TbxWebsite.Show(); CmbLocation.Show(); CmbTypes.Show(); CmbUser.Show(); CmbWorkHours.Show(); ChbReservation.Show(); BtnEdit.Show(); LblSelect.Hide(); CmbBusinesses.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbBusinesses.SelectedValue)); TbxBusinessName.Text = (string)SelectedData.Rows[0]["Business_Name"]; TbxCategory.Text = (string)SelectedData.Rows[0]["Category"]; TbxDescription.Text = (string)SelectedData.Rows[0]["Description"]; TbxPrice.Text = SelectedData.Rows[0]["Price_Range"].ToString(); TbxRating.Text = (string)SelectedData.Rows[0]["Rating"].ToString(); TbxTelephone.Text = (string)SelectedData.Rows[0]["Telephone"]; TbxWebsite.Text = (string)SelectedData.Rows[0]["Website"]; CmbLocation.DataSource = DCom.GetData("SELECT ID,CONCAT(Address_Name, ', ', Address_Number) AS NAME FROM location"); CmbLocation.DisplayMember = "NAME"; CmbLocation.ValueMember = "ID"; CmbTypes.DataSource = DCom.GetData("SELECT * FROM businesses_types"); CmbTypes.DisplayMember = "Type"; CmbTypes.ValueMember = "Type"; CmbUser.DataSource = DCom.GetData("SELECT * FROM users"); CmbUser.DisplayMember = "Username"; CmbUser.ValueMember = "Username"; CmbWorkHours.DataSource = DCom.GetData("SELECT * FROM work_hours"); CmbWorkHours.DisplayMember = "ID"; CmbWorkHours.ValueMember = "ID"; }
/// <summary> /// Finally when the client made the changes that he wants the program checks if all the fields /// all fields are fill. If all fields are fill then the program exec the apropriate querry for the /// update of the rating, else show a error message. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { LblRatingValue.Show(); LblComment.Show(); LblUsername.Show(); TbxComment.Show(); TbxRatingValue.Show(); CmbUsername.Show(); BtnEdit.Show(); LblSelect.Hide(); CmbSelect.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbSelect.SelectedValue)); TbxRatingValue.Text = SelectedData.Rows[0]["Rating_Value"].ToString(); TbxComment.Text = SelectedData.Rows[0]["Comment"].ToString(); CmbUsername.DataSource = DCom.GetData("SELECT * FROM users"); CmbUsername.DisplayMember = "Username"; CmbUsername.ValueMember = "Username"; }
/// <summary> /// When the client select the rating 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 rating. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { LblBusiness.Show(); LblDate.Show(); LblPerson.Show(); LblUsername.Show(); CmbBusiness.Show(); CmbUsername.Show(); BtnEdit.Show(); TbxPerson.Show(); DtpDate.Show(); LblSelect.Hide(); CmbSelect.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbSelect.SelectedValue)); TbxPerson.Text = SelectedData.Rows[0]["Persons"].ToString(); CmbBusiness.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"); CmbBusiness.DisplayMember = "NAME"; CmbBusiness.ValueMember = "ID"; CmbUsername.DataSource = DCom.GetData("SELECT * FROM users"); CmbUsername.DisplayMember = "Username"; CmbUsername.ValueMember = "Username"; CmbUsername.Text = SelectedData.Rows[0]["User"].ToString(); CmbBusiness.Text = SelectedData.Rows[0]["BusinessID"].ToString(); }