public NewProcessOrderColorDetaiDialog(ProcessOrder processOrder, ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail) { InitializeComponent(); LabelOrderString.Content = processOrder.OrderString; LabelFabric.Content = processOrder.Fabric; TextBoxColor.Text = processOrderColorFactoryShippingDetail.Color; TextBoxColorNumber.Text = processOrderColorFactoryShippingDetail.ColorNumber; _processOrder = processOrder; }
private void ButtonDeleteFactoryShippingDetail_Click(object sender, RoutedEventArgs e) { ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail = DataGridOrderColorFactoryShippingDetail.SelectedItem as ProcessOrderColorFactoryShippingDetail; if (MessageBox.Show(string.Concat("是否刪除'", processOrderColorFactoryShippingDetail.Color, "'??"), "刪除", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { int count = ProcessModule.DeleteFactoryShippingDetail(processOrderColorFactoryShippingDetail.OrderColorDetailNo); UpdateDataGridOrderColorFactoryShippingDetail(processOrderColorFactoryShippingDetail.OrderNo); } }
private void DataGridFactoryShippingDetail_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.EditAction == DataGridEditAction.Cancel) { return; } if (e.Column.SortMemberPath == "Quantity") { TextBox editTextBox = e.EditingElement as TextBox; int quantity = editTextBox.Text.ToInt(); ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail = e.Row.Item as ProcessOrderColorFactoryShippingDetail; int orderColorDetailNo = processOrderColorFactoryShippingDetail.OrderColorDetailNo; MessageBoxResult mr = MessageBox.Show(string.Concat("是否將疋數'", processOrderColorFactoryShippingDetail.Quantity, "'改為'", quantity, "'?"), "修改確認", MessageBoxButton.YesNo); if (mr == MessageBoxResult.Yes) { int count = ProcessModule.UpdateProcessOrderColorDetailQuantity(orderColorDetailNo, quantity); } else { DataGridOrderColorFactoryShippingDetail.CancelEdit(); } } else if (e.Column.SortMemberPath == "Color") { TextBox editTextBox = e.EditingElement as TextBox; string color = editTextBox.Text; ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail = e.Row.Item as ProcessOrderColorFactoryShippingDetail; int orderColorDetailNo = processOrderColorFactoryShippingDetail.OrderColorDetailNo; MessageBoxResult mr = MessageBox.Show(string.Concat("是否將顏色'", processOrderColorFactoryShippingDetail.Color, "'改為'", color, "'?"), "修改確認", MessageBoxButton.YesNo); if (mr == MessageBoxResult.Yes) { int count = ProcessModule.UpdateProcessOrderColorDetailColor(orderColorDetailNo, color); } else { DataGridOrderColorFactoryShippingDetail.CancelEdit(); } } else if (e.Column.SortMemberPath == "ColorNumber") { TextBox editTextBox = e.EditingElement as TextBox; string colorNumber = editTextBox.Text; ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail = e.Row.Item as ProcessOrderColorFactoryShippingDetail; int orderColorDetailNo = processOrderColorFactoryShippingDetail.OrderColorDetailNo; MessageBoxResult mr = MessageBox.Show(string.Concat("是否將色號'", processOrderColorFactoryShippingDetail.ColorNumber, "'改為'", colorNumber, "'?"), "修改確認", MessageBoxButton.YesNo); if (mr == MessageBoxResult.Yes) { int count = ProcessModule.UpdateProcessOrderColorDetailColorNumber(orderColorDetailNo, colorNumber); } else { DataGridOrderColorFactoryShippingDetail.CancelEdit(); } } }
private void ButtonNewColor_Click(object sender, RoutedEventArgs e) { if (DataGridProcessOrder.SelectedIndex == -1) { MessageBox.Show("請選擇一筆訂單!!"); return; } ProcessOrderColorFactoryShippingDetail processOrderColorFactoryShippingDetail = DataGridOrderColorFactoryShippingDetail.SelectedItem as ProcessOrderColorFactoryShippingDetail ?? new ProcessOrderColorFactoryShippingDetail(); NewProcessOrderColorDetaiDialog dialog = new NewProcessOrderColorDetaiDialog(ProcessOrder, processOrderColorFactoryShippingDetail) { DataContext = this }; dialog.Show(); }
private void DataGridOrderColorFactoryShippingDetail_LoadingRow(object sender, DataGridRowEventArgs e) { DataGridRow row = e.Row; ProcessOrderColorFactoryShippingDetail item = (ProcessOrderColorFactoryShippingDetail)row.Item; if (item.Status == ProcessOrderColorStatus.已出完) { row.Background = Brushes.Gray; } else if (item.Status == ProcessOrderColorStatus.已完成) { row.Background = Brushes.Pink; } else { row.Background = Brushes.White; } }
private void ButtonNewFactoryShipping_Click(object sender, RoutedEventArgs e) { if (DataGridOrderColorFactoryShippingDetail.SelectedIndex == -1) { MessageBox.Show("未選擇出貨顏色!!"); return; } if (string.IsNullOrEmpty(TextBoxQuantity.Text)) { MessageBox.Show("未輸入出貨數量!!"); return; } if (ComboBoxCustomer.SelectedIndex == -1) { MessageBox.Show("未選擇客戶!!"); return; } ProcessOrderColorFactoryShippingDetail processOrderColorDetail = (ProcessOrderColorFactoryShippingDetail)DataGridOrderColorFactoryShippingDetail.SelectedItem; Customer customer = ComboBoxCustomer.SelectedItem as Customer; FactoryShippingName factoryShipping = new FactoryShippingName { OrderColorDetailNo = processOrderColorDetail.OrderColorDetailNo, CustomerID = customer.CustomerID, Quantity = TextBoxQuantity.Text.ToInt(), CreateDate = DateTime.Now, ShippingDate = DatePickerShippingDate.SelectedDate }; int count = ProcessModule.InsertFactoryShipping(factoryShipping); if (processOrderColorDetail.ShippingQuantity + factoryShipping.Quantity == processOrderColorDetail.Quantity) { ProcessModule.UpdateProcessOrderColorStatus(processOrderColorDetail.OrderColorDetailNo, ProcessOrderColorStatus.已出完); } IEnumerable <FactoryShippingName> factoryShippingList = ProcessModule.GetFactoryShipping(processOrderColorDetail.OrderColorDetailNo); DataGridFactoryShipping.ItemsSource = factoryShippingList; UpdateDataGridOrderColorFactoryShippingDetail(processOrderColorDetail.OrderNo); }