private void newJobToolStripMenuItem_Click(object sender, EventArgs e) { //New Job string newJobNumber, newJobName; newJobFrm newJob = new newJobFrm(); newJob.ShowDialog(); if (newJob.DialogResult == DialogResult.OK) { newJobNumber = newJob.ReturnJobNumber; newJobName = newJob.ReturnJobName; jobControls newJobControls = new jobControls(Username); newJobControls.newJob(newJobName, newJobNumber); fillJobList(newJobNumber); newJob = null; } }
public void editJob(string currentJobNumber, string currentJobName) { newJobFrm changeJobName = new newJobFrm(); changeJobName.ShowDialog(); if (changeJobName.DialogResult == DialogResult.OK) { jobName = changeJobName.ReturnJobName; jobNumber = changeJobName.ReturnJobNumber; File.Move(DirectoryName + currentJobNumber + JOBFILEEXTENSHION, DirectoryName + jobNumber + JOBFILEEXTENSHION); string jobNumberToChangeName = DirectoryName + jobNumber + JOBFILEEXTENSHION; string text = File.ReadAllText(jobNumberToChangeName); text = text.Replace(currentJobName, jobName); File.WriteAllText(jobNumberToChangeName, text); } else { jobNumber = currentJobNumber; } }