Esempio n. 1
0
        private List <StateInfoEntities> GetStateList()
        {
            List <StateInfoEntities> stateInfoEntities = null;
            ServiceInputObject       serviceObject     = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "State",
                methodName     = "GetAllStates",
            };

            stateInfoEntities = ServiceMethods.GenerateGatRequest <List <StateInfoEntities> >(serviceObject);

            return(stateInfoEntities);
        }
Esempio n. 2
0
        public int AddNewFarmerDetail(string farmerDetailString)
        {
            FarmerDetailEntities FarmerDetail       = JsonConvert.DeserializeObject <FarmerDetailEntities>(farmerDetailString);
            ServiceInputObject   serviceInputObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "FarmerDetail",
                parameterValue = string.Empty
            };

            FarmerDetail = ServiceMethods.GeneratePostRequest <FarmerDetailEntities>(FarmerDetail, serviceInputObject);

            return(FarmerDetail.Id);
        }
        public void UpdateFAdetail(string faDetailJsonString)
        {
            FAdetailModel      model = JsonConvert.DeserializeObject <FAdetailModel>(faDetailJsonString);
            ServiceInputObject serviceInputsForDocType = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "FAdetail",
                methodName     = "UpdateFAdetailById"
            };

            model.faDetailEntities.UpdatedBy   = SessionManager.UserId;
            model.faDetailEntities.LastUpdated = DateTime.Now;
            int returnValue = ServiceMethods.GeneratePutRequestIntDestinationEntity <FAdetailEntities>(model.faDetailEntities, serviceInputsForDocType);
        }
Esempio n. 4
0
        // генерация препятствий
        private void GenerationObstacles(Transform parent)
        {
            var trigger   = Instantiate(triggerPrefab);
            var collision = false; // обнаружение столкновений

            for (int i = 0; i < maxNumberObstacles; i++)
            {
                // относительно размера игрового поля, +1 для проходов
                trigger.transform.localScale    = new Vector2(Random.Range(1.0f, ServiceMethods.PercentNumber(10, sizeZone.x)) + 1, Random.Range(1.0f, ServiceMethods.PercentNumber(20, sizeZone.y)) + 1);
                trigger.transform.localRotation = Quaternion.Euler(0, 0, Random.Range(0, 90));
                // размер относительно игрового поля с отступами т.е: (+-ширинаХ / 2) +- (ширинаБлокаХ / 2 (т.к pivot в центре)) +- ширинаБлокаХ / 4 (чтобы при вращении не выходить за края)
                trigger.transform.localPosition = new Vector3(
                    Random.Range(-sizeZone.x / 2 + trigger.transform.localScale.x / 2 + trigger.transform.localScale.x / 4, sizeZone.x / 2 - trigger.transform.localScale.x / 2 - trigger.transform.localScale.x / 4),
                    Random.Range(-sizeZone.y / 2 + trigger.transform.localScale.y / 2 + trigger.transform.localScale.y / 4, sizeZone.y / 2 - trigger.transform.localScale.y / 2 - trigger.transform.localScale.y / 4), -1);
                // расчет столкновения
                for (int j = 0; j < createdObjects.Count; j++)
                {
                    if (ServiceMethods.IsСollision2D(createdObjects[j].transform, trigger.transform))
                    {
                        collision = true;
                        break;
                    }
                }
                // создание объекта
                if (!collision)
                {
                    var newObstacle = Instantiate(squarePrefab, trigger.transform.position, trigger.transform.rotation);
                    newObstacle.transform.localScale = new Vector2(trigger.transform.localScale.x - 1, trigger.transform.localScale.y - 1);
                    if (colorsObstacles.Length > 0)
                    {
                        newObstacle.GetComponent <SpriteRenderer>().color = colorsObstacles[Random.Range(0, colorsObstacles.Length)];
                    }
                    createdObjects.Add(newObstacle);
                    newObstacle.tag   = "Obstacle";
                    newObstacle.name  = "Obstacle_" + createdObjects.Count;
                    newObstacle.layer = 8; // FireDirection
                }
                collision = false;
            }
            // если есть препятствия
            if (createdObjects.Count > 0)
            {
                foreach (var item in createdObjects)
                {
                    item.transform.SetParent(parent);
                }
            }
            Destroy(trigger); // удаляем лишний триггер
        }
        public ActionResult GetPocketByDistrictId(string districtId)
        {
            districtId = Convert.ToString(JsonConvert.DeserializeObject <int>(districtId));
            ServiceInputObject serviceObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Pocket",
                methodName     = "GetActivePocketsByDistrictId",
                parameterValue = districtId
            };
            List <PocketInfoEntities> pocketIfo  = ServiceMethods.GenerateGatRequest <List <PocketInfoEntities> >(serviceObject);
            List <SelectListItem>     pocketList = CommonOperations.BindDropdwon <PocketInfoEntities>(pocketIfo, "PocketID", "PocketName");

            return(Json(pocketList));
        }
