コード例 #1
0
 private void addPayRateBtn_Click(object sender, EventArgs e)
 {
     List<Job> alreadyAssignedJobList = new List<Job>();
     foreach (PayRate p in currEmp.PayRateList)
     {
         alreadyAssignedJobList.Add(p.Job);
     }
     AddEditPayRateForm addEditPayRateForm = new AddEditPayRateForm(this, alreadyAssignedJobList, new PayRate(), false);
     this.Enabled = false;
     addEditPayRateForm.Show();
 }
コード例 #2
0
        private void editPayRateBtn_Click(object sender, EventArgs e)
        {
            PayRate currSelectedPayRate = new PayRate();

            if(this.empJobDataGridView.SelectedRows.Count > 1)
            {
                MessageBox.Show("Please select just one job record to edit.", "Invalid Input");
            }
            else if (this.empJobDataGridView.SelectedRows.Count < 1)
            {
                MessageBox.Show("Please select a job record to edit.", "Invalid Input");
            }
            else
            {

                if (this.empJobDataGridView.SelectedRows[0].Cells[0].Value != null)
                {
                    currSelectedPayRate.PayRateId = (int)this.empJobDataGridView.SelectedRows[0].Cells[0].Value;
                }

                if (this.empJobDataGridView.SelectedRows[0].Cells[1].Value != null)
                {
                    currSelectedPayRate.Job.JobId = (int)this.empJobDataGridView.SelectedRows[0].Cells[1].Value;
                }

                currSelectedPayRate.Job.JobName = this.empJobDataGridView.SelectedRows[0].Cells[2].Value.ToString();
                currSelectedPayRate.Job.RefCode = this.empJobDataGridView.SelectedRows[0].Cells[3].Value.ToString();
                currSelectedPayRate.Active = (bool)this.empJobDataGridView.SelectedRows[0].Cells[4].Value;
                currSelectedPayRate.HourlyPayRate = Decimal.Parse(this.empJobDataGridView.SelectedRows[0].Cells[5].Value.ToString());

                AddEditPayRateForm addEditPayRateForm = new AddEditPayRateForm(this, currSelectedPayRate, true);
                this.Enabled = false;
                addEditPayRateForm.Show();
            }
        }