public serviceExecutionWindow(serviceExecution currentSE) { InitializeComponent(); tbStage.Text = currentSE.requestedService.stageOfImplementation.name.ToString(); tbDescription.Text = currentSE.requestedService.description; tbEmployeeName.Text = currentSE.employee.FIO; tbPhone.Text = currentSE.employee.phoneNumber.ToString(); dpDateOfBegin.SelectedDate = currentSE.dateOfBegin; dpDateOfEnd.SelectedDate = currentSE.dateOfEnd; tbResult.Text = currentSE.result; }
private void bAddForWork_Click(object sender, RoutedEventArgs e) { if (dbGridRequestedServices.SelectedItem == null) { MessageBox.Show("Заявка не выбрана"); } else { serviceExecution se = new serviceExecution(); se.dateOfBegin = DateTime.Now; se.employee = currentUser; Int32 id = (dbGridRequestedServices.SelectedItem as View_requestedServices).Id; requestedService currentRS = core.serviceCenterDB.requestedServices.Where(rs => rs.Id == id).FirstOrDefault(); se.requestedService = currentRS; se.requestedService.stageOfImplementation = core.serviceCenterDB.stagesOfImplementations.Where(st => st.name == "В работе").FirstOrDefault(); core.serviceCenterDB.servicesExecution.Add(se); core.serviceCenterDB.SaveChanges(); updateMyServiceExecution(); updateRequestedServices(); updateModules(); } }