Пример #1
0
        ////////////////////////////////////////////////////////////
        // Allows the user to Import database file and merge
        // the file with the current database file.
        private void btnImport_Click(object sender, EventArgs e)
        {
            string importType;

            MessageBox.Show(@"Ensure importing file is an export from another RIDS system.");
            OpenFileDialog importfile = new OpenFileDialog();

            if (importfile.ShowDialog() == DialogResult.OK)
            {
                var sourcefile = importfile.FileName;

                string extenstion = Path.GetExtension(sourcefile);
                if (extenstion != ".csv")
                {
                    MessageBox.Show(@"Invalid file extension. Only .csv can be imported");
                }
                else
                {
                    RidsDriver ridsDriver = new RidsDriver();
                    importType = ridsDriver.ValidateInputFile(sourcefile);
                    if (importType == "Cargo")
                    {
                        ridsDriver.ImportData(sourcefile);
                        MessageBox.Show(@"Import Completed");
                    }
                    else
                    {
                        MessageBox.Show(@"Input file does not match the layout of a RIDS export." + "\n\nPlease verify " +
                                        @"that the file you are importing, was exported from another RIDS applicaion and has not been modified.", @"Invalid Input File Format");
                    }
                }
            }
        }
Пример #2
0
        private void LoadRecievedBy()
        {
            RidsDriver    ridsDriver = new RidsDriver();
            List <string> uniqueUnit = ridsDriver.LoadRecievedBy();

            foreach (var u in uniqueUnit)
            {
                cmbBoxUnitOwner.Items.Add(u);
            }
        }
Пример #3
0
        ////////////////////////////////////////////////////////////
        // Allows the user to generate a report, select file path
        private void btnReport_Click(object sender, EventArgs e)
        {
            SaveFileDialog newfile = new SaveFileDialog
            {
                Filter     = @"CSV (Comma delimited) | *.csv",
                DefaultExt = "csv"
            };
            var result = newfile.ShowDialog();

            if (result == DialogResult.OK)
            {
                string     fileName   = newfile.FileName;
                RidsDriver ridsDriver = new RidsDriver();
                ridsDriver.Export(fileName);
            }
        }