Esempio n. 6
0
        public ActionResult GetDistrictByStateId(string stateId)
        {
            stateId = Convert.ToString(JsonConvert.DeserializeObject <int>(stateId));
            ServiceInputObject serviceObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "District",
                methodName     = "GetDistrictOfState",
                parameterValue = stateId
            };
            List <DistrictInfoEntities> districtInfo = ServiceMethods.GenerateGatRequest <List <DistrictInfoEntities> >(serviceObject);
            List <SelectListItem>       districtList = CommonOperations.BindDropdwon <DistrictInfoEntities>(districtInfo, "DistID", "DistrictName");

            return(Json(districtList));
        }
        public ActionResult FADetail()
        {
            ServiceInputObject serviceInputsForDocType = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "FAdetail",
                methodName     = "GetAllFAdetailEntities"
            };
            List <FAdetailEntities> faDetailList = new List <FAdetailEntities>();

            faDetailList = ServiceMethods.GenerateGatRequest <List <FAdetailEntities> >(serviceInputsForDocType);

            //TODO: Change experience Dropdown to default yes
            return(View(faDetailList));
        }
        protected KeyValuePair <bool, string> CompareWorkpieceWithWorkpieceFromGrid(WorkpieceGridRecord workpieceToCheck, Workpiece wpExpected)
        {
            if (workpieceToCheck != null && wpExpected != null)
            {
                string        errorMessage = string.Empty;
                List <string> errorLines   = new List <string>();
                bool          valid        = workpieceToCheck.Id.Equals(wpExpected.ExternalWorkpieceId) &&
                                             workpieceToCheck.Name.Equals(wpExpected.Name) &&
                                             workpieceToCheck.Quantity.Equals(wpExpected.Quantity.ToString());

                if (!Parameters.Parameters.Browser.Equals("MicrosoftEdge"))
                {
                    valid = valid && workpieceToCheck.DeliveryDate.Equals(
                        wpExpected.DeliveryDate.ToString("MM/dd/yyyy"));
                }

                if (!valid)
                {
                    if (!workpieceToCheck.Id.Equals(wpExpected.ExternalWorkpieceId))
                    {
                        errorLines.Add($"Workpiece Id: expected '{wpExpected.ExternalWorkpieceId}', actual '{workpieceToCheck.Id}'");
                    }

                    if (!workpieceToCheck.DeliveryDate.Equals(wpExpected.DeliveryDate.ToString("MM/dd/yyyy")))
                    {
                        errorLines.Add($"Workpiece Delivery date: expected '{ wpExpected.DeliveryDate.ToString("MM/dd/yyyy")}', actual '{workpieceToCheck.DeliveryDate}'");
                    }

                    if (!workpieceToCheck.Name.Equals(wpExpected.Name))
                    {
                        errorLines.Add($"Name: expected '{wpExpected.Name}', actual '{workpieceToCheck.Name}'");
                    }

                    if (!workpieceToCheck.Quantity.Equals(wpExpected.Quantity.ToString()))
                    {
                        errorLines.Add($"Quantity: expected '{wpExpected.Quantity}', actual '{workpieceToCheck.Quantity}'");
                    }
                }

                if (errorLines.Count > 0)
                {
                    errorMessage = ServiceMethods.ListToString(errorLines);
                }
                return(new KeyValuePair <bool, string>(valid, errorMessage));
            }

            return(new KeyValuePair <bool, string>(false, "One of the workpieces is null"));
        }
Esempio n. 9
0
        public ActionResult GetVillageBySubDistrictId(string subDistrictId)
        {
            subDistrictId = Convert.ToString(JsonConvert.DeserializeObject <int>(subDistrictId));
            ServiceInputObject serviceObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Village",
                methodName     = "GetVillageListofSubDistrict",
                parameterValue = subDistrictId
            };

            List <VillageInfoEntities> villageInfoEntities = ServiceMethods.GenerateGatRequest <List <VillageInfoEntities> >(serviceObject);
            List <SelectListItem>      villageList         = CommonOperations.BindDropdwon <VillageInfoEntities>(villageInfoEntities, "VillageID", "VILLAGE");

            return(Json(villageList));
        }
