Esempio n. 1
0
        /// <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"];
        }
Esempio n. 2
0
 // clear the text fields
 private void ClearTextFields()
 {
     TbxFirstName.Clear();
     TbxLastName.Clear();
     TbxStreetAddress.Clear();
     TbxCity.Clear();
     CbxState.SelectedIndex = 0;
     MtbZipCode.Clear();
     MtbPhone.Clear();
 }
Esempio n. 3
0
        /// <summary>
        /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form. Then the combobox for users(CmbUser) is filling with the usernames and NAMES
        /// from table users.
        /// </summary>
        public EditUser()
        {
            InitializeComponent();
            label1.Hide();
            label2.Hide();
            label3.Hide();
            label4.Hide();
            label5.Hide();
            label6.Hide();
            TbxFirstName.Hide();
            TbxLastName.Hide();
            TbxUsername.Hide();
            TbxTelephone.Hide();
            TbxEmail.Hide();
            CmbTypes.Hide();
            BtnEdit.Hide();

            CmbUser.DataSource    = DCom.GetData("SELECT Username,CONCAT(Last_name,' ' , First_Name) AS NAME FROM users");
            CmbUser.DisplayMember = "NAME";
            CmbUser.ValueMember   = "Username";
        }