Beispiel #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));
            }
        }
        //*********************************************************************
        // AddCargoPiece Function
        // This Function Creates a CargoPiece Object used to link
        // CargoShipments to CargoPieces
        //*********************************************************************
        public CargoPiece AddCargoPiece(string id, string destination,
                                        string cargotype, string unitowner, string depo, string tcn,
                                        string comments, bool issensitive, bool isdamaged, bool ishazmat,
                                        bool ishighvis, DateTime dateTime)
        {
            CargoPiece cargoPiece = new CargoPiece(tcn, cargotype, unitowner,
                                                   id, destination, depo, issensitive, isdamaged, ishazmat,
                                                   ishighvis, comments, dateTime);

            return(cargoPiece);
        }
Beispiel #3
0
        //*********************************************************************
        // Function used to create cargo pieces
        //*********************************************************************
        public void AddCargoPiece(string tcn, string cargotype,
                                  string unitowner, string idNumber, string destination,
                                  string deposition, bool isSensitive, bool isDamaged,
                                  bool isHazmat, bool isHighVis, string comments, DateTime dateTime)
        {
            CShipment  cs = new CShipment();
            CargoPiece cp = cs.AddCargoPiece(idNumber, destination, cargotype,
                                             unitowner, deposition, tcn, comments,
                                             isSensitive, isDamaged, isHazmat, isHighVis, dateTime);

            TempcpList.Add(cp);
        }
Beispiel #4
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));
            }
        }