private void ComboBoxSelectionChangedExecute() { string priviousTextile = SelectedTextile; TextileColorList = null; TextileList = null; RaisePropertyChanged("TextileColorList"); RaisePropertyChanged("TextileList"); List <string> textileList = new List <string>(); if (!_workbookDictionary.TryGetValue(FileName, out IWorkbook dictionaryWorkbook)) { string fileNamePath = string.Concat(AppSettingConfig.InventoryHistoryRecordFilePath(), "/", FileName); Tuple <List <string>, IWorkbook> tuple = ExcelModule.GetExcelWorkbook(fileNamePath); TextileList = tuple.Item1; GetShippingDate(tuple.Item2.GetSheetAt(1)); _workbookDictionary.Add(FileName, tuple.Item2); } else { for (int sheetCount = 1; sheetCount < dictionaryWorkbook.NumberOfSheets; sheetCount++) { ISheet sheet = dictionaryWorkbook.GetSheetAt(sheetCount); //獲取第i個工作表 textileList.Add(sheet.SheetName); } TextileList = textileList; GetShippingDate(dictionaryWorkbook.GetSheetAt(1)); } RaisePropertyChanged("TextileList"); SelectedTextile = priviousTextile; RaisePropertyChanged("SelectedTextile"); }
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(); } }