Esempio n. 10
0
        public void CheckWorkpiceFileUpload()
        {
            var testOrder     = this.OrderGenerationRule;
            var testWorkpiece = WorkpieceGenerationRule;

            var orderToAdd = testOrder.Generate();

            this.App.Ui.OrdersMain.ClickCreateNewOrderButton();
            this.App.Ui.OrdersOrder.PopulateOrderData(orderToAdd);

            var files = new List <string>
            {
                "Length_sorting.png",
                "Length_sorting.bmp",
                "Length_sorting.jpg",
                "Length_sorting.jpeg",
                "Test upload file.docx",
                "Test upload file.doc",
                "RP_PDF_Report.pdf",
                "RP_Report.ppt",
                "RP_Report.pptx",
                "Test upload file - S.stp",
                "Test upload file.pst",
                "Length_sorting T.tif",
                "Length_sorting TT.tiff",
                "Test XLS.xls",
                "Test XLSX.xlsx"
            };

            var filePaths = new List <string>();

            foreach (var file in files)
            {
                string path = TestContext.CurrentContext.TestDirectory + "\\TestsData\\Orders\\Files\\" + file;
                filePaths.Add(path);
            }

            var workpieceToAdd = testWorkpiece.Generate();

            this.App.Ui.OrdersOrder.AddWorkpieceToOrder(workpieceToAdd, true);
            App.Ui.OrdersWorkpiece.AddFilesForWorkpiece(filePaths);
            var fileNames = App.Ui.OrdersOrder.GetFilesForWorkpiece();

            Assert.True(
                fileNames.Count == filePaths.Count && fileNames.SequenceEqual(files),
                $"Expected '{ServiceMethods.ListToString(files)}' but actual '{ServiceMethods.ListToString(fileNames)}'");
        }
Esempio n. 11
0
        public void CheckWorkpiceInvalidFileUpload()
        {
            var testOrder     = this.OrderGenerationRule;
            var testWorkpiece = WorkpieceGenerationRule;

            var orderToAdd = testOrder.Generate();

            this.App.Ui.OrdersMain.ClickCreateNewOrderButton();
            this.App.Ui.OrdersOrder.PopulateOrderData(orderToAdd);

            var files = new List <string>
            {
                "MicrosoftWebDriver.exe",
                "MicrosoftWebDriver.bin",
                "MicrosoftWebDriver.com",
                "TestFileBat.bat",
            };

            var filePaths = new List <string>();

            foreach (var file in files)
            {
                string path = TestContext.CurrentContext.TestDirectory + "\\TestsData\\Orders\\Files\\" + file;
                filePaths.Add(path);
            }

            var workpieceToAdd = testWorkpiece.Generate();

            this.App.Ui.OrdersOrder.AddWorkpieceToOrder(workpieceToAdd, true);
            App.Ui.OrdersWorkpiece.AddFilesForWorkpiece(filePaths);
            var fileNames = App.Ui.OrdersOrder.GetFilesForWorkpiece();

            Assert.True(
                fileNames.Count == 0,
                $"No added but actual '{ServiceMethods.ListToString(fileNames)}'");

            var logs = App.Ui.UiHelp.GetBrowserLogs();

            foreach (var file in files)
            {
                Assert.True(
                    logs.Any(
                        l => l.Message.Contains(
                            $"failed to attach file '{file}', reason: {file} has an invalid extension.")),
                    $"Exception for '{file}' file wasn't found in console");
            }
        }
        public ActionResult GetDistrictsOfPocket(string pocketId)
        {
            pocketId = Convert.ToString(JsonConvert.DeserializeObject <int>(pocketId));
            ServiceInputObject serviceInputsForDocType = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Pocket",
                methodName     = "GetPocketDetail",
                parameterValue = pocketId
            };
            PocketInfoEntities pocketDetail = new PocketInfoEntities();

            pocketDetail = ServiceMethods.GenerateGatRequest <PocketInfoEntities>(serviceInputsForDocType);
            List <SelectListItem> Districts = CommonOperations.BindDropdwon <DistrictInfoEntities>(pocketDetail.districts, "DistID", "DistrictName");

            return(Json(Districts));
        }
Esempio n. 13
0
        public ActionResult UpdatePocket(string pocketData)
        {
            PocketModel pocketModel = JsonConvert.DeserializeObject <PocketModel>(pocketData);

            pocketModel.pocketInfo.UpdatedBy = SessionManager.UserId;

            ServiceInputObject serviceInputsForUpdation = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Pocket",
                methodName     = "PutPocketDetail"
            };
            int returnValue = ServiceMethods.GeneratePutRequestIntDestinationEntity <PocketInfoEntities>(pocketModel.pocketInfo, serviceInputsForUpdation);


            return(Json("Data Successfully Updated"));
        }
