Ejemplo n.º 1
0
        private void EditJob()
        {
            if (jobInfoDataGrid.SelectedRows.Count > 0)
            {
                // This checks for null value in colour cell.
                string colourValue;
                int    selectedRowIndex = jobInfoDataGrid.SelectedCells[0].RowIndex;
                if (jobInfoDataGrid.Rows[selectedRowIndex].Cells[8].Value == null)
                {
                    colourValue = null;
                }
                else
                {
                    colourValue = jobInfoDataGrid.Rows[selectedRowIndex].Cells[9].Value.ToString();
                }


                PrepAndPaintModel editJob = new PrepAndPaintModel()
                {
                    Id          = (int)jobInfoDataGrid.Rows[selectedRowIndex].Cells[0].Value,
                    ItemNumber  = jobInfoDataGrid.Rows[selectedRowIndex].Cells[1].Value.ToString(),
                    JobNumber   = jobInfoDataGrid.Rows[selectedRowIndex].Cells[2].Value.ToString(),
                    BodyOrDoors = jobInfoDataGrid.Rows[selectedRowIndex].Cells[3].Value.ToString(),
                    StartDate   = jobInfoDataGrid.Rows[selectedRowIndex].Cells[4].Value.ToString(),
                    Prepper     = jobInfoDataGrid.Rows[selectedRowIndex].Cells[5].Value.ToString(),
                    PaintDate   = jobInfoDataGrid.Rows[selectedRowIndex].Cells[6].Value.ToString(),
                    Painter     = jobInfoDataGrid.Rows[selectedRowIndex].Cells[7].Value.ToString(),
                    Booth       = jobInfoDataGrid.Rows[selectedRowIndex].Cells[8].Value.ToString(),
                    Colour      = colourValue,
                    NewProcess  = (bool)jobInfoDataGrid.Rows[selectedRowIndex].Cells[10].Value,
                    WashBay     = (bool)jobInfoDataGrid.Rows[selectedRowIndex].Cells[11].Value,
                    Comments    = jobInfoDataGrid.Rows[selectedRowIndex].Cells[12].Value.ToString(),
                };
                AddJob addJob = new AddJob();
                addJob.editJob = editJob;
                addJob.edit    = true;
                DialogResult results = addJob.ShowDialog();
                if (results == DialogResult.OK)
                {
                    GetInfo();
                    foreach (DataGridViewRow row in jobInfoDataGrid.Rows)
                    {
                        if (row.Cells[0].Value.Equals(editJob.Id))
                        {
                            row.Cells[1].Selected = true;
                            jobInfoDataGrid.FirstDisplayedScrollingRowIndex = row.Index;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("No Record selected to edit!", "No Records selected");
            }
        }
Ejemplo n.º 2
0
        private void AddItem()
        {
            AddJob addItem = new AddJob();

            addItem.edit      = false;
            addItem.jobNumber = this.job.JobNumber;
            DialogResult result = addItem.ShowDialog();

            if (result == DialogResult.OK)
            {
                GetInfo();
            }
        }
Ejemplo n.º 3
0
        private void AddNewJob()
        {
            AddJob       addJob = new AddJob();
            DialogResult result = addJob.ShowDialog();

            if (result == DialogResult.OK)
            {
                GetInfo();
                txtSearch.Clear();
                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    if (row.Cells[0].Value.Equals(addJob.jobId))
                    {
                        row.Cells[1].Selected = true;
                        dataGridView.FirstDisplayedScrollingRowIndex = row.Index;
                    }
                }
            }
        }