Ejemplo n.º 1
0
        private void loadPlanifiedBikes()
        {
            int i = 0;
            int j = 0;
            int t = 0;

            dataGridView1.Rows.Clear();
            TimeSpan totalTime      = new TimeSpan();
            string   clientName1    = "";
            string   previousOrder1 = "";

            foreach (var planifiedOrderDetails in Manager.GetPlanifiedBikes())
            {
                //Console.WriteLine("détails in manager plan : " + orderDetails.Count);
                Console.WriteLine(planifiedOrderDetails[0] + "|" + planifiedOrderDetails[1] + "|" + planifiedOrderDetails[2] + "|" + planifiedOrderDetails[3] + "|" + planifiedOrderDetails[4] + "|" + planifiedOrderDetails[5] + "|" + planifiedOrderDetails[6] + "|" + planifiedOrderDetails[7] + "|" + planifiedOrderDetails[8]);
                BikeModel model   = newApp.bikeModels.FirstOrDefault(x => x.color == planifiedOrderDetails[3] && x.size == Int32.Parse(planifiedOrderDetails[2]) && x.type == planifiedOrderDetails[1]);//gets the specific model
                Bike      newBike = new Bike(Int32.Parse(planifiedOrderDetails[0]), model);
                t += newBike.totalTime;
                if (updateButton == true && newWeekToAssign.Text != string.Empty)
                {
                    if (planifiedOrderDetails[7] == newWeekToAssign.Text.ToString() && planifiedOrderDetails[5] != "Closed")
                    {
                        dataGridView1.Rows.Add();
                        dataGridView1.Rows[j].Cells[0].Value = Manager.GetClientName(Int32.Parse(planifiedOrderDetails[6]));
                        dataGridView1.Rows[j].Cells[1].Value = planifiedOrderDetails[6]; //Id Order
                        dataGridView1.Rows[j].Cells[2].Value = planifiedOrderDetails[0]; //id bike
                        dataGridView1.Rows[j].Cells[3].Value = planifiedOrderDetails[1]; //type
                        dataGridView1.Rows[j].Cells[4].Value = planifiedOrderDetails[2]; //size
                        dataGridView1.Rows[j].Cells[5].Value = planifiedOrderDetails[3]; //color
                        dataGridView1.Rows[j].Cells[6].Value = newBike.totalTime.ToString();
                        dataGridView1.Rows[j].Cells[7].Value = planifiedOrderDetails[5]; //status
                        dataGridView1.Rows[j].Cells[8].Value = planifiedOrderDetails[7]; //plannified week
                        j++;
                    }
                }
                else if (planifiedOrderDetails[7] == comboBox1.Text.ToString())
                {
                    if (planifiedOrderDetails[5] != "Closed")
                    {
                        dataGridView1.Rows.Add();
                        dataGridView1.Rows[i].Cells[1].Value = planifiedOrderDetails[6]; //Id Order
                        dataGridView1.Rows[i].Cells[2].Value = planifiedOrderDetails[0]; //id bike
                        dataGridView1.Rows[i].Cells[3].Value = planifiedOrderDetails[1]; //type
                        dataGridView1.Rows[i].Cells[4].Value = planifiedOrderDetails[2]; //size
                        dataGridView1.Rows[i].Cells[5].Value = planifiedOrderDetails[3]; //color
                        dataGridView1.Rows[i].Cells[6].Value = newBike.totalTime.ToString();
                        dataGridView1.Rows[i].Cells[7].Value = planifiedOrderDetails[5]; //status
                        dataGridView1.Rows[i].Cells[8].Value = planifiedOrderDetails[7]; //plannified week
                        if (planifiedOrderDetails[7] == comboBox1.Text.ToString() && planifiedOrderDetails[6] != previousOrder1)
                        {
                            clientName1    = Manager.GetClientName(Int32.Parse(planifiedOrderDetails[6]));
                            previousOrder1 = planifiedOrderDetails[6];
                        }

                        dataGridView1.Rows[i].Cells[0].Value = clientName1;//client
                        TimeSpan toAdd = new TimeSpan(0, newBike.totalTime, 0);
                        totalTime += toAdd;
                        i++;
                    }
                }
            }
            computeTime(totalTime);
        }
Ejemplo n.º 2
0
 private void loadWeeksOfWork(object sender, EventArgs e)
 {
     comboBox1.DataSource = Manager.GetPlanifiedWeekName().Select(x => x[0]).ToList();
 }