Esempio n. 14
0
        // GET: TestWebApi
        public ActionResult Index()
        {
            try
            {
                ServiceInputObject serviceObject = new ServiceInputObject
                {
                    baseURL        = ConfigSettings.WebApiBaseAddress,
                    controllerName = "FarmerDetail",
                    parameterValue = string.Empty
                };

                //FarmerDetailEntity farmerDetailEntity = new FarmerDetailEntity();
                //farmerDetailEntity.crops = "Crop1";
                //farmerDetailEntity.dealerId = 3;
                //farmerDetailEntity.dealerName = "Dealer3";
                //farmerDetailEntity.faId = 3;
                //farmerDetailEntity.faName = "faName3";
                //farmerDetailEntity.farmerTypeId = 3;
                //farmerDetailEntity.firstName = "Hitesh";
                //farmerDetailEntity.landDry = "No Idea";
                //farmerDetailEntity.landIrrigation = "No Idea";
                //farmerDetailEntity.landOnRent = false;
                //farmerDetailEntity.landOwned = true;
                //farmerDetailEntity.lastName = "Ajudia";
                //farmerDetailEntity.middleName = "B";
                //farmerDetailEntity.mobileNumber = "8600520506";
                //farmerDetailEntity.numberOfFields = 2;
                //farmerDetailEntity.registrationDate = DateTime.Now;
                //farmerDetailEntity.saId = 3;
                //farmerDetailEntity.sourceOfIrrigation = "No Idea";

                List <FarmerDetailEntities> farmerDetail = ServiceMethods.GenerateGatRequest <List <FarmerDetailEntities> >(serviceObject);

                //FarmerDetailEntity insertedDetail = ServiceMethods.GeneratePostRequest<FarmerDetailEntity>(farmerDetailEntity, serviceObject);

                //farmerDetailEntity.id = 9;
                //FarmerDetailEntity updatedDetail = ServiceMethods.GeneratePutRequest<FarmerDetailEntity>(farmerDetailEntity, serviceObject);

                //int deletedRecord = ServiceMethods.GenerateDeleteRequest(9, serviceObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View());
        }
        public void MachineInformation()
        {
            #region Get test data

            string machineToCheck = "Machine 1"; //ToDo: Check for all machines after implementing task sorting logic

            var machine         = App.GraphApi.ProjectManager.GetMachines().First(m => m.name.Equals(machineToCheck));
            var apiMachineTasks = App.GraphApi.ProjectManager.GetMachineTasks(machine.id);

            apiMachineTasks.Sort((x, y) => DateTime.Compare(x.StartDate, y.StartDate));

            //Get current task

            var currentTask = this.GetCurrentTask(apiMachineTasks);

            //Get upcoming tasks
            var upcomingTasks = this.GetUpcomingTasks(apiMachineTasks, currentTask);

            #endregion

            var machineInfo = App.Ui.Machines.GetMachinesInfo(true, 50).First(m => m.Machine.Equals(machineToCheck));

            var workplanId = App.Db.ProjectManager.GetTask(currentTask.Id).WorkplanId;
            var workplan   = App.Db.ProjectManager.GetWorkplan(workplanId);
            var workpiece  = App.Db.ProjectManager.GetWorkpiece(workplan.WorkpieceId);

            Assert.Multiple(
                () =>
            {
                Assert.True(machineInfo.WorkpieceName.Equals(workpiece.Name), $"Workpiece name is incorrect. Expected: {workpiece.Name}. Actual: {machineInfo.WorkpieceName}");
                Assert.True(machineInfo.CurrentTask.Equals(currentTask.Name), $"Current is incorrect. Expected: {currentTask.Name}. Actual: {machineInfo.CurrentTask}");
                Assert.True(machineInfo.EstimatedEnd.Equals(currentTask.EndDate.ToString("MM/dd/yyyy") + " 12:00:00 AM"), "Estimated end time is wrong");

                var estimatedDurationActual =
                    ServiceMethods.ConvertDurationFromTimeFormatToSeconds(machineInfo.EstimatedDuration);

                Assert.True(
                    estimatedDurationActual.Equals(
                        currentTask.DurationPerTotal),
                    $"Estimated end time is wrong. Expected {currentTask.DurationPerTotal}. Actual {estimatedDurationActual}");
                Assert.True(
                    upcomingTasks.First().Value.Select(e => e.Name).ToList()
                    .Contains(machineInfo.UpcomingWorkpiece));
            });
        }
Esempio n. 16
0
        public void OrderWorkpieceDetails_FilesGridWithAttachedFiles()
        {
            #region parameters
            var dateFormat  = "MM/dd/yyyy h:mm:ss tt";
            var editor      = "ProjectManager.Api";
            var projectPath = TestContext.CurrentContext.TestDirectory + "\\TestsData\\Orders\\Files\\";
            var files       = new List <string>
            {
                "Test upload file.doc",
                "Test XLS.xls",
                "Test XLSX.xlsx"
            };
            var filePaths = new List <string>();
            foreach (var file in files)
            {
                filePaths.Add(projectPath + file);
            }
            #endregion

            var orderId = App.Preconditions.CreateOrder();
            App.Ui.OrdersMain.OpenOrderDetailsDirectly(orderId);

            var testWorkpiece  = this.WorkpieceGenerationRule;
            var workpieceToAdd = testWorkpiece.Generate();
            App.Ui.OrdersOrder.AddWorkpieceToOrder(workpieceToAdd, true);
            App.Ui.OrdersWorkpiece.AddFilesForWorkpiece(filePaths);
            App.Ui.OrdersWorkpiece.ClickSaveButton();
            var expectedTime = DateTime.Now;
            App.Ui.OrdersOrder.ClickRandomWorkpiece();
            App.Ui.OrdersWorkpiece.NavigateToTab(WorkpieceDetails.WorkpieceDetailsTabs.AttachedFiles);
            var filesRecords = App.Ui.OrdersWorkpiece.GetFilesGridRecords;
            Assert.AreEqual(filePaths.Count, filesRecords.Count, "Incorrect number of files");
            Assert.That(ServiceMethods.CompareLists(filesRecords.Select(r => r.Name).ToList(), files), "Incorrect files in name column");
            Assert.That(filesRecords.Select(r => r.Editor).ToList().TrueForAll(ed => ed.Equals(editor)), "Editor value is not correct");
            foreach (var time in filesRecords.Select(r => r.CreationDate).ToList())
            {
                Assert.That(DateTime.Parse(time), Is.EqualTo(expectedTime).Within(1).Minutes, "Incorrect Time");
            }

            var link = App.Ui.OrdersWorkpiece.GetRandomLinkFromFilesGrid();
            var tryToDownloadResponse =
                App.Api.ApiHelp.DownloadFile(link);
            var expectedFileLenght = FileUtils.GetFilesLenght(projectPath + link.Split('/').Last().Replace("%20", " "));
            Assert.AreEqual(tryToDownloadResponse.ContentLength, expectedFileLenght, "File lenght is not equal");
        }
Esempio n. 17
0
        public void HoldersContentOfTheGrid()
        {
            var expectedColumns = new List <string> {
                "NAME", "SIZE", "LENGTH", "QUANTITY"
            };

            this.App.Ui.ToolsMain.SelectToolType(FilterSearchData.ToolsTypes.Holders);
            var columnNames = this.App.Ui.ToolsMain.GetGridColumnsNames();

            columnNames = ServiceMethods.RemoveStringsInList(columnNames, new List <string> {
                "▲", "▼"
            });

            var columnNamesToUpper = new List <string>();

            columnNames.ForEach(e => columnNamesToUpper.Add(e.ToUpper()));
            Assert.That(columnNamesToUpper.SequenceEqual(expectedColumns), "Grid columns names are not as expected");
        }
        // We can't pass in a HealthVaultClient directly because it's not a WinRT class. :(
        public ServiceMethodProvider(HealthVaultAppSettings appSettings)
        {
            ServiceInfo serviceInfo = (ServiceInfo)ServiceFactory.CreateServiceInfo(
                "https://platform.healthvault-ppe.com/platform/wildcat.ashx",
                "https://account.healthvault-ppe.com");

            AppInfo appInfo = new AppInfo();
            appInfo.MasterAppId = Guid.Parse(appSettings.MasterAppId);
            appInfo.IsMultiInstanceAware = true;

            HealthVaultClient client = new HealthVaultClient(
                appInfo,
                serviceInfo,
                appSettings.IsFirstParty,
                appSettings.WebAuthorizer != null ? (IWebAuthorizer)appSettings.WebAuthorizer : null);

            m_serviceMethods = client.ServiceMethods;
        }
Esempio n. 19
0
        //Gets Default CountryID
        private Guid GetDefaultCountryID()
        {
            DataFormLoadRequest request = new DataFormLoadRequest
            {
                FormID          = DEFAULTCOUNTRY_VIEWFORMID,
                IncludeMetaData = false
            };
            DataFormLoadReply reply = default(DataFormLoadReply);
            Guid countryID          = Guid.Empty;

            reply = ServiceMethods.DataFormLoad(request, _model.GetRequestContext());

            if (reply.DataFormItem.TryGetValue("COUNTRYID", ref countryID))
            {
                return(countryID);
            }

            return(Guid.Empty);
        }
Esempio n. 20
0
    public string GetInvoiceIdFromJobCard_v1(int jobcard, bool isfromInvoice, int type = 1)
    {
        string         InvoiceId     = "";
        dbConnection   dbCon         = new dbConnection();
        ServiceMethods ServiceMethod = new ServiceMethods();

        if (isfromInvoice)
        {
            string    query = "Select top 1 [GstInvoiceNumber]  from Invoice where JobCardId=@1 and type=" + type + " and GstInvoiceNumber is not null order by Id desc";
            string[]  param = { jobcard.ToString() };
            DataTable dt    = dbCon.GetDataTableWithParams(query, param);
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                InvoiceId = dr["GstInvoiceNumber"].ToString();
            }
        }
        return(InvoiceId);
    }
        // We can't pass in a HealthVaultClient directly because it's not a WinRT class. :(
        public ServiceMethodProvider(HealthVaultAppSettings appSettings)
        {
            ServiceInfo serviceInfo = (ServiceInfo)ServiceFactory.CreateServiceInfo(
                "https://platform.healthvault-ppe.com/platform/wildcat.ashx",
                "https://account.healthvault-ppe.com");

            AppInfo appInfo = new AppInfo();

            appInfo.MasterAppId          = Guid.Parse(appSettings.MasterAppId);
            appInfo.IsMultiInstanceAware = true;

            HealthVaultClient client = new HealthVaultClient(
                appInfo,
                serviceInfo,
                appSettings.IsFirstParty,
                appSettings.WebAuthorizer != null ? (IWebAuthorizer)appSettings.WebAuthorizer : null);

            m_serviceMethods = client.ServiceMethods;
        }
