/// <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> /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding /// from the form. Then the combobox for ratings(CmbSelect) is filling with the data of the table. /// </summary> public EditRatingsForm() { InitializeComponent(); LblRatingValue.Hide(); LblComment.Hide(); LblUsername.Hide(); TbxComment.Hide(); TbxRatingValue.Hide(); CmbUsername.Hide(); BtnEdit.Hide(); CmbSelect.DataSource = DCom.GetData("SELECT *, CONCAT(Username, ', ', Rating_Value) AS NAME FROM ratings"); CmbSelect.DisplayMember = "NAME"; CmbSelect.ValueMember = "ID"; }