private void Window_Loaded(object sender, RoutedEventArgs e) { int currentMonth = DateTime.Now.Month; int[] monthArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; cbMonth.ItemsSource = monthArray; cbMonth.SelectedItem = currentMonth; int currentYear = DateTime.Now.Year; int[] yearArray = { currentYear - 1, currentYear, currentYear + 1 }; cbYear.ItemsSource = yearArray; cbYear.SelectedItem = currentYear; lineList = LineController.Select(); cbLine.ItemsSource = lineList.Where(w => w.SectionId == "F").Select(s => s.LineId).ToList(); cbLine.SelectedItem = lineList.Where(w => w.SectionId == "F").Select(s => s.LineId).FirstOrDefault(); string lineId = ""; lineId = cbLine.SelectedValue as string; int _month = 0, _year = 0; Int32.TryParse(cbMonth.SelectedValue.ToString(), out _month); Int32.TryParse(cbYear.SelectedValue.ToString(), out _year); requestList = CieControlIncentiveController.Select(lineId, _month, _year); dgvRequest.ItemsSource = requestList; }
private void btnSend_Click(object sender, RoutedEventArgs e) { int intcentiveBf = 0, incentiveAf = 0; double workHrsBf = 0, workHrsAf = 0; Int32.TryParse(txtIncentiveBefore.Text.ToString(), out intcentiveBf); Int32.TryParse(txtIncentiveAfter.Text.ToString(), out incentiveAf); Double.TryParse(txtWorkHrsBefore.Text.ToString(), out workHrsBf); Double.TryParse(txtWorkHrsAfter.Text.ToString(), out workHrsAf); string reason = ""; reason = txtReason.Text.Trim(); CieControlIncentiveModel insertModel = new CieControlIncentiveModel() { WorkHrsBefore = workHrsBf, WorkHrsAfter = workHrsAf, LineId = line.LineId, Reason = reason, RequestTime = date, IncentiveBefore = intcentiveBf, IncentiveAfter = incentiveAf }; if (CieControlIncentiveController.Insert(insertModel) == false) { MessageBox.Show("Error !!", "Infor", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBox.Show("Sent !", "Infor", MessageBoxButton.OK, MessageBoxImage.Information); }
private void threadAccept_DoWork(object sender, DoWorkEventArgs e) { object[] arguments = e.Argument as object[]; CieControlIncentiveModel acceptModel = arguments[0] as CieControlIncentiveModel; DateTime acceptedTime = DateTime.Now; e.Result = CieControlIncentiveController.Update(acceptModel.LineId, acceptModel.RequestTime, acceptedTime); }
private void btnSearch_Click(object sender, RoutedEventArgs e) { dgvRequest.ItemsSource = null; string lineId = ""; lineId = cbLine.SelectedValue as string; int _month = 0, _year = 0; Int32.TryParse(cbMonth.SelectedValue.ToString(), out _month); Int32.TryParse(cbYear.SelectedValue.ToString(), out _year); requestList = CieControlIncentiveController.Select(lineId, _month, _year); dgvRequest.ItemsSource = requestList; }