Esempio n. 22
0
        public void CheckSearchGridTitles()
        {
            var expectedColumns = new List <string> {
                "NAME", "SIZE", "LENGTH", "QUANTITY"
            };
            var searchTerm = "W128";

            this.App.Ui.ToolsMain.PerformSearch(searchTerm);
            var columnNames = this.App.Ui.ToolsMain.GetGridColumnsNames();

            columnNames = ServiceMethods.RemoveStringsInList(columnNames, new List <string> {
                "▲", "▼"
            });

            var columnNamesToUpper = new List <string>();

            columnNames.ForEach(e => columnNamesToUpper.Add(e.ToUpper()));
            Assert.That(columnNamesToUpper.SequenceEqual(expectedColumns), "Grid columns names are not as expected");
        }
Esempio n. 23
0
        public ActionResult GetPocketInitialValues()
        {
            ServiceInputObject serviceObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Pocket",
                methodName     = "GetPocketPageUIvalues"
            };

            PocketPageUIvalues pageUiValues = ServiceMethods.GenerateGatRequest <PocketPageUIvalues>(serviceObject);

            PocketDropdownValueForAddPage dropdownValue = new PocketDropdownValueForAddPage();

            dropdownValue.states           = CommonOperations.BindDropdwon <StateInfoEntities>(pageUiValues.states, "StateID", "StateName");
            dropdownValue.crops            = CommonOperations.BindDropdwon <CropInfoEntities>(pageUiValues.crops, "CropID", "CropName");
            dropdownValue.fertilizers      = CommonOperations.BindDropdwon <FertilizerInfoEntities>(pageUiValues.fertilizers, "Id", "Fertilizer");
            dropdownValue.pocketStatusList = CommonOperations.BindDropdwon <PocketStatusEntities>(pageUiValues.pocketStatusList, "Id", "PocketStatus");
            return(Json(dropdownValue));
        }
