Exemplo n.º 1
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     Console.WriteLine(dataGridView1.CurrentCell.Value);
     if (dataGridView1.CurrentCell.Value.ToString() == "Add")
     {
         foreach (var elem in newApp.bikePartList)
         {
             if (elem.part_Id == Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()))
             {
                 ItemPart toAdd = new ItemPart(elem, 1);
                 user.cartPart.Add(toAdd);
                 Console.WriteLine("-------------------------------------");
                 Console.WriteLine("Part Id : " + elem.part_Id);
             }
         }
         cartLoad();
     }
 }
Exemplo n.º 2
0
        private void button9_Click(object sender, EventArgs e)
        {
            user.cartPart.Clear();
            dataGridView2.Rows.Clear();
            Dictionary <int, int> resultWeek    = newApp.GetWeekPieces(this.plannedWeek);
            Dictionary <int, int> resultCompute = newApp.ComputeMissingPieces(ref resultWeek);
            int i = 0;

            foreach (var elem in resultCompute)
            {
                var part = newApp.bikePartList.FirstOrDefault(x => x.part_Id == elem.Key);
                if (part != null)
                {
                    dataGridView1.Rows[i].Cells[5].Value = elem.Value;
                    ItemPart toAdd = new ItemPart(part, elem.Value);
                    user.cartPart.Add(toAdd);
                }
            }
            i++;

            cartLoad();
        }