private void deleteJobCodeBtn_Click(object sender, EventArgs e) { jobControls deleteJobCode = new jobControls(Username); deleteJobCode.deleteJobCode(jobCodesListBox.SelectedItem.ToString()); fillJobCodesList(); deleteJobCode = null; }
private void editJobToolStripMenuItem_Click(object sender, EventArgs e) { jobControls editJob = new jobControls(Username); editJob.editJob(jobNumberComboBox.Text, jobNameComboBox.Text); fillJobList(editJob.JobNumber); editJob = null; }
private void deleteJobButton_Click(object sender, EventArgs e) { jobControls deleteJob = new jobControls(Username); deleteJob.deleteJob(Convert.ToString(jobNumberComboBox.Text)); jobNumberComboBox.SelectedIndex = -1; fillJobList(); deleteJob = null; }
private void jobNameComboBox_SelectedIndexChanged(object sender, EventArgs e) { jobNumberComboBox.SelectedIndex = jobNameComboBox.SelectedIndex; if (jobNameComboBox.SelectedIndex != -1 || jobNumberComboBox.SelectedIndex != -1) { jobControls loadSelectedJob = new jobControls(Username); loadSelectedJob.loadJob(jobNumberComboBox.Text); if (loadSelectedJob.JobCode != null) { if (jobCodesComboBox.Items.Contains(loadSelectedJob.JobCode)) { jobCodesComboBox.SelectedItem = loadSelectedJob.JobCode; } jobStartDateTimePicker.Value = loadSelectedJob.StartDate; jobEndDateTimePicker.Value = loadSelectedJob.EndDate; jobEstimateTextBox.Text = Convert.ToString(loadSelectedJob.JobEstimateCost); JobStatus = loadSelectedJob.JobStatus; jobNotesTextBox.Text = loadSelectedJob.JobNotes; string[] jobEmployList = loadSelectedJob.jobEmployees; employeeListBox.Items.Clear(); if (jobEmployList != null) { for (int i = 0; i < jobEmployList.Length; i++) { employeeListBox.Items.Add(jobEmployList[i]); } } } lastTimeUpdateLabel.Text = "Last Time Updated: \n" + File.GetLastWriteTime(DirectoryName + jobNumberComboBox.Text + JOBFILEEXTENSHION).ToShortDateString() + "\n" + File.GetLastWriteTime(DirectoryName + jobNumberComboBox.Text + JOBFILEEXTENSHION).ToShortTimeString(); jobNameComboBox.Enabled = false; jobNumberComboBox.Enabled = false; jobControlPanel.Visible = true; saveJobButton.Visible = true; saveJobToolStripMenuItem.Visible = true; deleteJobBtn.Visible = true; deleteJobToolStripMenuItem.Visible = true; editJobToolStripMenuItem.Visible = true; editJobNameButton.Visible = true; loadSelectedJob = null; } else { jobNameComboBox.Enabled = true; jobNumberComboBox.Enabled = true; jobControlPanel.Visible = false; deleteJobBtn.Visible = false; saveJobButton.Visible = false; saveJobToolStripMenuItem.Visible = false; deleteJobToolStripMenuItem.Visible = false; editJobToolStripMenuItem.Visible = false; editJobNameButton.Visible = false; } }
private void createJobCodeBtn_Click(object sender, EventArgs e) { if (newJobCodeTextBox.Text != "") { jobControls addNewJobCode = new jobControls(Username); addNewJobCode.addJobCode(newJobCodeTextBox.Text); addNewJobCode = null; fillJobCodesList(); newJobCodeTextBox.Text = ""; } else { newJobCodeErrorLabel.Visible = true; } }
public editJob(string recivedUsername, string selectedJobNumber) { InitializeComponent(); fillJobCodesList(); int cutAt = selectedJobNumber.IndexOf(" "); selectedJobNumber = selectedJobNumber.Remove(cutAt); jobNumberLabel.Text = selectedJobNumber; jobNumber = selectedJobNumber; currentUsername = recivedUsername; userNameLabel.Text = currentUsername; this.Text = String.Format("Edit Job For {0}", currentUsername); jobControls loadSelectedJob = new jobControls(currentUsername); loadSelectedJob.loadJob(selectedJobNumber); if (!String.IsNullOrWhiteSpace(loadSelectedJob.JobCode)) { if (jobCodesComboBox.Items.Contains(loadSelectedJob.JobCode)) { jobCodesComboBox.SelectedItem = loadSelectedJob.JobCode; } jobName = loadSelectedJob.JobName; jobStartDateTimePicker.Value = loadSelectedJob.StartDate; jobEndDateTimePicker.Value = loadSelectedJob.EndDate; jobEstimateTextBox.Text = Convert.ToString(loadSelectedJob.JobEstimateCost); JobStatus = loadSelectedJob.JobStatus; jobNotesTextBox.Text = loadSelectedJob.JobNotes; string[] jobEmployList = loadSelectedJob.jobEmployees; employeeListBox.Items.Clear(); if (jobEmployList != null) { for (int i = 0; i < jobEmployList.Length; i++) { employeeListBox.Items.Add(jobEmployList[i]); } } } DateTime lastWriteTime = File.GetLastWriteTime(REQUIREDFOLDER + currentUsername + "\\" + selectedJobNumber + JOBFILEEXTENSHION); lastTimeUpdateLabel.Text = String.Format("Last Time Updated: {0}{1}{2}{3}", Environment.NewLine, lastWriteTime.ToShortDateString(), Environment.NewLine, lastWriteTime.ToShortDateString()); jobNameLabel.Text = JobName; }
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; } }
private void saveJobButton_Click(object sender, EventArgs e) { //Vairables bool saveSuccessful = true; string currentJobNumber = JobNumber; string currentJobName = JobName; DateTime startDate = jobStartDateTimePicker.Value; DateTime endDate = jobEndDateTimePicker.Value; int amountOfEmployees = employeeListBox.Items.Count; string[] jobEmployees = new string[amountOfEmployees]; string jobCode = jobCodesComboBox.Text; double jobEstimateCost; string jobStatus = JobStatus; string jobNotes = jobNotesTextBox.Text; //Fill Employees array for (int i = 0; i < amountOfEmployees; i++) { jobEmployees[i] = employeeListBox.Items[i].ToString(); } //try checking if the estimate total is an int if (double.TryParse(jobEstimateTextBox.Text, out jobEstimateCost) == false) { //Error Job Estimate is not a number saveSuccessful = false; jobEstimateErrorLabel.Visible = true; } else { jobEstimateErrorLabel.Visible = false; } //Check to make sure the end date is after the start date if (endDate < startDate) { saveSuccessful = false; jobEndDateErrorLabel.Visible = true; } else { jobEndDateErrorLabel.Visible = false; } //Check to make sure there is a job code selected if (!jobCodesComboBox.Items.Contains(jobCodesComboBox.Text)) { saveSuccessful = false; jobCodeErrorLabel.Visible = true; } else { jobCodeErrorLabel.Visible = false; } //Check to see if there is a job status selected if (JobStatus == "No Job Selected") { saveSuccessful = false; jobStatusErrorLabel.Visible = true; } else { jobStatusErrorLabel.Visible = false; } //if all information is filled in if (saveSuccessful) { jobControls saveCurrentJob = new jobControls(currentUsername); saveCurrentJob.saveJob(currentJobName, currentJobNumber, startDate, endDate, jobEmployees, jobCode, jobEstimateCost, jobStatus, jobNotes); saveCurrentJob = null; DialogResult = DialogResult.OK; } }