private void button1_Click(object sender, EventArgs e) { string serial = txtserial.Text; string cid = txtcomputer_id.Text; locationsBLL l = new locationsBLL(); locationDAL l1 = new locationDAL(); OpenFileDialog file = new OpenFileDialog(); //open dialog to choose file if (file.ShowDialog() == System.Windows.Forms.DialogResult.OK) //if there is a file choosen by the user { l.location = file.FileName; //get the path of the file l.type = "template"; if (l1.Insert(l)) { MessageBox.Show("file location saved"); } else { MessageBox.Show("file can not be added"); } } }
private void button3_Click(object sender, EventArgs e) { FolderBrowserDialog path = new FolderBrowserDialog(); //open dialog to choose file path.ShowNewFolderButton = true; if (path.ShowDialog() == System.Windows.Forms.DialogResult.OK) //if there is a file choosen by the user { locationsBLL l = new locationsBLL(); locationDAL l1 = new locationDAL(); OpenFileDialog file = new OpenFileDialog(); //open dialog to choose file l.location = path.SelectedPath; //get the path of the file l.type = "save deactivation"; if (l1.Insert(l)) { MessageBox.Show("file location saved"); } else { MessageBox.Show("file can not be added"); } } }