Ejemplo n.º 1
0
        private void uxEmployeeEmailTxtBox_TextChanged(object sender, EventArgs e)
        {
            string            employeeEmail = uxEmployeeEmailTxtBox.Text;
            int               dealershipId;
            Group14Connection g14          = new Group14Connection();
            var               employeeData = g14.GetEmployeeFromEmail(employeeEmail);

            if (employeeData == null)
            {
                dealershipId = -1;
            }
            else
            {
                bool success = Int32.TryParse(employeeData.Tables[0].Rows[0].ItemArray[2].ToString(), out dealershipId);
                if (!success)
                {
                    dealershipId = -1;
                }
            }

            employeeLocationId = dealershipId;

            string dealershipName = "";
            var    dealershipData = g14.GetDealershipInformation(dealershipId);

            if (dealershipData != null)
            {
                dealershipName = dealershipData.Tables[0].Rows[0].ItemArray[1].ToString();
            }
            uxEmployeeLocationLbl.Text = "Employee Location: " + dealershipName;

            updatePurchaseAvailability();
        }
Ejemplo n.º 2
0
        private void uxDataGrid_SelectionChanged(object sender, EventArgs e)
        {
            DataGridViewRow row = uxDataGrid.SelectedRows.Count == 0 ? null : uxDataGrid.SelectedRows[0];

            if (row != null && row.Cells != null && row.Cells[0].Value != null)
            {
                uxMake.Text       = row.Cells[1].Value.ToString();
                uxModel.Text      = row.Cells[2].Value.ToString();
                uxYear.Text       = row.Cells[3].Value.ToString();
                uxAskPrice.Text   = row.Cells[4].Value.ToString();
                uxColor.Text      = row.Cells[5].Value.ToString();
                uxMilage.Text     = row.Cells[6].Value.ToString();
                uxOwnerCount.Text = row.Cells[8].Value.ToString();

                Group14Connection g14 = new Group14Connection();
                int  dealershipId;
                bool success = Int32.TryParse(row.Cells[7].Value.ToString(), out dealershipId);
                if (!success)
                {
                    dealershipId = -1;
                }
                carLocationId = dealershipId;
                string dealershipName = "";
                var    dealershipData = g14.GetDealershipInformation(dealershipId);
                if (dealershipData != null)
                {
                    dealershipName = dealershipData.Tables[0].Rows[0].ItemArray[1].ToString();
                }
                label15.Text = "Location: " + dealershipName;
            }


            updatePurchaseAvailability();
        }
Ejemplo n.º 3
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                label7.Text  = "Make: " + dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
                label8.Text  = "Model: " + dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
                label9.Text  = "Color: " + dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
                label10.Text = "Year: " + dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
                label11.Text = "Milage: " + dataGridView1.SelectedRows[0].Cells[6].Value.ToString();
                label12.Text = "Owner Count: " + dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
                label13.Text = "Ask Price: " + dataGridView1.SelectedRows[0].Cells[8].Value.ToString();

                Group14Connection g14 = new Group14Connection();

                int    carId    = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
                var    carData  = g14.GetCarFeatures(carId);
                string features = "";
                if (carData != null && carData.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < carData.Tables[0].Rows.Count; i++)
                    {
                        features += carData.Tables[0].Rows[i].ItemArray[0] + "\n";
                    }
                }
                else
                {
                    features = "NA";
                }
                label14.Text = "Features: " + features;

                int  dealershipId;
                bool success = Int32.TryParse(dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), out dealershipId);
                if (!success)
                {
                    dealershipId = -1;
                }
                carLocationId = dealershipId;
                var    dealershipData = g14.GetDealershipInformation(dealershipId);
                string dealershipName = dealershipData.Tables[0].Rows[0].ItemArray[1].ToString();
                label15.Text = "Location: " + dealershipName;

                updatePurchaseAvailability();
            }
        }