/// <summary> /// CSV出力データ取得 /// </summary> /// <returns>取得処理成否</returns> /// <remarks> /// 作成者 : sesaki /// 作成日 : 2019/11/28 /// </remarks> public bool GetCsvData() { // 出力条件が正しければCSVデータ取得 if (Condition.ValidateOutput() == false) { return(false); } DataSet dtSet = null; DataBase dataBase = null; try { List <object> paraList = new List <object>(); // 得意先:東罐興業 if (GurabiaCustomer.IsTokan(Condition.Customer)) { string queryStr = QueryBuild.GetGurabiaCsvTokan(Condition, ref paraList); dataBase = new DataBase(); dataBase.ConnectDB(); dtSet = dataBase.GetDataSet(queryStr, paraList.ToArray()); // クエリ実行 DataTable table = dtSet.Tables[0]; CsvData = Utilities.DataTableToCsv(table); dataBase.DisconnectDB(); CsvName = Utilities.GetCsvFileName(Resources.TextResource.ProgressGurabiaTokan); return(true); } // 得意先:東洋製罐 else { string queryStr = QueryBuild.GetGurabiaCsvToyo(Condition, ref paraList); dataBase = new DataBase(); dataBase.ConnectDB(); dtSet = dataBase.GetDataSet(queryStr, paraList.ToArray()); // クエリ実行 DataTable table = dtSet.Tables[0]; CsvData = Utilities.DataTableToCsv(table); dataBase.DisconnectDB(); CsvName = Utilities.GetCsvFileName(Resources.TextResource.ProgressGurabiaToyo); return(true); } } catch (Exception ex) { CsvErrorMessage = Resources.TextResource.ErrorOutputCsv; return(false); } finally { if (dataBase != null) { dataBase.DisconnectDB(); } if (dtSet != null) { dtSet.Dispose(); } } }