Esempio n. 24
0
        public HealthVaultClient(
            AppInfo appInfo,
            ServiceInfo serviceInfo,
            IHttpTransport transport,
            IHttpStreamer streamer,
            ICryptographer cryptographer,
            IWebAuthorizer authorizer)
        {
            appInfo.ValidateRequired("appInfo");
            serviceInfo.ValidateRequired("serviceInfo");
            if (transport == null)
            {
                throw new ArgumentNullException("transport");
            }
            if (streamer == null)
            {
                throw new ArgumentNullException("streamer");
            }
            if (cryptographer == null)
            {
                throw new ArgumentNullException("cryptographer");
            }
            if (authorizer == null)
            {
                throw new ArgumentNullException("authorizer");
            }

            m_appInfo = appInfo;
            m_serviceInfo = serviceInfo;
            m_transport = transport;
            m_streamer = streamer;
            m_cryptographer = cryptographer;
            m_authorizer = authorizer;

            m_serviceMethods = new ServiceMethods(this);
            m_recordMethods = new RecordMethods(this);
            m_shell = new Shell(this);

            m_secretStore = new SecretStore(MakeStoreName(m_appInfo.MasterAppId));
            m_state = new ClientState();
            LoadState();
        }
Esempio n. 25
0
        public void CheckProjectManagerGridContent()
        {
            var expectedColumns = new List <string>
            {
                "Order ID",
                "Customer",
                "Delivery date",
                "Editor",
                "Creation Date"
            };

            if (Parameters.Parameters.Browser != "MicrosoftEdge")
            {
                expectedColumns = ServiceMethods.StringListToUpper(expectedColumns);
            }

            var names = this.App.Ui.OrdersMain.GetColumnsNames();

            Assert.That(names.SequenceEqual(expectedColumns), "Grid columns names are not as expected");
        }
