Exemple #1
0
        private void EditClientForm_Load(object sender, EventArgs e)
        {
            comboBox_nameClient.DataSource    = sql.getClients();
            comboBox_nameClient.DisplayMember = "nameClient";
            comboBox_nameClient.ValueMember   = "nameClient";

            if (client != null)
            {
                comboBox_nameClient.Text = client.NameClient;
            }
            else
            {
                comboBox_nameClient.SelectedIndex = 0;
            }

            textsforTextboxes((Client)comboBox_nameClient.SelectedItem);
        }
        public void LoadClients()
        {
            //Load Clients
            List <Client> clients = sql.getClients();

            comboBox_nameClient.DataSource    = clients;
            comboBox_nameClient.DisplayMember = "nameClient";
            comboBox_nameClient.ValueMember   = "nameClient";
            if (client != null)
            {
                comboBox_nameClient.Text = client.NameClient;
                textBox_Contact.Text     = client.Contact;
                textBox_Phone.Text       = client.Phone;
                textBox_Address.Text     = client.Address;
                textBox_Email.Text       = client.Email;
            }
            clients = null;
        }
Exemple #3
0
        public void LoadClientsToForm(AddRepairForm formAddRepair = null, EditRepairForm formEditRepair = null, AddClientForm formAddClient = null)
        {
            // form = formAddRepair;

            /*   if (formAddRepair != null)
             * {
             *     form = new AddRepairForm();
             *     form = formAddRepair;
             * }*/


            /*  else if(formEditRepair != null) form = formEditRepair;
             * else if (formAddClient != null) form = formAddClient;*/

            /*  form = new AddRepairForm();
             *
             * (AddRepairForm)form.comboBox_nameClient.DataSource = sql.getClients();*/

            Convert.ChangeType(form, typeof(AddRepairForm));

            //       form.comboBox_nameClient.DataSource = sql.getClients();


            formAddRepair.comboBox_nameClient.DataSource = sql.getClients();

            formAddRepair.comboBox_nameClient.DisplayMember = "nameClient";
            formAddRepair.comboBox_nameClient.ValueMember   = "nameClient";
            if (client != null)
            {
                formAddRepair.comboBox_nameClient.Text = client.NameClient;
                formAddRepair.textBox_Contact.Text     = client.Contact;
                formAddRepair.textBox_Phone.Text       = client.Phone;
                formAddRepair.textBox_Address.Text     = client.Address;
                formAddRepair.textBox_Email.Text       = client.Email;
            }
        }