Ejemplo n.º 1
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.º 2
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.º 3
0
 public EmployeePerformance(Home ret)
 {
     returnScreen = ret;
     InitializeComponent();
     conn = new Group14Connection();
     uxTimeLine.SelectedIndex = 0;
 }
Ejemplo n.º 4
0
 public MakePurchase(Form ret, int cID)
 {
     returnScreen = ret;
     carID        = cID;
     conn         = new Group14Connection();
     InitializeComponent();
 }
Ejemplo n.º 5
0
        private void displayData(int dealershipId, DateTimeOffset start, DateTimeOffset end)
        {
            dataGridView1.Rows.Clear();
            Group14Connection g14  = new Group14Connection();
            DataSet           data = new DataSet();

            if (comboBox1.SelectedIndex == 0)
            {
                data = g14.DealershipPerformance2(dealershipId, start, end);
                if (data != null)
                {
                    foreach (DataRow r in data.Tables[0].Rows)
                    {
                        string[] arr = new string[5];
                        arr[0] = r.ItemArray[0].ToString();
                        arr[1] = r.ItemArray[1].ToString();
                        arr[2] = string.Format("{0:c}", Convert.ToInt32(r.ItemArray[2].ToString()));
                        arr[3] = r.ItemArray[3].ToString();
                        arr[4] = string.Format("{0:c}", Convert.ToInt32(r.ItemArray[4].ToString()));
                        dataGridView1.Rows.Add(arr);
                    }
                }
                else
                {
                    MessageBox.Show("There was an error proccessing your request.");
                    return;
                }
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                data = g14.DealershipPerformance(dealershipId, start, end);
                if (data != null)
                {
                    foreach (DataRow r in data.Tables[0].Rows)
                    {
                        string[] arr = new string[5];
                        arr[0] = r.ItemArray[0].ToString();
                        arr[1] = "NA";
                        arr[2] = string.Format("{0:c}", Convert.ToInt32(r.ItemArray[1].ToString()));
                        arr[3] = r.ItemArray[2].ToString();
                        arr[4] = string.Format("{0:c}", Convert.ToInt32(r.ItemArray[3].ToString()));
                        dataGridView1.Rows.Add(arr);
                    }
                }
                else
                {
                    MessageBox.Show("There was an error proccessing your request.");
                    return;
                }
            }
            else
            {
                MessageBox.Show("There was an error proccessing your request.");
                return;
            }
        }
Ejemplo n.º 6
0
        public FeatureSearchForm(Home ret)
        {
            carLocationId      = -1;
            employeeLocationId = -1;
            InitializeComponent();
            updatePurchaseAvailability();
            homePage = ret;

            conn = new Group14Connection();
            List <Tuple <string, int> > features = GetFeatures();

            AddFeatures(features);
            GetCarsWithFeatures(null, null);
        }
Ejemplo n.º 7
0
        private void runQuery(int numCustomers, int dealershipId)
        {
            Group14Connection conn = new Group14Connection();
            DataSet           data = conn.GetTopCustomers(dealershipId, numCustomers);

            if (data != null)
            {
                DataTable table = data.Tables[0];
                displayResults(table);
            }
            else
            {
                MessageBox.Show("There was an error proccessing your request");
            }
        }
Ejemplo n.º 8
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();
            }
        }
Ejemplo n.º 9
0
        private void displayData(int top, int deal)
        {
            dataGridView1.Rows.Clear();
            Group14Connection g14 = new Group14Connection();
            var data = g14.GetTopEmployees(top, deal);

            if (data == null)
            {
                MessageBox.Show("There was an error proccessing your request.");
                return;
            }
            var table = data.Tables[0];

            for (int i = 0; i < table.Rows.Count; i++)
            {
                object[]      currentRow = table.Rows[i].ItemArray;
                List <string> listToUse  = new List <string>();
                foreach (object o in currentRow)
                {
                    listToUse.Add(o.ToString());
                }
                dataGridView1.Rows.Add(listToUse.ToArray());
            }
        }
Ejemplo n.º 10
0
        private void displayResults(string make, string model, string year, string color, string milage, string oc, string ap)
        {
            int            num;
            Nullable <int> milage2 = null;
            Nullable <int> oc2     = null;
            Nullable <int> ap2     = null;
            Nullable <int> year2   = null;

            if (Int32.TryParse(milage, out num))
            {
                milage2 = Convert.ToInt32(milage);
            }
            if (Int32.TryParse(oc, out num))
            {
                oc2 = Convert.ToInt32(oc);
            }
            if (Int32.TryParse(ap, out num))
            {
                ap2 = Convert.ToInt32(ap);
            }
            if (Int32.TryParse(year, out num))
            {
                year2 = Convert.ToInt32(year);
            }
            Group14Connection g14 = new Group14Connection();
            var data = g14.CarSearch(make, model, color, milage2, oc2, ap2, year2);

            if (data == null)
            {
                MessageBox.Show("There was an error proccessing your request.");
                return;
            }
            var table = data.Tables[0];

            if (table.Rows.Count > 0)
            {
                if (dataGridView1.Columns.Count > 0)
                {
                    dataGridView1.Rows.Clear();
                    dataGridView1.Columns.Clear();
                }
                for (int j = 0; j < table.Rows[0].ItemArray.Length; j++)
                {
                    dataGridView1.Columns.Add(table.Columns[j].ColumnName, table.Columns[j].ColumnName);
                    if (j != 2 && j != 3 && j != 4)
                    {
                        dataGridView1.Columns[j].Visible = false;
                    }
                }


                for (int i = 0; i < table.Rows.Count; i++)
                {
                    List <string> rowData = new List <string>();
                    var           row     = table.Rows[i];
                    for (int j = 0; j < table.Rows[0].ItemArray.Length; j++)
                    {
                        rowData.Add(row[j].ToString());
                    }
                    string[] arr  = rowData.ToArray();
                    string   hold = arr[0];
                    dataGridView1.Rows.Add(arr);
                }
            }
            else
            {
                MessageBox.Show("There was an error proccessing your request.");
            }
        }
Ejemplo n.º 11
0
 public ListEmployeesForm(Home ret)
 {
     conn     = new Group14Connection();
     homePage = ret;
     InitializeComponent();
 }
Ejemplo n.º 12
0
 public GetCustomerInformation(Home ret)
 {
     homePage = ret;
     InitializeComponent();
     conn = new Group14Connection();
 }