Esempio n. 26
0
    public string GetInvoiceDateFromJobCard_v1(int jobcard, bool isfromInvoice, int type = 1)
    {
        string         InvoiceId     = "";
        dbConnection   dbCon         = new dbConnection();
        ServiceMethods ServiceMethod = new ServiceMethods();

        if (isfromInvoice)
        {
            string    query = "Select top 1 NULLIF(DOC,'') as DOC  from Invoice where JobCardId=@1 and type=" + type + "  order by Id desc";
            string[]  param = { jobcard.ToString() };
            DataTable dt    = dbCon.GetDataTableWithParams(query, param);
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow  dr     = dt.Rows[0];
                DateTime dtDate = Convert.ToDateTime(dr["DOC"]);
                InvoiceId = ServiceMethod.JobCardDateFormatWithTime(dtDate);
            }
        }
        return(InvoiceId);
    }
Esempio n. 27
0
        public void CloseAddTaskPopup()
        {
            App.Pages.OrdersPages.CreateTaskPopup.WaitForPageLoad();
            Exception exc;
            int       counter = 0;

            do
            {
                try
                {
                    App.Pages.OrdersPages.CreateTaskPopup.Close();
                    exc = null;
                    ServiceMethods.WaitForOperationPositive(() => !App.Pages.OrdersPages.CreateTaskPopup.IsOpened(), 4);
                }
                catch (Exception e)
                {
                    exc = e;
                }
            }while (exc != null && counter++ < 5);
        }
Esempio n. 28
0
        public ActionResult GetPageUIvaluesForPocket(string pocketId)
        {
            pocketId = Convert.ToString(JsonConvert.DeserializeObject <int>(pocketId));
            ServiceInputObject serviceInputObject = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "FarmerDetail",
                methodName     = "GetPocketMappingData",
                parameterValue = pocketId
            };
            FarmerDetailPageUIvalues pageUIvalues = ServiceMethods.GenerateGatRequest <FarmerDetailPageUIvalues>(serviceInputObject);


            PocketDropdownValueForAddPage dropdownValue = new PocketDropdownValueForAddPage();

            dropdownValue.crops    = CommonOperations.BindDropdwon <CropInfoEntities>(pageUIvalues.CropList, "CropID", "CropName");
            dropdownValue.villages = CommonOperations.BindDropdwon <VillageInfoEntities>(pageUIvalues.villageList, "VillageID", "VILLAGE");

            return(Json(dropdownValue));
        }
Esempio n. 29
0
        public void AddWorkpieceToOrder(Workpiece workpiece, bool populateOnly = false)
        {
            var materials = App.GraphApi.ToolManager.GetUsageMaterials();
            var material  = materials.First(m => int.Parse(m.Id).Equals(workpiece.RawMaterialId));

            if (!App.Pages.OrdersPages.CreateWorkpiecePopup.IsOpened())
            {
                App.Pages.OrdersPages.OrderDetails.ClickCreateNewWorkpieceButton();
            }

            App.Pages.OrdersPages.CreateWorkpiecePopup.PopulateField(CreateWorkpiecePopup.WorkpieceFields.WorkpieceId, workpiece.ExternalWorkpieceId);
            App.Pages.OrdersPages.CreateWorkpiecePopup.PopulateField(CreateWorkpiecePopup.WorkpieceFields.WorkpieceName, workpiece.Name);
            string deliveryDate = workpiece.DeliveryDate.ToString("yyyy-MM-dd").Equals("0001-01-01")
                                      ? string.Empty
                                      : workpiece.DeliveryDate.ToString("MM/dd/yyy");

            App.Pages.OrdersPages.CreateWorkpiecePopup.PopulateField(CreateWorkpiecePopup.WorkpieceFields.WorkpieceDeliveryDate, deliveryDate);
            App.Pages.OrdersPages.CreateWorkpiecePopup.PopulateField(
                CreateWorkpiecePopup.WorkpieceFields.WorkpieceMaterial,
                material.Name);
            App.Pages.OrdersPages.CreateWorkpiecePopup.PopulateField(CreateWorkpiecePopup.WorkpieceFields.WorkpieceQuantity, workpiece.Quantity.ToString());



            if (!populateOnly)
            {
                int counter = 0;
                while (!App.Pages.OrdersPages.CreateWorkpiecePopup.IsSaveButtonEnabled() && counter++ < 5)
                {
                    Thread.Sleep(500);
                }

                if (counter >= 5)
                {
                    throw new Exception("'Add workpiece' button is disabled");
                }

                App.Pages.OrdersPages.CreateWorkpiecePopup.ClickSaveButton();
                ServiceMethods.WaitForOperationPositive(() => !App.Pages.OrdersPages.CreateWorkpiecePopup.IsOpened(), 20);
            }
        }
