public void MassEdit() { if (SearchResul != null && SearchResul.Any()) { var editMass = new MassEditViewModel(type, (IEnumerable <object>)SearchResul); //var view = DataHelpers.container.Get<ViewManager>(); //var bind = view.CreateAndBindViewForModelIfNecessary(editMass); DataHelpers.windowManager.ShowWindow(editMass); } else { DataHelpers.ShowMessage(_("Filter les résultats d'abord")); return; } }
public async void ExporterPDF() { if (SearchResul?.Any() == true) { windowManager.ShowWindow(new PrintWindowViewModel(SearchResul)); } else { var response = MessageBox.Show("Voulez-vous exporter tous les documents?", "Confirmation", MessageBoxButton.YesNo); if (response == MessageBoxResult.Yes) { SearchResul = await datahelper.GetData <T>(a => true); windowManager.ShowWindow(new PrintWindowViewModel(SearchResul)); } } }
public async void ExporterPDF() { if (SearchResul?.Any() == true) { windowManager.ShowWindow(new PrintWindowViewModel(SearchResul)); } else { var response = DataHelpers.ShowMessage(_("Voulez-vous exporter tous les documents?"), _("Confirmation"), MessageBoxButton.YesNo); if (response == MessageBoxResult.Yes) { if (SaveVisible == false) { SearchResul = _list.ToList <T>(); windowManager.ShowWindow(new PrintWindowViewModel(SearchResul)); } else { SearchResul = DS.db.GetAll <T>();// await datahelper.GetData<T>(a => true); windowManager.ShowWindow(new PrintWindowViewModel(SearchResul)); } } } }
public override void Run() { var webDriver = GetWebDriver(Parameters.WebDriver); webDriver.Url = Parameters.ItemUrl; try { // ファイル読み込み List <string> lines = System.IO.File.ReadLines(_parameters.JanCodeFileName, Encoding.GetEncoding("shift-jis")).ToList(); // 情報取得 List <SearchResul> results = new List <SearchResul>(); foreach (var line in lines) { if (CancelToken.IsCancellationRequested) { return; } var result = new SearchResul(); results.Add(result); result.JanCode = line; try { // 検索実行 webDriver.FindElementById("q").SendKeys(line); webDriver.FindElementById("UPPER_SEARCH").Click(); var productName = webDriver.FindElementsById("DISP_GOODS_NM"); if (productName.Count == 0) { result.OnlineStock = "商品登録なし"; continue; } else { result.ProductName = productName.First().Text; } var stock = webDriver.FindElementsById("isStock"); if (0 < stock.Count) { result.OnlineStock = stock.First().Text; } else { result.OnlineStock = "-"; } var currentHandle = webDriver.CurrentWindowHandle; bool switchSuccess = false; string lastHandle = ""; try { // 店舗在庫取得 webDriver.FindElementById("StockSearchButton").Click(); lastHandle = webDriver.WindowHandles.Last(); webDriver.SwitchTo().Window(lastHandle); switchSuccess = true; int existCount = _exist.Matches(webDriver.PageSource).Count; int lessExistCount = _lessExist.Matches(webDriver.PageSource).Count; result.StoreStockCount = existCount; result.StoreLessStockCount = lessExistCount; } catch (Exception) { throw; } finally { if (switchSuccess) { webDriver.Close(); } webDriver.SwitchTo().Window(currentHandle); } } catch (Exception ex) { ReportStatus(EC_SITE, ex.ToString(), ReportState.Warning); } } // ファイル出力 StringBuilder sb = new StringBuilder(); sb.AppendLine("JANコード,商品名,オンライン在庫,店舗在庫あり数,店舗在庫わずか数"); foreach (var result in results) { sb.AppendLine($"{result.JanCode},{result.ProductName},{result.OnlineStock},{result.StoreStockCount},{result.StoreLessStockCount}"); } if (0 < results.Count) { System.IO.File.WriteAllText(_parameters.OutputFilePath, sb.ToString()); } ReportStatus(EC_SITE, "終了", ReportState.Information); } catch (Exception ex) { ReportStatus(EC_SITE, ex.ToString(), ReportState.Exception); } finally { webDriver.Quit(); } }