Exemplo n.º 1
0
        public async Task TestFindWildcard()
        {
            Login();
            fms.SetLayout("FRUIT_utility");
            var find    = fms.FindRequest();
            var request = find.SearchCriterium();

            request.AddFieldSearch("country", "*");
            var getFindResponse = await find.Execute();

            Logout();

            // default search with no other criteria returns 100 records
            Assert.True(getFindResponse.ErrorCode == 0 && getFindResponse.returnedRecordCount == 100);
        }
Exemplo n.º 2
0
        private async Task PopulateData(int itemRecordId, int productRecordId)
        {
            var productPortalAndRecordId = await GetProductGraphicsPortalAndRecordID(Convert.ToInt32(productRecordId));             //getting portal data

            var graphicsPortalData = productPortalAndRecordId.GraphicsPortalData;
            var productRecordID    = productPortalAndRecordId.RecordID;

            fmServer.SetLayout(itemLayout);
            var getItemBySearchFields = fmServer.FindRequest();
            var searchFields          = getItemBySearchFields.SearchCriterium();

            searchFields.AddFieldSearch("specs_PRODUCTS::RecordID", productRecordID);                                           // to apply search for 9 images, had to apply searchFields
            searchFields.AddFieldSearch("ProjectRecordID", projectRecordId);
            getItemBySearchFields.AddPortal("Spec_to_Graphics", 9);
            RecordsGetResponse getItemSearchFieldsResponse = await getItemBySearchFields.Execute();

            var itemGraphicsPortalData = getItemSearchFieldsResponse.data.foundSet.records.First().relatedRecordSets.First().records;

            var itemDetails = getItemSearchFieldsResponse.data.foundSet.records.First().fieldsAndData;

            lblItemNumber.Text = itemDetails["ItemNumber"];
            lblItemName.Text   = itemDetails["ItemName"];

            for (int i = 0; i < 9; i++)                                                                         // this loop displays images, set ids to be able to create and edit a image on button click
            {
                var currentButton = GetCurrentButton(i);

                if (i < itemGraphicsPortalData.Count())
                {
                    try
                    {
                        var currentRow = itemGraphicsPortalData.ElementAt(i);
                        fmServer.SetLayout(graphicLayout);
                        var graphicImageId    = currentRow.fieldsAndData["GraphicImage_ID"];
                        var getGraphicRequest = fmServer.FindRequest();
                        searchFields = getGraphicRequest.SearchCriterium();
                        searchFields.AddFieldSearch("ImageRecordID", graphicImageId);
                        var getGraphicResponse = await getGraphicRequest.Execute();

                        var          graphicRecordId = getGraphicResponse.data.foundSet.records.First().recordId;
                        var          file            = getGraphicResponse.data.foundSet.records.First().fieldsAndData["File"];
                        WebClient    client          = new WebClient();
                        byte[]       bytes           = client.DownloadData(file);
                        MemoryStream ms = new MemoryStream(bytes);
                        currentButton.Tag                   = $"{graphicRecordId}, {productRecordId}";                          // sets tag to be used later to edit,create image
                        currentButton.BackgroundImage       = Image.FromStream(ms);
                        currentButton.BackgroundImageLayout = ImageLayout.Stretch;
                    }
                    catch (Exception ex)
                    {
                        currentButton.Tag             = $", {productRecordId}";
                        currentButton.BackgroundImage = ResizedSelectImage();
                        MessageBox.Show($"Error: {ex.Message}");
                    }
                }
                else
                {
                    currentButton.Tag             = $", {productRecordId}";
                    currentButton.BackgroundImage = ResizedSelectImage();
                }
            }
        }