Esempio n. 30
0
        public Guid SaveConstituentInfo()
        {
            //if (this.BIRTHDATE.HasValue())
            //    this.ApplyBirthdateRule();
            //this.ApplyNameFormatsRule();
            //if (!this.MatchUpdated())
            //{
            //    int num = 0;
            //    DuplicateResolutionUIModel.BATCHTYPES? nullable1 = this.BATCHTYPE.Value;
            //    int? nullable2 = nullable1.HasValue ? new int?((int)nullable1.GetValueOrDefault()) : new int?();
            //    if (!(nullable2.HasValue ? new bool?(nullable2.GetValueOrDefault() == num) : new bool?()).GetValueOrDefault())
            //        return this.MATCHCONSTITUENTID.Value;
            //}

            DataFormSaveRequest request = new DataFormSaveRequest();

            try
            {
                DataFormSaveRequest dataFormSaveRequest = request;
                dataFormSaveRequest.FormID              = new Guid("4417055D-0EFD-4F02-AF00-EA24CD901E7E");
                dataFormSaveRequest.ID                  = this.DUPLICATERECORDID.Value.ToString();
                dataFormSaveRequest.SecurityContext     = this.GetRequestSecurityContext();
                dataFormSaveRequest.DataFormItem        = _customModel.GetSaveDataFormItem;
                dataFormSaveRequest.AggregateExceptions = true;
                ServiceMethods.DataFormSave(request, this.GetRequestContext());
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                string message = ex.Message;

                if (null != ex.InnerException)
                {
                    message += $" {ex.InnerException.Message}";
                }

                throw new InvalidUIModelException(message);
            }

            return(_customModel.MATCHCONSTITUENTID.Value);
        }
Esempio n. 31
0
        public List <OrderGridRecord> GetRecords()
        {
            var parser = new HtmlParser();
            List <OrderGridRecord> entities = new List <OrderGridRecord>();

            var doc = parser.Parse(this.Driver.PageSource);

            var gridRowCssSelector  = GridRowCssLocatorText;
            var gridCellCssSelector = "td";

            var rows = doc.QuerySelectorAll(gridRowCssSelector);

            foreach (var row in rows)
            {
                var order = new OrderGridRecord();
                var cells = row.QuerySelectorAll(gridCellCssSelector);

                var cellsTexts = cells.Select(t => t.TextContent).ToList();
                order.OrderId      = cellsTexts[0];
                order.Customer     = cellsTexts[1];
                order.DeliveryDate = cellsTexts[2].Replace("?", string.Empty);

                if (Parameters.Parameters.Browser == "MicrosoftEdge")
                {
                    order.DeliveryDate = ServiceMethods.ConvertEdgeDateToUtf(order.DeliveryDate);
                }


                order.Editor       = cellsTexts[3];
                order.CreationDate = cellsTexts[4].Replace("?", string.Empty);

                if (Parameters.Parameters.Browser == "MicrosoftEdge")
                {
                    order.CreationDate = ServiceMethods.ConvertEdgeDateToUtf(order.CreationDate);
                }

                entities.Add(order);
            }

            return(entities);
        }
Esempio n. 32
0
        public ActionResult SelectedPocketForUpdate(int id)
        {
            ServiceInputObject serviceInputsForDocType = new ServiceInputObject
            {
                baseURL        = ConfigSettings.WebApiBaseAddress,
                controllerName = "Pocket",
                methodName     = "GetPocketDetailForUpdate",
                parameterValue = Convert.ToString(id)
            };
            PocketInfoEntities pocketDetail = new PocketInfoEntities();

            pocketDetail = ServiceMethods.GenerateGatRequest <PocketInfoEntities>(serviceInputsForDocType);

            PocketModel pocketModel = new PocketModel();

            pocketModel.pocketInfo     = pocketDetail;
            pocketModel.isInDetailMode = false;
            pocketModel.ActionType     = ActionTypeEnum.Update;

            return(View("CreatePocket", pocketModel));
        }