public void PostDataToWebApi() { DataMatrixInfo dataInfoForWebApi = new DataMatrixInfo() { AccessOrderInProductBatch = 2, ExpectedDataMatrixCenter = new Coordinate() { XAxis = 3, YAxis = 4 }, ActualDataMatrixCenter = new Coordinate() { XAxis = 3.001, YAxis = 4.001 }, ExpectedDataMatrixSize = new DataMatrixSize() { Width = 5, Height = 5 }, ActualDataMatrixSize = new DataMatrixSize() { Width = 5.001, Height = 5.002 }, ActualDifferenceOfDataMatrixSize = new DataMatrixSize() { Width = 0.001, Height = 0.002 }, ActualOffsetOfDataMatrixCenter = new Coordinate() { XAxis = 0.001, YAxis = 0.001 }, AllowedDifferenceOfDataMatrixSize = new DataMatrixSize() { Width = 0.002, Height = 0.003 }, AllowedOffsetOfDataMatrixCenter = new Coordinate() { XAxis = 0.002, YAxis = 0.004 }, CodeOfDataMatrix = "TestCode", SucessOfDataMatrixInspection = true }; string dataInfoJson = JsonConvert.SerializeObject(dataInfoForWebApi); string url = ConfigurationManager.AppSettings["apiUrl"]; DataMatrixInfoWebApiDataModel dataMatrixWebApi = new DataMatrixInfoWebApiDataModel(url); AddDataMatrixInfoResponse response = dataMatrixWebApi.Add(dataInfoForWebApi); Assert.IsTrue(response.Success); Assert.AreEqual("Got it", response.Message); }
public AddDataMatrixInfoResponse Add(DataMatrixInfo data) { try { string dataInfoJson = JsonConvert.SerializeObject(data); HttpClientManager httpClientConnector = new HttpClientManager(); string responseJsonFromWebApi = httpClientConnector.Post(url, "/DataMatrixInfo/Add", dataInfoJson); AddDataMatrixInfoResponse response = JsonConvert.DeserializeObject <AddDataMatrixInfoResponse>(responseJsonFromWebApi); return(response); } catch (Exception ex) { AddDataMatrixInfoResponse response = new AddDataMatrixInfoResponse() { Message = ex.Message, Success = false }; return(response); } }
/// <summary> /// Class constructor /// </summary> /// <param name="dataMatrixName">Datamatrix name</param> /// <param name="dataMatrixStruct">Datamatrix struct</param> public DBInteraction(string dataMatrixName, DataMatrixInfo dataMatrixStruct) { this.connectionString = dataMatrixStruct.database.odbcConnectionString; this.dataMatrixName = dataMatrixName; this.connection = this.GetConnection(); }
public override DataMatrixInfo getDataMatrixInfo(Ice.Current __current) { DatabaseInfo databaseInfo = this.GetDatabaseFunctionsPrx().getDatabaseInfo(); DataMatrixInfo result = new DataMatrixInfo(); result.database = databaseInfo; result.dataMatrixName = DataMatrixName; result.recordsCount = RecordsCount; result.primaryKeyColumns = PrimaryKeyColumns; result.explainDataMatrix = explain(); return result; }
/// <summary> /// Class constructor /// </summary> /// <param name="localePrefs">Localeprefs</param> /// <param name="dataMatrix">Datamatrix</param> /// <param name="dataMatrixInfo">Datamatrix info</param> public ExplainTable(string[] localePrefs, ColumnSchemaInfo[] dataMatrix, DataMatrixInfo dataMatrixInfo, IOwnerOfAddIn ownerOfAddIn) { //setting the ResManager resource manager and localization string string locale; try { locale = localePrefs[0]; localizationString = locale; locale = "Ferda.FrontEnd.AddIns.ExplainTable.Localization_" + locale; resManager = new ResourceManager(locale, Assembly.GetExecutingAssembly()); } catch { resManager = new ResourceManager("Ferda.FrontEnd.AddIns.ExplainTable.Localization_en-US", Assembly.GetExecutingAssembly()); localizationString = "en-US"; } this.ownerOfAddIn = ownerOfAddIn; comparer.column = 0; this.dataMatrix = dataMatrix; this.dataMatrixInfo = dataMatrixInfo; InitializeComponent(); this.ListViewInit(); this.MakeListView(); this.ToolStripMenuItemCopyAll.Click += new EventHandler(ToolStripMenuItemCopyAll_Click); this.ToolStripMenuItemCopySelected.Click += new EventHandler(ToolStripMenuItemCopySelected_Click); }
/// <summary> /// Returns a string with extended barcode info. /// </summary> /// <param name="barcodeInfo">A barcode info.</param> /// <param name="textEncodingName">A text encoding name.</param> /// <returns> /// A string with extended barcode info. /// </returns> internal string GetExtendedBarcodeInfoString(IBarcodeInfo barcodeInfo, string textEncodingName) { // if barcode info is empty if (barcodeInfo == null) { return(string.Empty); } IBarcodeInfo info; if (barcodeInfo is BarcodeSubsetInfo) { info = ((BarcodeSubsetInfo)barcodeInfo).BaseBarcodeInfo; } else { info = barcodeInfo; } StringBuilder extendedInfo = new StringBuilder(); // append barcode value try { extendedInfo.AppendLine(Utils.GetEncodedBarcodeValue(barcodeInfo, textEncodingName)); } catch (NotSupportedException) { extendedInfo.AppendLine(Utils.GetEncodedBarcodeValue(barcodeInfo, "-1")); } extendedInfo.AppendLine(); extendedInfo.AppendLine(Resources.GetString(Resource.String.metadata_message)); extendedInfo.AppendLine(); // if barcode is 2D barcode if (info is BarcodeInfo2D) { // get 2D barcode info BarcodeInfo2D info2D = (BarcodeInfo2D)info; // get matrix size extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.matrix_size_message), info2D.MatrixWidth, info2D.MatrixHeight)); // get cell size extendedInfo.AppendLine(string.Format(CultureInfo.InvariantCulture, Resources.GetString(Resource.String.cell_size_message), info2D.CellWidth, info2D.CellHeight)); if (info2D.IsMirrored) { extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.mirrored_message), info2D.IsMirrored)); } } // if barcode is 1D barcode if (info is BarcodeInfo1D) { // get 1D barcode info BarcodeInfo1D info1D = (BarcodeInfo1D)info; // get narrow bar count extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.narrow_bar_count_message), info1D.NarrowBarCount)); // get narrow bar size extendedInfo.AppendLine(string.Format(CultureInfo.InvariantCulture, Resources.GetString(Resource.String.narrow_bar_size_message), info1D.NarrowBarSize)); } if (info.SymbolComponents != null) { extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_component_count_message), info.SymbolComponents.Length)); } if (info is StructuredAppendBarcodeInfo) { extendedInfo.AppendLine(Resources.GetString(Resource.String.reconstructed_message)); } else { switch (info.BarcodeType) { // if barcode is PDF417 case BarcodeType.PDF417: case BarcodeType.PDF417Compact: // get PDF417 barcode info PDF417Info pdf417Info = (PDF417Info)info; // get rows count extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.rows_count_message), pdf417Info.RowsCount)); // get error correction level extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.error_correction_level_message), Utils.PDF417ErrorCorrectionLevelToString(pdf417Info.ErrorCorrectionLevel))); break; // if barcode is MicroPDF417 case BarcodeType.MicroPDF417: // get MicroPDF417 barcode info MicroPDF417Info microPdf417Info = (MicroPDF417Info)info; // get symbol type extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_type_message), Utils.MicroPDF417SymbolTypeToString(microPdf417Info.SymbolType))); break; // if barcode if DataMatrix case BarcodeType.DataMatrix: // get DataMatrix barcode info DataMatrixInfo dataMatrixInfo = (DataMatrixInfo)info; // get symbol type extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_type_message), Utils.DataMatrixSymbolTypeToString(dataMatrixInfo.Symbol.SymbolType))); break; // if barcode is QR case BarcodeType.MicroQR: case BarcodeType.QR: // get QR barcode info QRInfo qrInfo = (QRInfo)info; // get symbol version extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_version_message), Utils.QRSymbolVersionToString(qrInfo.Symbol.Version))); // get error correction level extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.error_correction_level_message), Utils.QRErrorCorrectionLevelToString(qrInfo.ErrorCorrectionLevel))); break; // if barcode is Aztec case BarcodeType.Aztec: // get Aztec barcode info AztecInfo aztecInfo = (AztecInfo)info; // get symbol type extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_type_message), Utils.AztecSymbolTypeToString(aztecInfo.Symbol.SymbolType))); // get data layers extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.data_layers_message), aztecInfo.Symbol.DataLayers)); // get error correction data extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.error_correction_data_message), aztecInfo.Symbol.ErrorCorrectionData.ToString("F3"))); break; // if barcode is HanXin case BarcodeType.HanXinCode: // get HanXin barcode info HanXinCodeInfo hanXinInfo = (HanXinCodeInfo)info; // get symbol version extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.symbol_version_message), Utils.HanXinCodeSymbolVersionToString(hanXinInfo.Symbol.Version))); // get error correction level extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.error_correction_level_message), Utils.HanXinCodeErrorCorrectionLevelToString(hanXinInfo.Symbol.ErrorCorrectionLevel))); break; // if barcode is MaxiCode case BarcodeType.MaxiCode: // get MaxiCode barcode info MaxiCodeInfo maxiCodeInfo = (MaxiCodeInfo)info; // get encoding mode extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.encoding_mode_message), Utils.MaxiCodeEncodingModeToString(maxiCodeInfo.EncodingMode))); break; // if barcode is RSS14 case BarcodeType.RSS14: case BarcodeType.RSS14Stacked: case BarcodeType.RSSExpanded: case BarcodeType.RSSExpandedStacked: case BarcodeType.RSSLimited: // get RSS barcode info RSSInfo rssInfo = (RSSInfo)info; // get segments count extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.segments_count_message), rssInfo.SegmentsCount)); // get rows count extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.rows_count_message), rssInfo.RowsCount)); // get segments in row extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.segments_in_row_message), rssInfo.SegmentsInRow)); // get linkage flag extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.linkage_flag_message), rssInfo.LinkageFlag)); break; // if barcode is UPCE case BarcodeType.UPCE: // get UPCE barcode info UPCEANInfo upcEANInfo = (UPCEANInfo)info; // get UPCE value extendedInfo.AppendLine(string.Format(Resources.GetString(Resource.String.upce_value_message), upcEANInfo.UPCEValue)); break; } } extendedInfo.AppendLine(string.Format(CultureInfo.InvariantCulture, Resources.GetString(Resource.String.recognition_quality_message), info.ReadingQuality)); return(extendedInfo.ToString()); }
protected StatisticsInfo getStatisticsStruct(DataMatrixInfo dataMatrixInfo) { return statisticsInfoCached.Value(boxModule.StringIceIdentity, dataMatrixInfo.database.lastReloadInfo, dataMatrixInfo.database.odbcConnectionString, dataMatrixInfo.dataMatrixName, dataMatrixInfo.recordsCount, ColumnSelectExpression, ColumnValueSubType); }
protected ValueSubTypeEnum getColumnValueSubType(DataMatrixInfo dataMatrixInfo) { return valueSubTypeCached.Value(boxModule.StringIceIdentity, dataMatrixInfo.database.lastReloadInfo, dataMatrixInfo.database.odbcConnectionString, dataMatrixInfo.dataMatrixName, ColumnSelectExpression, true); }