/// <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) { Guidelbl.Hide(); CmbUser.Hide(); BtnSelect.Hide(); label1.Show(); label2.Show(); label3.Show(); label4.Show(); label5.Show(); label6.Show(); TbxFirstName.Show(); TbxLastName.Show(); TbxUsername.Show(); TbxTelephone.Show(); TbxEmail.Show(); CmbTypes.Show(); BtnEdit.Show(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbUser.SelectedValue)); TbxFirstName.Text = (string)SelectedData.Rows[0]["First_Name"]; TbxLastName.Text = (string)SelectedData.Rows[0]["Last_Name"]; TbxUsername.Text = (string)SelectedData.Rows[0]["Username"]; TbxEmail.Text = (string)SelectedData.Rows[0]["Email"]; TbxTelephone.Text = (string)SelectedData.Rows[0]["Telephone"]; DataTable GetUserType = DCom.GetData(String.Format("SELECT users_types.Type FROM users, users_types WHERE users.Username='******' and users.Type=users_types.Type", CmbUser.SelectedValue)); CmbTypes.DataSource = DCom.GetData("SELECT * FROM users_types"); CmbTypes.DisplayMember = "Type"; CmbTypes.ValueMember = "Type"; CmbTypes.Text = (string)GetUserType.Rows[0]["Type"]; }
/// <summary> /// When the client select the login that wants to edit the not necessarily labels and comboboxes are hiding /// from the form and then the neccesarily labels and tetxboxes are pop up. Then fills all the fields with /// the data of the selected login. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSelect_Click(object sender, EventArgs e) { guidelbl.Show(); label2.Show(); TbxUsername.Show(); TbxPassword.Show(); BtnEdit.Show(); label1.Hide(); CmbUsername.Hide(); BtnSelect.Hide(); SelectedData = DCom.GetData(String.Format(SqlExec, CmbUsername.SelectedValue)); TbxUsername.Text = (string)SelectedData.Rows[0]["Username"]; TbxPassword.Text = (string)SelectedData.Rows[0]["Password"]; }