Пример #1
0
        //*********************************************************************
        // Function that imports data from another RIDS file
        //*********************************************************************
        public void ImportData(string sourcefile)
        {
            try
            {
                StreamReader file  = new StreamReader(sourcefile);
                var          hline = file.ReadLine();
                if (hline != null)
                {
                    _manifestHeaders = hline.Split(',');
                }

                while (!file.EndOfStream)
                {
                    var line = file.ReadLine();
                    if (line != null)
                    {
                        string[]  row = line.Split(',');
                        CShipment cs  = new CShipment(row[0], row[4], row[16],
                                                      row[18], row[5], row[17]);
                        _tempcsList.Add(cs);
                        CargoPiece cp = new CargoPiece(row[5], row[6], row[1],
                                                       row[7], row[9], row[4],
                                                       RevertBool(row[11]), RevertBool(row[12]),
                                                       RevertBool(row[13]), RevertBool(row[14]),
                                                       row[19], Convert.ToDateTime(row[3]));
                        TempcpList.Add(cp);
                        if (row[6] == "Rolling Stock")
                        {
                            RollingStock rs = new RollingStock(row[5], row[6],
                                                               row[1], row[7], row[8],
                                                               RevertBool(row[10]), row[9], row[4],
                                                               RevertBool(row[11]), RevertBool(row[12]),
                                                               RevertBool(row[13]), RevertBool(row[14]),
                                                               row[19], Convert.ToDateTime(row[3]));
                            _tempRsList.Add(rs);
                        }
                        else
                        {
                            Container c = new Container(row[5], row[6], row[7],
                                                        row[1], row[9], row[4], row[8],
                                                        RevertBool(row[15]), RevertBool(row[11]),
                                                        RevertBool(row[12]), RevertBool(row[13]),
                                                        RevertBool(row[14]),
                                                        row[19], Convert.ToDateTime(row[3]));
                            _tempcList.Add(c);
                        }
                    }
                }
                file.Close();
                WriteCargoShipment();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Valid = _fieldValidation(cmbxCargoType.Text, txtBoxStcn.Text, cmbBoxUnitOwner.Text, cmbBoxDepo.Text, txtBoxDest.Text);
            if (Valid)
            {
                if (cmbxCargoType.Text == @"Rolling Stock")
                {
                    _dt.Rows.Add(txtBoxStcn.Text, cmbxCargoType.Text, txtSerialNum.Text, txtDesc.Text, cmbBoxUnitOwner.Text,
                                 cmbBoxDepo.Text, txtBoxDest.Text, ckbxDrivable.Checked, ckbHazmat.Checked, ckbSensitive.Checked,
                                 ckbHighVis.Checked, ckcBoxDamaged.Checked, false, richTextComment.Text, dateTimePicker1.Text);

                    var rs = new RollingStock(txtBoxStcn.Text, cmbxCargoType.Text, cmbBoxUnitOwner.Text,
                                              txtSerialNum.Text, txtDesc.Text, ckbxDrivable.Checked, txtBoxDest.Text, cmbBoxDepo.Text,
                                              ckbSensitive.Checked, ckcBoxDamaged.Checked, ckbHazmat.Checked,
                                              ckbHighVis.Checked, richTextComment.Text, dateTimePicker1.Value);

                    _rdsDriver.AddCargoPiece(rs.Tcn, rs.Cargotype, rs.Unitowner, rs.IdNumber, rs.Destination, rs.Deposition, rs.IsSensitive
                                             , rs.IsDamaged, rs.IsHazmat, rs.IsHighVisability, rs.Comments, dateTimePicker1.Value);

                    _rollingstock.Add(rs);
                    ClearTextBoxes();

                    txtSerialNum.Clear();
                    txtDesc.Clear();
                    ckbxDrivable.Checked = false;
                }
                if (cmbxCargoType.Text == @"Container")
                {
                    _dt.Rows.Add(txtBoxStcn.Text, cmbxCargoType.Text, txtContNum.Text, txtCDesc.Text, cmbBoxUnitOwner.Text,
                                 cmbBoxDepo.Text, txtBoxDest.Text, false, ckbHazmat.Checked, ckbSensitive.Checked,
                                 ckbHighVis.Checked, ckcBoxDamaged.Checked, false, richTextComment.Text, dateTimePicker1.Text);

                    var container = new Container(txtBoxStcn.Text, cmbxCargoType.Text, txtContNum.Text, cmbBoxUnitOwner.Text,
                                                  txtBoxDest.Text, cmbBoxDepo.Text, txtCDesc.Text, false, ckbSensitive.Checked,
                                                  ckcBoxDamaged.Checked, ckbHazmat.Checked, ckbHighVis.Checked, richTextComment.Text, dateTimePicker1.Value);

                    AddContainerCargo(container);

                    _container.Add(container);
                    ClearTextBoxes();

                    txtContNum.Clear();
                    txtCDesc.Clear();
                    ckbxDrivable.Checked = false;
                }
                if (cmbxCargoType.Text == @"Loose")
                {
                    _dt.Rows.Add(txtBoxStcn.Text, cmbxCargoType.Text, false, txtBoxDescLoose.Text, cmbBoxUnitOwner.Text,
                                 cmbBoxDepo.Text, txtBoxDest.Text, false, ckbHazmat.Checked, ckbSensitive.Checked,
                                 ckbHighVis.Checked, ckcBoxDamaged.Checked, false, richTextComment.Text, dateTimePicker1.Text);

                    var container = new Container(txtBoxStcn.Text, cmbxCargoType.Text, "", cmbBoxUnitOwner.Text, txtBoxDest.Text,
                                                  cmbBoxDepo.Text, txtBoxDescLoose.Text, false, ckbSensitive.Checked,
                                                  ckcBoxDamaged.Checked, ckbHazmat.Checked, ckbHighVis.Checked, richTextComment.Text, dateTimePicker1.Value);

                    AddContainerCargo(container);
                    _container.Add(container);

                    ClearTextBoxes();
                    txtBoxDescLoose.Clear();
                }
                if (cmbxCargoType.Text == @"463L Pallet")
                {
                    _dt.Rows.Add(txtBoxStcn.Text, cmbxCargoType.Text, false, txt463LDecs.Text, cmbBoxUnitOwner.Text,
                                 cmbBoxDepo.Text, txtBoxDest.Text, false, ckbHazmat.Checked, ckbSensitive.Checked,
                                 ckbHighVis.Checked, ckcBoxDamaged.Checked, ckboxTrained.Checked, richTextComment.Text,
                                 dateTimePicker1.Text);

                    var container = new Container(txtBoxStcn.Text, cmbxCargoType.Text, "", cmbBoxUnitOwner.Text,
                                                  txtBoxDest.Text, cmbBoxDepo.Text, txt463LDecs.Text, ckboxTrained.Checked, ckbSensitive.Checked,
                                                  ckcBoxDamaged.Checked, ckbHazmat.Checked, ckbHighVis.Checked, richTextComment.Text,
                                                  dateTimePicker1.Value);

                    AddContainerCargo(container);
                    _container.Add(container);

                    ClearTextBoxes();
                    txt463LDecs.Clear();
                    ckboxTrained.Checked = false;
                }
                AddCargoGrid.DataSource = _dt;
            }
            else
            {
                MessageBox.Show(@"Please enter required fields that are highlighted");
            }
        }
Пример #3
0
        //*********************************************************************
        // Function used to load cargo information from Log File
        //*********************************************************************
        public void LoadCargoShipments()
        {
            try
            {
                if (File.Exists(@"AddCargoLog.csv"))
                {
                    StreamReader file  = new StreamReader(@"AddCargoLog.csv");
                    var          hline = file.ReadLine();
                    if (hline != null)
                    {
                        _manifestHeaders = hline.Split(',');
                    }

                    while (!file.EndOfStream)
                    {
                        var line = file.ReadLine();
                        if (line != null)
                        {
                            string[]  row = line.Split(',');
                            CShipment cs  = new CShipment(row[0], row[1], row[3]
                                                          , row[2], row[5], row[4]);
                            CsList.Add(cs);
                            CargoPiece cp = new CargoPiece(row[5], row[6],
                                                           row[9], row[7], row[11], row[10],
                                                           Convert.ToBoolean(row[14]),
                                                           Convert.ToBoolean(row[16]),
                                                           Convert.ToBoolean(row[13]),
                                                           Convert.ToBoolean(row[15]), row[18],
                                                           Convert.ToDateTime(row[19]));
                            CpList.Add(cp);
                            if (row[6] == "Rolling Stock")
                            {
                                RollingStock rs = new RollingStock(row[5],
                                                                   row[6], row[9], row[7], row[8],
                                                                   Convert.ToBoolean(row[12]), row[11],
                                                                   row[10], Convert.ToBoolean(row[14]),
                                                                   Convert.ToBoolean(row[16]),
                                                                   Convert.ToBoolean(row[13]),
                                                                   Convert.ToBoolean(row[15]),
                                                                   row[18], Convert.ToDateTime(row[19]));
                                RsList.Add(rs);
                            }
                            else
                            {
                                Container c = new Container(row[5], row[6],
                                                            row[7], row[9], row[11], row[10], row[8],
                                                            Convert.ToBoolean(row[17]),
                                                            Convert.ToBoolean(row[14]),
                                                            Convert.ToBoolean(row[16]),
                                                            Convert.ToBoolean(row[13]),
                                                            Convert.ToBoolean(row[15]),
                                                            row[18], Convert.ToDateTime(row[19]));
                                CList.Add(c);
                            }
                        }
                    }
                    file.Close();
                }
                else
                {
                    StreamWriter file = new StreamWriter(@"AddCargoLog.csv");
                    file.WriteLine("TCN" + "," + "Deposition" + "," +
                                   "Destination" + "," + "Asset" + "," + "Recieved By" +
                                   "," + "Piece TCN" + "," + "Cargo Type" + "," +
                                   "Piece ID" + "," + "Description" + "," + "Unit Owner" +
                                   "," + "Deposition" + "," + "Destination" + "," +
                                   "Drivable" + "," + "Hazmat" + "," + "Sensitive Item"
                                   + "," + "High Visabilty" + "," + "Damaged" + "," +
                                   "Trained Pallet" + "," + "Comments" + "," + "Date");
                    file.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
        }