예제 #1
0
        private void setOnClose(object sender, DataGridViewCellEventArgs e)
        {
            string builder, status, start, finish;
            int    id;

            dataGridView1.Rows[e.RowIndex].Cells[5].Value = "Closed";
            DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();

            cell.Value = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString() + " " + DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString();
            dataGridView1.Rows[e.RowIndex].Cells[9] = cell;
            cell.ReadOnly = true;
            DataGridViewTextBoxCell newCell = new DataGridViewTextBoxCell();

            newCell.Value = string.Empty;
            dataGridView1.Rows[e.RowIndex].Cells[10] = newCell;
            newCell.ReadOnly = true;
            BikePart.SubstractClosedBike(dataGridView1.Rows[e.RowIndex].Cells[4].ToolTipText.ToString());
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                id                 = Int32.Parse(row.Cells[0].Value.ToString());
                builder            = user.login.ToString();
                status             = row.Cells[5].Value.ToString();
                start              = row.Cells[8].Value.ToString();
                finish             = row.Cells[9].Value.ToString();
                row.Cells[7].Value = builder;
                Assembler.UpdateSatus(id, status, builder, start, finish);
            }
        }
예제 #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.Value.ToString() == "Remove")
            {
                string query = "DELETE FROM Order_Detailed_Part WHERE Id_Order=" + dataGridView1.Rows[e.RowIndex].Cells[0].Value + " AND idOrder_Detailed_Part=" + dataGridView1.Rows[e.RowIndex].Cells[1].Value + " AND Id_Bike_Parts =" + dataGridView1.Rows[e.RowIndex].Cells[2].Value + " AND Quantity=" + dataGridView1.Rows[e.RowIndex].Cells[4].Value + ";";
                Console.WriteLine(query);
                DataBase.SendToDB(query);
                orderLoad();
                MessageBox.Show(@"Deleted :" +
                                "\nname = " + dataGridView1.Rows[e.RowIndex].Cells[3].Value +
                                "\nId_Order= " + dataGridView1.Rows[e.RowIndex].Cells[0].Value +
                                "\nId_Order_Detailed_Part = " + dataGridView1.Rows[e.RowIndex].Cells[1].Value +
                                "\nId_Bike_Parts = " + dataGridView1.Rows[e.RowIndex].Cells[2].Value +
                                "\nQuantity = " + dataGridView1.Rows[e.RowIndex].Cells[4].Value);
            }

            if (dataGridView1.CurrentCell.Value.ToString() == "Received")
            {
                List <string> updatedLine = new List <string>();
                if (dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString() == "Not Received")
                {
                    dataGridView1.Rows[e.RowIndex].Cells[7].Value = "Received";
                    updatedLine.Add(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
                    updatedLine.Add(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());
                    updatedLine.Add(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString());
                    updatedLine.Add(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString());
                    updatedSatusts.Add(updatedLine);
                    BikePart.AddReceivedBikePart(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString()), Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString()));
                    MessageBox.Show(@"Changed State :" +
                                    "\nname = " + dataGridView1.Rows[e.RowIndex].Cells[3].Value +
                                    "\nId_Order= " + dataGridView1.Rows[e.RowIndex].Cells[0].Value +
                                    "\nId_Order_Detailed_Part = " + dataGridView1.Rows[e.RowIndex].Cells[1].Value +
                                    "\nId_Bike_Parts = " + dataGridView1.Rows[e.RowIndex].Cells[2].Value +
                                    "\nQuantity = " + dataGridView1.Rows[e.RowIndex].Cells[4].Value);
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    dataGridView1.Rows[e.RowIndex].Cells[8] = cell;
                    cell.ReadOnly = true;
                    dataGridView1.Refresh();
                }
            }
        }
예제 #3
0
 public ItemPart(BikePart part, int quantity) : base(quantity)
 {
     this.quantity = quantity;
     this.part     = part;
     price         = getPrice();
 }