Example #1
0
        void updateBoxes()
        {
            DbClients dbc      = new DbClients();
            int       ClientId = int.Parse(comboBox2.Text);

            textBox6.Text = (string)dbc.GetClientInfo(ClientId).Tables[0].Rows[0]["FirstName"];
            //textBox6.Text = dbc.GetClientInfo(2).Tables[0].Columns[0].Table.ToString();
            //textBox7.Text=dbc.GetClientInfo(2).Tables[0].Columns[0].Table.ToString();

            DbCars dbca = new DbCars();

            if (comboBox4.Text != "")
            {
                int carId = int.Parse(comboBox4.Text);
                textBox4.Text = (string)dbca.getCarInfo(carId).Tables[0].Rows[0]["Kind"];
            }


            DbWorker dbw = new DbWorker();

            if (comboBox3.Text != "")
            {
                int wId = int.Parse(comboBox3.Text);
                textBox7.Text = (string)dbw.getWorkerInfo(wId).Tables[0].Rows[0]["FirstName"];
            }
        }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Client w = new WindowsFormsApplication1.Client();
            DbClients db = new DbClients();
            DataSet   ds = new DataSet();

            try
            {
                w.Id = int.Parse(textBox1.Text);
                if (db.ClientExist(w.Id) == true)
                {
                    ds            = db.GetClientInfo(w);
                    textBox1.Text = ds.Tables[0].Rows[0]["ClientId"].ToString();
                    textBox3.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
                    textBox2.Text = ds.Tables[0].Rows[0]["LastName"].ToString();
                    textBox4.Text = ds.Tables[0].Rows[0]["Address"].ToString();
                    textBox5.Text = ds.Tables[0].Rows[0]["Phone"].ToString();
                }
                else
                {
                    textBox1.Text = "Client not found ";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }