private void BtnAddTodo_Click(object sender, EventArgs e) { // 작업 할당 버튼 try { // txt값 가져오기 int addAmount; bool isAddable = int.TryParse(txtAmount.Text.Trim(), out addAmount); if (!isAddable) { throw new Exception("개수를 다시 입력해주세요."); } // 입력 시도 TodoService service = new TodoService(); service.InsertNUpdateProductionPlan(new TodoDTO() { ProductionID = dgvProductionPlans.SelectedRows[0].Cells["ProductionID"].Value.ToString(), MachineID = cmbMachines.SelectedValue.ToString(), EmployeeID = cmbEmployees.SelectedValue.ToString(), ProductionPlanCode = Convert.ToInt32(dgvProductionPlans.SelectedRows[0].Cells["ProductionPlanCode"].Value), Amount = addAmount }, addAmount); service.Dispose(); } catch (Exception ee) { MessageBox.Show(ee.Message); } // 재로드 LoadDgvs(); }
private void BtnRemoveTodo_Click(object sender, EventArgs e) { // 작업 취소 버튼 try { TodoDTO dto = new TodoDTO() { }; // 취소 시도 TodoService service = new TodoService(); service.revertNUpdateProductionPlan(new TodoDTO() { TodoCode = Convert.ToInt32(dgvTodo.SelectedRows[0].Cells["TodoCode"].Value), ProductionID = dgvTodo.SelectedRows[0].Cells["ProductionID"].Value.ToString(), MachineID = dgvTodo.SelectedRows[0].Cells["MachineID"].Value.ToString(), EmployeeID = dgvTodo.SelectedRows[0].Cells["EmployeeID"].Value.ToString(), ProductionPlanCode = Convert.ToInt32(dgvTodo.SelectedRows[0].Cells["ProductionPlanCode"].Value), Amount = Convert.ToInt32(dgvTodo.SelectedRows[0].Cells["Amount"].Value) }); service.Dispose(); } catch (Exception ee) { MessageBox.Show(ee.Message); } // 재로드 LoadDgvs(); }
private void LoadDgvs() //데이터그리드뷰 로드 { // 생산 계획 로드 ProductionPlanService ppService = new ProductionPlanService(); BindingList <ProductionPlanDTO> ppbindlist = new BindingList <ProductionPlanDTO>(ppService.SelectAll()); ppService.Dispose(); dgvProductionPlans.DataSource = ppbindlist; // 생산가능한 제품 로드 ( 기계 마다 ) PListByMachineService plService = new PListByMachineService(); pllist = plService.SelectAll(); plService.Dispose(); // 전체 Todo 갖고오기 TodoService tdService = new TodoService(); tdlist = tdService.SelectAll(); tdService.Dispose(); // 갖고오기 dgvTodo.DataSource = new BindingList <TodoDTO>(tdlist); dgvProductionable.DataSource = new BindingList <PListByMachineDTO>(pllist.Where((elem) => elem.MachineID == cmbMachines.SelectedValue.ToString()).ToList()); dgvTodoListPerEmployee.DataSource = new BindingList <TodoDTO>(tdlist.Where((elem) => elem.EmployeeID == cmbEmployees.SelectedValue.ToString()).ToList()); }