Пример #1
0
 public SearchForm(SoldiersForm parent)
 {
     detailsSoldier = new Soldier();
     parentForm = parent;
     databaseFile = parent.databaseFile;
     InitializeComponent();
     setupForm();
 }
Пример #2
0
 //handles starting from scratch
 public DetailsForm(SoldiersForm parent)
 {
     detailsSoldier = new Soldier();
     newSoldier = true;
     parentForm = parent;
     databaseFile = parent.databaseFile;
     InitializeComponent();
     setupForm();
     loadDefaultInfo();
 }
Пример #3
0
        public SoldiersForm parentForm; //so we know what db to edit, and so we can refresh list when done

        #endregion Fields

        #region Constructors

        //handles loading existing and duplicating
        public DetailsForm(Soldier ds , bool ns, SoldiersForm parent)
        {
            detailsSoldier = ds;
            newSoldier = ns;
            parentForm = parent;
            databaseFile = parent.databaseFile;
            InitializeComponent();
            setupForm();
            loadInfo();
            //detailsSoldier = new Soldier();
        }
Пример #4
0
        //handles calling on a custom database
        public SoldiersForm(String db, SoldiersForm pf)
        {
            databaseFile = db;
            parentForm = pf;
            InitializeComponent();
            menuStripViewSoldierList_Click(null, null);

            // Create an instance of a ListView column sorter and assign it
            // to the ListView control.
            lvwColumnSorter = new ListViewColumnSorter();
            this.listViewSoldiers.ListViewItemSorter = lvwColumnSorter;
        }
Пример #5
0
 //opens a secondart database
 private void menuStripItemOpenDatabase_Click(object sender, EventArgs e)
 {
     OpenFileDialog browseFile = new OpenFileDialog();
     browseFile.Filter = "s3db Files (*.s3db)|*.s3db";
     browseFile.Title = "Browse s3db files";
     if (browseFile.ShowDialog() == DialogResult.Cancel)
         return;
     try
     {
         //txtBrowse.Text = browseFile.FileName;
         SoldiersForm secondaryDatabase = new SoldiersForm(browseFile.FileName.ToString(),this);
         secondaryDatabase.Show();
         secondaryDatabase.buttonSubmitToMaster.Show();
         secondaryDatabase.menuStripItemOpenDatabase.Enabled = false;
         secondaryDatabase.Text = "Secondary Database - " + browseFile.FileName.ToString();
     }
     catch (Exception)
     {
         MessageBox.Show("Error opening file", "File Error",
         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Пример #6
0
        //creates an empty database from the template database
        private void menuStripItemCreateDatabase_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();//NEW

            saveFileDialog1.Filter = "s3db files (*.s3db)|*.s3db";//NEW
            //saveFileDialog1.FilterIndex = 1;//NEW
            saveFileDialog1.RestoreDirectory = true;//NEW
            //bool fileSpecified = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)//NEW
            {
                String path = new database().path;
                System.IO.File.Copy(path + "soldierdb_template.s3db", saveFileDialog1.FileName.ToString(), true);

                try
                {
                    //txtBrowse.Text = browseFile.FileName;

                    SoldiersForm secondaryDatabase = new SoldiersForm(saveFileDialog1.FileName.ToString(), this);
                    secondaryDatabase.Show();
                    secondaryDatabase.buttonSubmitToMaster.Show();
                    secondaryDatabase.menuStripItemOpenDatabase.Enabled = false;
                    secondaryDatabase.Text = "Secondary Database - " + saveFileDialog1.FileName.ToString();

                }
                catch (Exception)
                {
                    MessageBox.Show("Error opening file", "File Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }