Beispiel #1
0
        private void btnsavelocation_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tbfilename.Text) || String.IsNullOrEmpty(tbsavename.Text))
            {
                MessageBox.Show("Must provide fileName and SaveName to save");
                return;
            }

            try {
                firedumpdbDataSetTableAdapters.backup_locationsTableAdapter backup_adapter = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
                if (isEditor)
                {
                    backup_adapter.Update(tbsavename.Text, "", "", path, tbfilename.Text, (int)ServiceType.Type.DropBox, 0, "", "", "", "", "", "", "", 0, 0, tbtoken.Text, "", 0, "", 0, row.id);
                }
                else
                {
                    backup_adapter.Insert(tbsavename.Text, "", "", path, tbfilename.Text, (int)ServiceType.Type.DropBox, 0, "", "", "", "", "", "", "", 0, 0, tbtoken.Text, "", 0, "", 0);
                }

                locswitch.reloadDataset();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not save , error!");
            }
        }
Beispiel #2
0
        private void bSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbName.Text))
            {
                MessageBox.Show("Please enter a valid name for the enw file location", "New file system location", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                Path.IsPathRooted(tbPath.Text);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show("Please choose a valid path", "New file system location", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            adapter = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
            if ((Int64)adapter.numberOfOccurances(tbName.Text) != 0)
            {
                MessageBox.Show("A save location with this name already exists", "New file system location", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                if (isEditor)
                {
                    adapter.Update(tbName.Text, "", "", tbPath.Text, "", (int)ServiceType.Type.Local, 0, "", "", "", "", "", "", "", 0, 0, "", "", 0, "", 0, (Int64)locallocation["id"]);
                }
                else
                {
                    adapter.Insert(tbName.Text, "", "", tbPath.Text, "", (int)ServiceType.Type.Local, 0, "", "", "", "", "", "", "", 0, 0, "", "", 0, "", 0);
                }
                locswitch.reloadDataset(); //callback stin klasi pou to kalese na kanei refresh to combobox
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occured trying to save to the database:\n" + ex.Message, "File system Location Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        private void bSave_Click(object sender, EventArgs e)
        {
            if (!performChecks(true))
            {
                return;
            }

            if (!testConnectionSucceded)
            {
                DialogResult res = MessageBox.Show("Connection wasn't tested or the test wasn't successful. Save anyway?", "FTP Location Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res != DialogResult.Yes)
                {
                    return;
                }
            }

            firedumpdbDataSetTableAdapters.backup_locationsTableAdapter backup_adapter = new firedumpdbDataSetTableAdapters.backup_locationsTableAdapter();
            int protocol = cmbProtocol.SelectedIndex;

            try
            {
                String passwd = EncryptionUtils.sEncrypt(tbPassword.Text);
                if (isEditor)
                {
                    backup_adapter.Update(tbName.Text, tbUsername.Text, passwd, tbChooseAPath.Text, tbFilename.Text, (int)ServiceType.Type.Ftp, protocol, tbPrivateKey.Text, sshKeyFingerprint, "", "", "", "", "", 0, 0, "", "", Convert.ToInt64(tbPort.Text), tbHost.Text, protocol, (Int64)ftplocation["id"]);
                }
                else
                {
                    backup_adapter.Insert(tbName.Text, tbUsername.Text, passwd, tbChooseAPath.Text, tbFilename.Text, (int)ServiceType.Type.Ftp, protocol, tbPrivateKey.Text, sshKeyFingerprint, "", "", "", "", "", 0, 0, "", "", Convert.ToInt64(tbPort.Text), tbHost.Text, protocol);
                }
                listener.reloadDataset();
                this.Close();
            }catch (Exception ex)
            {
                MessageBox.Show("Error occured trying to save:\n" + ex.Message, "FTP Location Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }