public void ChangeDataContext(TextileInventoryHeader textileInventoryHeader, IEnumerable <TextileColorInventory> textileColorInventoryList) { InventoryListViewModel inventoryListViewModel = this.DataContext as InventoryListViewModel; inventoryListViewModel.TextileColorList = textileColorInventoryList; inventoryListViewModel.TextileInventoryHeader = textileInventoryHeader; inventoryListViewModel.Change(); }
public InventoryListDialog(string fileName, TextileInventoryHeader textileInventoryHeader, IEnumerable <TextileColorInventory> textileColorInventoryList) { InitializeComponent(); InventoryListViewModel = new InventoryListViewModel() { FileName = fileName, TextileColorList = textileColorInventoryList, TextileInventoryHeader = textileInventoryHeader }; this.DataContext = InventoryListViewModel; }
public TextileInventoryHeader GetShippingDate(ISheet sheet) { TextileInventoryHeader TextileInventoryHeader = new TextileInventoryHeader { ShippingDate1 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate1)), ShippingDate2 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate2)), ShippingDate3 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate3)), ShippingDate4 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate4)), ShippingDate5 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate5)), ShippingDate6 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate6)), ShippingDate7 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate7)), ShippingDate8 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate8)), ShippingDate9 = ExcelHelper.CheckExcelCellType <string>(CellType.String, sheet.GetRow(0).GetCell((int)ExcelEnum.ExcelInventoryColumnIndexEnum.ShippingDate9)) }; return(TextileInventoryHeader); }
private void CheckBox_Click(object sender, RoutedEventArgs e) { CheckBox checkBox = (CheckBox)sender; ExternalDataHelper externalDataHelper = new ExternalDataHelper(); TextileNameMappings = externalDataHelper.GetTextileNameMappings(); if (checkBox.IsChecked ?? false) { string fileNamePath = string.Concat(AppSettingConfig.FilePath(), "/", AppSettingConfig.StoreManageFileName()); Tuple <List <string>, IWorkbook> tuple = ExcelModule.GetExcelWorkbook(fileNamePath); TextileInventoryHeader textileInventoryHeader = ExcelModule.GetShippingDate(tuple.Item2.GetSheetAt(1)); Workbook = tuple.Item2; Window parentWindow = Window.GetWindow(this); var textileNameMapping = TextileNameMappings.ToList().Find(f => f.ProcessOrder.Contains(ProcessOrder == null ? string.Empty : ProcessOrder.Fabric)); List <TextileColorInventory> selectedTextiles = new List <TextileColorInventory>(); if (textileNameMapping != null) { ExcelHelper excelHelper = new ExcelHelper(); foreach (var item in textileNameMapping.Inventory) { selectedTextiles.AddRange(excelHelper.GetInventoryData(Workbook, item)); } textileInventoryHeader.Textile = ProcessOrder.Fabric; } InventoryListDialog = new InventoryListDialog(AppSettingConfig.StoreManageFileName(), textileInventoryHeader, selectedTextiles) { Owner = Window.GetWindow(this), Top = parentWindow.Top + parentWindow.Height, Left = parentWindow.Left, Height = 300 }; InventoryListDialog.Show(); InventoryListDialog.Closed += InventoryListDialog_Closed; InventoryUpdateTime.Content = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); } else { InventoryListDialog.Close(); } }
//private void OnComboBoxCustomerLoad() //{ // ComboBoxCustomer.Loaded += (ls, le) => // { // TextBox targetTextBox = ComboBoxCustomer?.Template.FindName("PART_EditableTextBox", ComboBoxCustomer) as TextBox; // if (targetTextBox == null) return; // ComboBoxCustomer.Tag = "TextInput"; // ComboBoxCustomer.StaysOpenOnEdit = true; // ComboBoxCustomer.IsEditable = true; // ComboBoxCustomer.IsTextSearchEnabled = false; // targetTextBox.TextChanged += (o, args) => // { // if (ComboBoxCustomer.Tag.ToString() == "Selection") // { // ComboBoxCustomer.Tag = "TextInput"; // ComboBoxCustomer.IsDropDownOpen = true; // } // else // { // TextBox textBox = (TextBox)o; // string searchText = textBox.Text; // if (ComboBoxCustomer.SelectionBoxItem != null) // { // //ComboBoxCustomer.SelectedItem = null; // targetTextBox.Text = searchText; // ComboBoxCustomer.IsDropDownOpen = true; // targetTextBox.SelectionStart = targetTextBox.Text.Length; // } // if (string.IsNullOrEmpty(searchText)) // { // ComboBoxCustomer.Items.Filter = item => true; // ComboBoxCustomer.SelectedItem = default(object); // } // else // { // ComboBoxCustomer.Items.Filter = item => // ((Customer)item).Name.Contains(searchText); // } // ComboBoxCustomer.IsDropDownOpen = true; // targetTextBox.SelectionStart = targetTextBox.Text.Length; // } // }; // ComboBoxCustomer.SelectionChanged += (o, args) => // { // ComboBox comboBox = o as ComboBox; // if (comboBox?.SelectedItem == null) return; // comboBox.Tag = "Selection"; // }; // }; //} #endregion private void DataGridProcessOrder_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataGrid dataGridProcessOrder = (DataGrid)sender; if (dataGridProcessOrder.SelectedIndex == -1) { return; } ProcessOrder = dataGridProcessOrder.SelectedItem as ProcessOrder; IEnumerable <ProcessOrderCustomerRelate> customerOrderRelate = ProcessModule.GetCustomerByOrderNo(ProcessOrder.OrderNo); DataGridCustomerOrder.ItemsSource = customerOrderRelate; TextRange remark = new TextRange(RichTextBoxProcessOrderRemark.Document.ContentStart, RichTextBoxProcessOrderRemark.Document.ContentEnd) { Text = ProcessOrder.Remark ?? "" }; UpdateDataGridOrderColorFactoryShippingDetail(ProcessOrder.OrderNo); DataGridFactoryShipping.ItemsSource = null; DataGridProcessOrderFlowDateDetail.ItemsSource = null; if (CheckboxDisplayInventory.IsChecked ?? false) { var textileNameMapping = TextileNameMappings.ToList().Find(f => f.ProcessOrder.Contains(ProcessOrder.Fabric)); if (textileNameMapping == null) { InventoryListDialog.ChangeDataContext(null, null); return; } ExcelHelper excelHelper = new ExcelHelper(); List <TextileColorInventory> selectedTextiles = new List <TextileColorInventory>(); foreach (var item in textileNameMapping.Inventory) { selectedTextiles.AddRange(excelHelper.GetInventoryData(Workbook, item)); } TextileInventoryHeader textileInventoryHeader = ExcelModule.GetShippingDate(Workbook.GetSheetAt(1)); textileInventoryHeader.Textile = ProcessOrder.Fabric; InventoryListDialog.ChangeDataContext(textileInventoryHeader, selectedTextiles); } }