private void setupAreaToolStripMenuItem_Click(object sender, EventArgs e) { fmArea fArea = new fmArea(); fArea.ShowDialog(); LoadAreaCombo(CommonProcs.GetFacList(GetCurrentBranch())); }
private List <int> LoadFacilityCombo(string branchStr) { cbFac.DataSource = SelectListHelper.GetFacilityList(branchStr); cbFac.DisplayMember = "key"; cbFac.ValueMember = "value"; return(CommonProcs.GetFacList(branchStr)); }
private void btnAddHours_Click(object sender, EventArgs e) { if (GetCurrentBranch() == "AA") { MessageBox.Show("Cannot add Timesheet items when selected branch is ShowAll"); return; } if (tbRegHours.Text != string.Empty) { TimeSheet ts = new TimeSheet(); ts.EmployeeID = int.Parse(cbEmployee.SelectedValue.ToString()); ts.CustomerID = int.Parse(cbCustomer.SelectedValue.ToString()); ts.ClassID = int.Parse(cbClassEquip.SelectedValue.ToString()); ts.RegHours = decimal.Parse(tbRegHours.Text); ts.PayrollItemID = int.Parse(cbPayrollItem.SelectedValue.ToString()); ts.WorkDate = dtpDateWorked.Value; ts.WeekEnding = dtpWeekEnding.Value; ts.FacID = int.Parse(cbFac.SelectedValue.ToString()); ts.AreaID = int.Parse(cbArea.SelectedValue.ToString()); ts.Notes = noteText; ts.SupApprove = false; ts.OMApprove = false; ts.HOApprove = false; ts.TimesheetID = new ModelToSQL <TimeSheet>().WriteInsertSQL("Timesheet", ts, "TimesheetID", CommonProcs.WCompanyConnStr); } if (tbOTHours.Text != string.Empty) { TimeSheet ts = new TimeSheet(); ts.EmployeeID = int.Parse(cbEmployee.SelectedValue.ToString()); ts.CustomerID = int.Parse(cbCustomer.SelectedValue.ToString()); ts.ClassID = int.Parse(cbClassEquip.SelectedValue.ToString()); ts.OTHours = decimal.Parse(tbOTHours.Text); ts.PayrollItemID = GetOTPayrollItem(cbPayrollItem.SelectedValue.ToString()); ts.WorkDate = dtpDateWorked.Value; ts.WeekEnding = dtpWeekEnding.Value; ts.FacID = int.Parse(cbFac.SelectedValue.ToString()); ts.AreaID = int.Parse(cbArea.SelectedValue.ToString()); ts.Notes = noteText; ts.SupApprove = false; ts.OMApprove = false; ts.HOApprove = false; ts.TimesheetID = new ModelToSQL <TimeSheet>().WriteInsertSQL("Timesheet", ts, "TimesheetID", CommonProcs.WCompanyConnStr); } FillGridView(true); LoadAreaCombo(CommonProcs.GetFacList(GetCurrentBranch())); dtpDateWorked.Value = dtpDateWorked.Value.AddDays(1); dtpDateWorked.Focus(); }