/// <summary> /// Returns the import/export file filter for the specified ImportExportType. /// </summary> /// <param name="type">The ImportExportType</param> /// <returns>The respective file filter.</returns> public static string Filter(this ImportExportType type) { var filter = "STB Test Scenario Export File|*.stbs|All files (*.*)|*.*"; switch (type) { case ImportExportType.Document: filter = "STB Test Document Export File|*.stbd|All files (*.*)|*.*"; break; case ImportExportType.Printer: filter = "STB Print Device Export File|*.stbp|All files (*.*)|*.*"; break; case ImportExportType.Installer: filter = "STB Software Installer Export File|*.stbi|All files (*.*)|*.*"; break; case ImportExportType.Metadata: filter = "Plugin Data File|*.plugindata|All Files (*.*)|*.*"; break; } return(filter); }
/// <summary> /// Returns the import/export file extension for the specified ImportExportType. /// </summary> /// <param name="type">The ImportExportType.</param> /// <returns>The respective file extension.</returns> public static string Extension(this ImportExportType type) { var ext = "stbs"; switch (type) { case ImportExportType.Document: ext = "stbd"; break; case ImportExportType.Printer: ext = "stbp"; break; case ImportExportType.Installer: ext = "stbi"; break; case ImportExportType.Metadata: ext = "plugindata"; break; } return(ext); }
GDESettings() { ImportedLocalSpreadsheetName = EditorPrefs.GetString(WorkbookFilePathKey, string.Empty); ExportedLocalSpreadsheetName = string.Empty; ImportedGoogleSpreadsheetName = string.Empty; ExportedGoogleSpreadsheetPath = string.Empty; AccessTokenKey = string.Empty; RefreshTokenKey = string.Empty; AccessTokenTimeout = string.Empty; _dataFilePath = EditorPrefs.GetString(DataFileKey, DefaultDataFilePath); if (EditorGUIUtility.isProSkin) { CreateDataColor = EditorPrefs.GetString(CreateDataColorKey, GDEConstants.CreateDataColorPro); DefineDataColor = EditorPrefs.GetString(DefineDataColorKey, GDEConstants.DefineDataColorPro); } else { CreateDataColor = EditorPrefs.GetString(CreateDataColorKey, GDEConstants.CreateDataColor); DefineDataColor = EditorPrefs.GetString(DefineDataColor, GDEConstants.DefineDataColor); } HighlightColor = EditorPrefs.GetString(HighlightColorKey, GDEConstants.HighlightColor); ImportType = ImportExportType.None; ExportType = ImportExportType.None; ExportFileMD5 = string.Empty; // Delete the editor prefs keys if they exist if (EditorPrefs.HasKey(DataFileKey)) EditorPrefs.DeleteKey(DataFileKey); if (EditorPrefs.HasKey(ACCESS_TOKEN_KEY)) EditorPrefs.DeleteKey(ACCESS_TOKEN_KEY); if (EditorPrefs.HasKey(REFRESH_TOKEN_KEY)) EditorPrefs.DeleteKey(REFRESH_TOKEN_KEY); if (EditorPrefs.HasKey(ACCESS_TOKEN_TIMEOUT_KEY)) EditorPrefs.DeleteKey(ACCESS_TOKEN_TIMEOUT_KEY); if (EditorPrefs.HasKey(CreateDataColorKey)) EditorPrefs.DeleteKey(CreateDataColorKey); if (EditorPrefs.HasKey(DefineDataColorKey)) EditorPrefs.DeleteKey(DefineDataColorKey); if (EditorPrefs.HasKey(HighlightColorKey)) EditorPrefs.DeleteKey(HighlightColorKey); if (EditorPrefs.HasKey(WorkbookFilePathKey)) EditorPrefs.DeleteKey(WorkbookFilePathKey); }
public ExportOpenFileDialog(string directory, string title, ImportExportType type) { _dialog = new OpenFileDialog(); _dialog.DereferenceLinks = false; _dialog.AutoUpgradeEnabled = false; _dialog.Multiselect = false; _dialog.AddExtension = true; _dialog.CheckFileExists = false; _dialog.CheckPathExists = false; _dialog.DefaultExt = type.Extension(); _dialog.Filter = type.Filter(); _dialog.InitialDirectory = directory; _dialog.Title = title; _dialog.ShowHelp = false; }
/// <summary> /// /// </summary> /// <param name="directory">The default directory.</param> /// <param name="title">The title of the Save dialog.</param> /// <param name="type">The STF ImportExportType.</param> public ExportSaveFileDialog(string directory, string title, ImportExportType type = ImportExportType.Scenario) { _dialog = new SaveFileDialog() { DereferenceLinks = false, AutoUpgradeEnabled = false, AddExtension = true, CheckFileExists = false, CheckPathExists = false, DefaultExt = type.Extension(), Filter = type.Filter(), InitialDirectory = directory, Title = title, ShowHelp = false, }; }
/// <summary> /// 生成初次进入交互数据子项 /// </summary> /// <returns></returns> private string CreatePostData(ImportExportType 进出口类型, string 集装箱号) { // q_vessel=UN8100052%2F0303N&querychoice=bycontainerno&q_containerno=TGHU2702678 StringBuilder postData = new StringBuilder(); postData.Append("q_vessel=UN8100052%2F0303N&querychoice=bycontainerno"); if (!string.IsNullOrEmpty(集装箱号)) { postData.Append("&q_containerno=" + 集装箱号); } string s = postData.ToString(); return(s); }
public NhapXuatKho(ImportExportType type) { this.importExportType = type; this.storeType = type.name; InitializeComponent(); _storeDao = new StoreDAOImpl(); var allMaterialDtos = _storeDao.GetAllMaterial(); foreach (var materialDto in allMaterialDtos) { materialComboBox.Items.Add(materialDto); } txtStoreDate.Text = DateUtil.GetDateTimeAsDdmmyyyy(DateTime.Now); listStoreDto = new List <StoreDto>(); }
/// <summary> /// 通用查询() /// </summary> /// <returns></returns> public IList <集装箱数据> 集装箱进口综合查询(ImportExportType 进出口类型, string 集装箱号) { string jspcookie = Login(); string header; List <集装箱数据> totalBoxData = new List <集装箱数据>(); List <string> boxStringData = new List <string>(); // 第一页 string firstPostData = CreatePostData(进出口类型, 集装箱号); //string webContent = GetToString(m_集装箱进口综合查询url + "?" + firstPostData); string webContent = npedi.HtmlInfoBase.GetHtml(m_集装箱进口综合查询url, firstPostData, jspcookie, out header); boxStringData.AddRange(npedi.PageAnalyze.GetBoxData(webContent)); // NO. 船舶UN 航次 箱号 箱型 卸船时间 出门时间 铅封号 箱主 集卡 // 1 UN9253014 018E TGHU2702678 22GP 20071123010954 20071130210800 EMCWR32854 EMC ZJL-A1378 for (int i = 0; i < boxStringData.Count / 11; ++i) { DateTime jcsj = DateTime.ParseExact(boxStringData[9 * i + 5], "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture); DateTime txsj = DateTime.ParseExact(boxStringData[9 * i + 6], "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture); if (!string.IsNullOrEmpty(集装箱号) && 集装箱号 != boxStringData[9 * i + 3].Trim()) { continue; } totalBoxData.Add(new 集装箱数据(null, null, boxStringData[9 * i + 2].Trim(), boxStringData[9 * i + 3].Trim(), boxStringData[9 * i + 1].Trim(), jcsj, txsj, null, null, null, boxStringData[9 * i + 4].Trim())); } return(totalBoxData); }
public DialPlanImportExportArgs(ImportExportType pImportExportType, ImportExportFilter pImportExportFilter, string pFilePath, short pAccountId, string pAccountName, int pCallingPlanId, int pRoutingPlanId, ViewContext pContext, bool pPerMinute, DateTime pFrom, DateTime pTo) { ImportExportType = pImportExportType; AccountId = pAccountId; AccountName = pAccountName; CallingPlanId = pCallingPlanId; RoutingPlanId = pRoutingPlanId; ImportExportFilter = pImportExportFilter; FilePath = pFilePath; Context = pContext; PerMinute = pPerMinute; From = pFrom; To = pTo; }
GDESettings() { ImportedLocalSpreadsheetName = EditorPrefs.GetString(WorkbookFilePathKey, string.Empty); ExportedLocalSpreadsheetName = string.Empty; ImportedGoogleSpreadsheetName = string.Empty; ExportedGoogleSpreadsheetPath = string.Empty; AccessTokenKey = string.Empty; RefreshTokenKey = string.Empty; AccessTokenTimeout = string.Empty; _dataFilePath = EditorPrefs.GetString(DataFileKey, DefaultDataFilePath); if (EditorGUIUtility.isProSkin) { CreateDataColor = EditorPrefs.GetString(CreateDataColorKey, GDEConstants.CreateDataColorPro); DefineDataColor = EditorPrefs.GetString(DefineDataColorKey, GDEConstants.DefineDataColorPro); } else { CreateDataColor = EditorPrefs.GetString(CreateDataColorKey, GDEConstants.CreateDataColor); DefineDataColor = EditorPrefs.GetString(DefineDataColor, GDEConstants.DefineDataColor); } HighlightColor = EditorPrefs.GetString(HighlightColorKey, GDEConstants.HighlightColor); ImportType = ImportExportType.None; ExportType = ImportExportType.None; ExportFileMD5 = string.Empty; // Delete the editor prefs keys if they exist if (EditorPrefs.HasKey(DataFileKey)) { EditorPrefs.DeleteKey(DataFileKey); } if (EditorPrefs.HasKey(ACCESS_TOKEN_KEY)) { EditorPrefs.DeleteKey(ACCESS_TOKEN_KEY); } if (EditorPrefs.HasKey(REFRESH_TOKEN_KEY)) { EditorPrefs.DeleteKey(REFRESH_TOKEN_KEY); } if (EditorPrefs.HasKey(ACCESS_TOKEN_TIMEOUT_KEY)) { EditorPrefs.DeleteKey(ACCESS_TOKEN_TIMEOUT_KEY); } if (EditorPrefs.HasKey(CreateDataColorKey)) { EditorPrefs.DeleteKey(CreateDataColorKey); } if (EditorPrefs.HasKey(DefineDataColorKey)) { EditorPrefs.DeleteKey(DefineDataColorKey); } if (EditorPrefs.HasKey(HighlightColorKey)) { EditorPrefs.DeleteKey(HighlightColorKey); } if (EditorPrefs.HasKey(WorkbookFilePathKey)) { EditorPrefs.DeleteKey(WorkbookFilePathKey); } }
/// <summary> /// /// </summary> /// <param name="进出口标志"></param> /// <param name="箱号"></param> /// <returns></returns> public IList <集装箱数据> 查询集装箱数据通过箱号(ImportExportType 进出口标志, string 箱号) { return(Grab(进出口标志, null, null, null, 箱号, null, null, null, null)); }
public IList <集装箱数据> 查询集装箱数据(ImportExportType 进出口标志, string 提单号, string 航次) { return(Grab(进出口标志, null, null, 航次, null, null, null, null, 提单号)); }
/// <summary> /// 生成初次进入交互数据子项 /// </summary> /// <returns></returns> private string CreatePostData(ImportExportType 进出口类型, string 船名, string 船舶英文名称, string 航次, string 集装箱号, DateTime?进场时间起, DateTime?进场时间止, string 船舶UN代码, string 提单号) { StringBuilder postData = new StringBuilder(); if (!string.IsNullOrEmpty(提单号)) { postData.Append("BILL_NO=" + 提单号); } if (!string.IsNullOrEmpty(船名)) { postData.Append("&SHIP_NAME=" + 船名); } if (!string.IsNullOrEmpty(船舶英文名称)) { postData.Append("&SHIP_NAME_EN=" + 船舶英文名称); } if (!string.IsNullOrEmpty(航次)) { postData.Append("&FLIGHT_NO=" + 航次); } if (!string.IsNullOrEmpty(集装箱号)) { postData.Append("&JZX_NO=" + 集装箱号); } if (进场时间起.HasValue) { postData.Append("&JC_DATE_B=" + 进场时间起.Value.ToString("yyyy-MM-dd")); } if (进场时间止.HasValue) { postData.Append("&JC_DATE_E=" + 进场时间止.Value.ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(船舶UN代码)) { postData.Append("&SHIP_UN_NO=" + 船舶UN代码); } postData.Append("&button=%BF%AA%CA%BC%B2%E9%D1%AF"); switch (进出口类型) { case ImportExportType.出口集装箱: postData.Append("&IE_FLAG=" + "E"); break; case ImportExportType.进口集装箱: postData.Append("&IE_FLAG=" + "I"); break; default: throw new NotSupportedException("Invalid ImportExport Type"); } string s = postData.ToString(); if (s[0] == '&') { s = s.Remove(0, 1); } return(s); }
/// <summary> /// 通用查询() /// </summary> /// <returns></returns> public IList <集装箱数据> Grab(ImportExportType 进出口类型, string 船名, string 船舶英文名称, string 航次, string 集装箱号, DateTime?进场时间起, DateTime?进场时间止, string 船舶UN代码, string 提单号) { Login(); if (进场时间起.HasValue) { 进场时间起 = DateTimeHelper.GetDateTimeStartofDay(进场时间起.Value); } if (进场时间止.HasValue) { 进场时间止 = DateTimeHelper.GetDateTimeEndofDay(进场时间止.Value); } List <集装箱数据> totalBoxData = new List <集装箱数据>(); List <string> boxStringData = new List <string>(); string pageSource, boxSource; // 第一页 string firstPostData = CreatePostData(进出口类型, 船名, 船舶英文名称, 航次, 集装箱号, 进场时间起, 进场时间止, 船舶UN代码, 提单号); string webContent = PostToString(m_url, firstPostData); nbeport.PageAnalyze.SplitWebContent(webContent, out pageSource, out boxSource); if (pageSource == null || boxSource == null) { return(totalBoxData); } int totalPages = nbeport.PageAnalyze.GetPageCount(pageSource); int totalBoxs = nbeport.PageAnalyze.GetBoxCount(pageSource); boxStringData.AddRange(nbeport.PageAnalyze.GetBoxData(boxSource)); int needPage = (m_maxResult - 1) / m_resultPerPage + 1; if (totalPages > needPage) { m_incompleteBoxData = true; totalPages = needPage; } for (int page = 1; page < totalPages; page++) { System.Threading.Thread.Sleep(1000); string postData = CreateGotoPostData(page, firstPostData); webContent = PostToString(m_url, postData); nbeport.PageAnalyze.SplitWebContent(webContent, out pageSource, out boxSource); boxStringData.AddRange(nbeport.PageAnalyze.GetBoxData(boxSource)); } if (boxStringData.Count % 9 != 0) { throw new WebFormatChangedException("invalid box data count"); } System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("zh-CN"); for (int i = 0; i < boxStringData.Count / 9; ++i) { DateTime jcsj = DateTime.ParseExact(boxStringData[9 * i + 5], "yyyy年MM月dd日HH点mm分ss秒", culture); if (!string.IsNullOrEmpty(船名) && 船名 != boxStringData[9 * i].Trim()) { continue; } if (!string.IsNullOrEmpty(船舶英文名称) && 船舶英文名称 != boxStringData[9 * i + 1].Trim()) { continue; } if (!string.IsNullOrEmpty(航次) && 航次 != boxStringData[9 * i + 2].Trim()) { continue; } if (!string.IsNullOrEmpty(集装箱号) && 集装箱号 != boxStringData[9 * i + 3].Trim()) { continue; } if (!string.IsNullOrEmpty(船舶UN代码) && 船舶UN代码 != boxStringData[9 * i + 4].Trim()) { continue; } if (进场时间起 != null && jcsj < 进场时间起.Value) { continue; } if (进场时间止 != null && jcsj > 进场时间止.Value) { continue; } if (!string.IsNullOrEmpty(提单号) && 提单号 != boxStringData[9 * i + 7].Trim()) { continue; } totalBoxData.Add(new 集装箱数据(boxStringData[9 * i].Trim(), boxStringData[9 * i + 1].Trim(), boxStringData[9 * i + 2].Trim(), boxStringData[9 * i + 3].Trim(), boxStringData[9 * i + 4].Trim(), jcsj, null, boxStringData[9 * i + 6].Trim(), boxStringData[9 * i + 7].Trim(), boxStringData[9 * i + 8].Trim(), null)); } return(totalBoxData); }
/// <summary> /// 生成初次进入交互数据子项 /// </summary> /// <returns></returns> private string CreatePostData(ImportExportType 进出口类型, string 集装箱号) { // q_vessel=UN8100052%2F0303N&querychoice=bycontainerno&q_containerno=TGHU2702678 StringBuilder postData = new StringBuilder(); postData.Append("q_vessel=UN8100052%2F0303N&querychoice=bycontainerno"); if (!string.IsNullOrEmpty(集装箱号)) { postData.Append("&q_containerno=" + 集装箱号); } string s = postData.ToString(); return s; }
/// <summary> /// 通用查询() /// </summary> /// <returns></returns> public IList<集装箱数据> 集装箱进口综合查询(ImportExportType 进出口类型, string 集装箱号) { string jspcookie = Login(); string header; List<集装箱数据> totalBoxData = new List<集装箱数据>(); List<string> boxStringData = new List<string>(); // 第一页 string firstPostData = CreatePostData(进出口类型, 集装箱号); //string webContent = GetToString(m_集装箱进口综合查询url + "?" + firstPostData); string webContent = npedi.HtmlInfoBase.GetHtml(m_集装箱进口综合查询url, firstPostData, jspcookie, out header); boxStringData.AddRange(npedi.PageAnalyze.GetBoxData(webContent)); // NO. 船舶UN 航次 箱号 箱型 卸船时间 出门时间 铅封号 箱主 集卡 // 1 UN9253014 018E TGHU2702678 22GP 20071123010954 20071130210800 EMCWR32854 EMC ZJL-A1378 for (int i = 0; i < boxStringData.Count / 11; ++i) { DateTime jcsj = DateTime.ParseExact(boxStringData[9 * i + 5], "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture); DateTime txsj = DateTime.ParseExact(boxStringData[9 * i + 6], "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture); if (!string.IsNullOrEmpty(集装箱号) && 集装箱号 != boxStringData[9 * i + 3].Trim()) continue; totalBoxData.Add(new 集装箱数据(null, null, boxStringData[9 * i + 2].Trim(), boxStringData[9 * i + 3].Trim(), boxStringData[9 * i + 1].Trim(), jcsj, txsj, null, null, null, boxStringData[9 * i + 4].Trim())); } return totalBoxData; }