// GET: Recommendations
        public async Task <ActionResult> Index()
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            IEnumerable <PreferenceEntity> preferenceEntities = TableActions.GetPreferencesResult("PreferenceTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);
            IEnumerable <PantryEntity>     pantryEntities     = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            var preference = preferenceEntities.FirstOrDefault();
            IEnumerable <string> dietaryRestrictions = null;
            string diet = null;

            if (preference != null)
            {
                dietaryRestrictions = preference.healthPreference.Split(',');
                diet = preference.dietPreference;
            }

            string[]       foods                = { "pork", "bread", "peppers", "sugar", "corn" };
            string[]       pantryList           = pantryEntities.Select(x => x.RowKey).ToArray();
            IngredientList userPreferences      = new IngredientList(foods);
            IngredientList pantry               = new IngredientList(pantryList);
            List <Tuple <Recipe, double> > recs = await Recommender.GetRecommendations(userPreferences, pantry, dietaryRestrictions, diet);

            return(View(recs));
        }
        public void VerifyJobOrderSummaryData()
        {
            try
            {
                var datarows = EllisHome.Initialize(ExcelFileNames.JobOrderVerify);
                foreach (var data in datarows)
                {
                    LandingPage.SelectFromToolbar("Job Orders");

                    var profileStatus = TableActions.OpenRecordFromTable(EllisWindow, "_grdJobOrders", "Job Order #",
                                                                         data.ItemArray[2].ToString());
                    var status = true;
                    if (profileStatus)
                    {
                        status = OpenJobOrder.VerifyJobOrder(data);
                        //Factory.AssertIsTrue(status, "Profile data not matched");
                        OpenJobOrder.CloseJobOrderProfile();
                    }
                    Factory.AssertIsTrue(status, "Profile data not matched");
                    Factory.AssertIsTrue(profileStatus, "Profile not found");
                }
            }
            finally
            {
                Cleanup();
            }
        }
        // GET: Preferences
        public ActionResult Index()
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            var preferences        = TableActions.GetPreferencesResult("PreferenceTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);
            var userPreference     = preferences.FirstOrDefault();
            PreferencesModel model = new PreferencesModel();

            if (userPreference != null)
            {
                Diet          diet;
                List <Health> dietaryRestrictions = new List <Health>();
                Enum.TryParse <Diet>(userPreference.dietPreference, out diet);

                IEnumerable <string> dietaryRestrictionsString = userPreference.healthPreference.Split(',');
                foreach (var dietaryRestrictionString in dietaryRestrictionsString)
                {
                    Health dietaryRestriction;
                    Enum.TryParse <Health>(dietaryRestrictionString, out dietaryRestriction);
                    dietaryRestrictions.Add(dietaryRestriction);
                }

                model.Diet = diet;
                model.DietaryRestrictions = dietaryRestrictions;
            }

            return(View(model));
        }
        public ActionResult AddIngredient(string ingredient, string quantity)
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            PantryEntity pantryEntity = new PantryEntity(userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value, ingredient);

            pantryEntity.foodCategory   = "food";
            pantryEntity.quantity       = quantity;
            pantryEntity.ExpirationTime = DateTime.UtcNow;
            TableActions.AddRow("PantryTable", (TableEntity)pantryEntity);

            var results = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            List <PantryModel> pantryItems = new List <PantryModel>();

            foreach (var item in results)
            {
                var pantryItem = item as PantryEntity;
                pantryItems.Add(new PantryModel {
                    Item = pantryItem.RowKey, Quantity = pantryItem.quantity
                });
            }

            return(View("Index", pantryItems));
        }
Example #5
0
        public static void EnterDatainOverTimeWindow(DataRow data)
        {
            var pane     = EllisWindow.Container.SearchFor <WinComboBox>(new { Name = "" });
            var ddConCol = Actions.GetControlCollection(pane);
            var country  = ddConCol.Where(v => v.Enabled && v.GetProperty("ControlName").Equals("_ddlCountry")).First();

            country.SetFocus();
            SendKeys.SendWait("UNITED STATES");
            Playback.Wait(1000);
            var state = ddConCol.Where(v => v.Enabled && v.GetProperty("ControlName").Equals("_ddlState")).First();

            state.SetFocus();
            if (data.ItemArray[8].ToString().CompareTo(String.Empty) != 0)
            {
                SendKeys.SendWait(data.ItemArray[8].ToString());
            }
            else
            {
                SendKeys.SendWait("ALL");
            }

            Playback.Wait(1000);

            MouseActions.ClickButton(EllisWindow, "_btnSearch");
            Playback.Wait(2000);
            TableActions.OpenRecordFromTable(EllisWindow, "grdOvertime", "State", data.ItemArray[11].ToString());
        }
 public void GivenTheTableIsCreatedInTheSchema(string tableName, string schemaName, Table table)
 {
     var tableActions = new TableActions(database.ConnectionString);
     var def = new TableDefinition(new DatabaseObjectName(schemaName, tableName));
     def.Columns.AddFromRaw(table.CreateSet<ColumnDefinitionRaw>());
     tableActions.Create(def);
 }
Example #7
0
        public static void SelectInvoiceFromResults()
        {
            var window = GetSearchResultsWindowProperties();
            var cell   = TableActions.SelectCellFromTable(window, CSearchControls.SearchResultGrid,
                                                          "CustomerAdvancedSummaryDomain row 1", "Ellis Invoice Number");

            MouseActions.DoubleClick(cell);
        }
Example #8
0
        public static bool VerifyOverDueDisplayed()
        {
            var row = TableActions.SelectRowFromTable(EllisWindow, ARControls.OverdueCustomers,
                                                      "OverdueCustomerSummaryDomain row 1");
            var cell = row.Container.SearchFor <WinCell>(new { Instance = "6" });

            return(cell.Enabled);
        }
Example #9
0
        public static void SelectFirstCustomerInvoiceFromTable()
        {
            var cell = TableActions.SelectCellFromTable(EllisWindow, ARControls.LockboxTable,
                                                        "LockboxBatchSummaryDomain row 1", "Batch #");

            Globals.CustomerName = cell.Value;
            MouseActions.Click(cell);
        }
Example #10
0
        public static void SelectFirstRemittenceFromTable()
        {
            var prop = GetPaymentLockboxWindowProperties();
            var cell = TableActions.SelectCellFromTable(prop, ARControls.PaymentDetailsTable, "RemittanceTransfer row 1",
                                                        "#");

            MouseActions.Click(cell);
        }
Example #11
0
        private static void SelectAnInvoiceNumberFromGrid(UITestControl prop)
        {
            var row = TableActions.SelectRowFromTable(prop, ARControls.UnpaidInvoiceGrid,
                                                      "CollectionInvoiceSummaryDomain row 1");
            var cell = row.Container.SearchFor <WinCell>(new { Value = "False" });

            Mouse.Click(cell);
        }
Example #12
0
        public bool IsActionEnabled(TableActions action)
        {
            if (action == TableActions.Details)
            {
                return(_actions.Contains(action));
            }

            return(!_isReadonly && _actions.Contains(action));
        }
Example #13
0
        public static void SelectCustomerCollectionFromLandingPage()
        {
            var cell = TableActions.SelectCellFromTable(EllisWindow, ARControls.OverdueCustomers,
                                                        "OverdueCustomerSummaryDomain row 1",
                                                        "Customer Name");

            Globals.CustomerName = cell.Value;
            Mouse.DoubleClick(cell);
        }
        public static void SelectWorkerFromResultsWindow()
        {
            var window = GetSearchResultsWindowProperties();
            var row    = TableActions.SelectRowFromTable(window, SearchControls.SearchResultGrid,
                                                         "WorkerSearchResultDomain row 1");

            var cell = row.Container.SearchFor <WinCell>(new { Value = Globals.WorkerName });

            MouseActions.DoubleClick(cell);
        }
Example #15
0
        public static void SelectJobOrderFromResults()
        {
            var window = GetSearchResultsWindowProperties();
            var cell   = TableActions.SelectCellFromTable(window, CSearchControls.SearchResultGrid,
                                                          "DispatchJobOrderDetailSummary row 1", "Job Order#");

            Globals.JobOrderNo = cell.Value;
            cell.SetFocus();
            MouseActions.DoubleClick(cell);
        }
Example #16
0
        public static void SelectWorkerFromGrid()
        {
            var existsWindow = GetWorkerAlreadyExistWindowProperties();

            if (existsWindow.Exists)
            {
                var row = TableActions.SelectRowFromTable(existsWindow, "grdWorkers", "WorkerInfoDomain row 1");
                Mouse.DoubleClick(row);
            }
        }
Example #17
0
 /// <summary>
 /// Constructor to get the connection
 /// </summary>
 /// <param name="js"></param>
 /// <param name="setup"></param>
 public StoreSet(IJSObjectReference js, Settings setup)
 {
     if (Settings.EnableDebug)
     {
         Console.WriteLine($"StoreSet constructor for : {Utils.GetGenericTypeName(this.GetType())}");
     }
     DeleteActions = new(js, setup);
     InsertActions = new(js, setup);
     UpdateActions = new(js, setup);
     SelectActions = new(js, setup);
     TableActions  = new(js, setup);
 }
Example #18
0
        public static bool SelectCustomer()
        {
            var customerPopUp = GetCustomerSearchPopUpProperties();

            if (customerPopUp.Exists)
            {
                var cell = TableActions.SelectCellFromTable(customerPopUp, CustomerSearchConstants.CustomersGrid,
                                                            "CustomerDomain row 1", "Customer Name - Number");
                cell.SetFocus();
                MouseActions.DoubleClick(cell);
                return(true);
            }
            return(false);
        }
Example #19
0
        public static void EnterRateSheetData(DataRow data)
        {
            var rateSheet = GetRateSheetWindowProperties();

            var cell = TableActions.SelectCellFromTable(rateSheet, "grdRateSheet", "RateSheetDetailsDomain row 1",
                                                        "RateSheetDate");

            cell.SetFocus();
            Playback.Wait(2000);
            Mouse.Click(cell);
            SendKeys.SendWait("{HOME}");
            SendKeys.SendWait(data.ItemArray[36].ToString());
            Playback.Wait(2000);

            MouseActions.ClickButton(rateSheet, "btnUpdate");
        }
Example #20
0
        public static bool VerifyNewNoteAdded()
        {
            var prop = GetCustomerCollectionsWindowProperties();
            var cell = TableActions.SelectCellFromTable(prop, ARControls.OverdueCustomers,
                                                        "OverdueCustomerSummaryDomain row 2",
                                                        "Customer Name");

            Globals.CustomerName = cell.Value;
            Mouse.DoubleClick(cell);

            var returnAns =
                CustomerProfileWindow.VerifyNewNoteDisplayedInGrid(
                    "This is an unpaid invoice. This note is just for testing purpose.");

            return(returnAns);
        }
Example #21
0
 public static bool SelectFirstCustomerNameFromResults()
 {
     try
     {
         var searchResults = GetSearchResultsWindowProperties();
         var cell          = TableActions.SelectCellFromTable(searchResults, CSearchControls.SearchResultGrid,
                                                              "CustomerAdvancedSummaryDomain row 1", "Customer Name");
         Globals.CustomerName = cell.Value;
         MouseActions.DoubleClick(cell);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #22
0
        /// <summary>
        /// 添加操作表格
        /// 被选择的数据项的主键将用脚本参数 (默认 selectedId) 传递
        /// </summary>
        /// <param name="display"></param>
        /// <param name="script">脚本参数 (默认 selectedId)</param>
        /// <returns></returns>
        public ITableAction AddActionTable(string display, string script)
        {
            if (string.IsNullOrWhiteSpace(display))
            {
                throw new ArgumentNullException("display");
            }
            if (string.IsNullOrWhiteSpace(script))
            {
                throw new ArgumentNullException("script");
            }

            var action = new DynamicTableAction(display, script, LinkBehave.Script);

            TableActions.Add(action);
            return(action);
        }
Example #23
0
        /// <summary>
        /// 添加操作表格
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public ITableAction AddActionTable(ILocation location)
        {
            if (location == null)
            {
                throw new ArgumentNullException("location");
            }
            if (location.Behave == LinkBehave.Script)
            {
                throw new ArgumentException("路径不能设置 LinkBehave.Script", "location.Behave");
            }

            var action = new DynamicTableAction(location.Display, location.Path, location.Behave);

            TableActions.Add(action);
            return(action);
        }
        public void OpenSpecificJobOrder()
        {
            var dataRows = EllisHome.Initialize(ExcelFileNames.JobOrderVerify);

            foreach (var dataRow in dataRows.Where(x => !x.ItemArray[2].ToString().Equals(string.Empty)))
            {
                LandingPage.SelectFromToolbar("Job Orders");
                var status = TableActions.OpenRecordFromTable(EllisWindow, "_grdJobOrders", "Job Order #", dataRow.ItemArray[2].ToString());

                if (status)
                {
                    OpenJobOrder.CloseJobOrderProfile();
                }

                Factory.AssertIsTrue(status, "Job Order with # " + dataRow.ItemArray[2].ToString() + " not found");
            }
        }
        public static bool SelectWorkTicketRecord(string jobOrderNo)
        {
            var searchWindow = GetSearchWindowProperties();

            if (searchWindow.Exists)
            {
                var label = Actions.GetWindowChild(searchWindow, "CasePartTitleLabel");
                var text  = label.GetProperty("Name").ToString().Contains("No records found");
                if (text)
                {
                    return(false);
                }
                var ticket = TableActions.OpenRecordFromTable(searchWindow, "_grdSearchResult",
                                                              "Work Ticket Number", jobOrderNo);
                return(ticket);
            }
            return(false);
        }
        public static bool SelectDispatchRecord(string customerName)
        {
            var searchResultsWindow = GetSearchResultsWindowProperties();

            if (searchResultsWindow.Exists)
            {
                var label = Actions.GetWindowChild(searchResultsWindow, "CasePartTitleLabel");
                var text  = label.GetProperty("Name").ToString().Contains("No records found");
                if (text)
                {
                    return(false);
                }
                var dispatch = TableActions.OpenRecordFromTable(searchResultsWindow, "_grdSearchResult", "Customer",
                                                                customerName);
                return(dispatch);
            }
            return(false);
        }
Example #27
0
        public static void EnterLicenseData(DataRow data)
        {
            var workerProfileWindow = GetWorkerProfileWindowProperties();
            var cell = TableActions.SelectCellFromTable(workerProfileWindow, "grdLicense", "Add Row", "License Type");

            cell.SetFocus();
            Mouse.DoubleClick(cell);
            SendKeys.SendWait(data.ItemArray[7].ToString());
            Actions.SendTab();
            Actions.SendText("{BACKSPACE}");
            SendKeys.SendWait(data.ItemArray[8].ToString());
            Actions.SendTab();
            SendKeys.SendWait(data.ItemArray[9].ToString());
            Actions.SendTab();
            SendKeys.SendWait(data.ItemArray[10].ToString());
            Actions.SendTab();
            SendKeys.SendWait(data.ItemArray[11].ToString());
        }
        public static bool HandleWorkerNotFoundValidationWindow()
        {
            var winInst = App.Container.SearchFor <WinWindow>(new { Name = "Quick Search" });

            if (winInst.Exists)
            {
                var tabResults = TableActions.SelectRecordFromTable(winInst, "grdDetails", "Worker Name", "Wiley, Sharon,A");
                MouseActions.ClickButton(winInst, "btnAdd");


                //var control = Actions.GetWindowChild(winInst, "_lblresult");
                //Console.WriteLine("Message for invalid worker search displayed as below...");
                //Console.WriteLine(control.GetProperty("Name"));
                //MouseActions.ClickButton(winInst, "btncancel");
                return(true);
            }
            return(false);
        }
        public static bool SelectInvoiceRecord(string invoiceNo)
        {
            var searchWindow = GetSearchWindowProperties();

            if (searchWindow.Exists)
            {
                var label = Actions.GetWindowChild(searchWindow, "CasePartTitleLabel");
                var text  = label.GetProperty("Name").ToString().Contains("No records found");
                if (text)
                {
                    return(false);
                }
                var creditCard = TableActions.OpenRecordFromTable(searchWindow, "_grdSearchResult",
                                                                  "Invoice Number", invoiceNo);
                return(creditCard);
            }
            return(false);
        }
        public static bool SelectBillingRecord(string billing)
        {
            var searchResultsWindow = GetSearchResultsWindowProperties();

            if (searchResultsWindow.Enabled)
            {
                var label = Actions.GetWindowChild(searchResultsWindow, "CasePartTitleLabel");
                var text  = label.GetProperty("Name").ToString().Contains("No records found");
                if (text)
                {
                    return(false);
                }
                var billinglineItem = TableActions.OpenRecordFromTable(searchResultsWindow, "_grdSearchResult",
                                                                       "Customer Number", billing);
                return(billinglineItem);
            }
            return(false);
        }
        public static bool SelectCheckRegisterRecord(string documentNo)
        {
            var searchWindow = GetSearchWindowProperties();

            if (searchWindow.Exists)
            {
                var label = Actions.GetWindowChild(searchWindow, "CasePartTitleLabel");
                var text  = label.GetProperty("Name").ToString().Contains("No records found");
                if (text)
                {
                    return(false);
                }
                var document = TableActions.OpenRecordFromTable(searchWindow, "_grdSearchResult",
                                                                "Document Number", documentNo);
                return(document);
            }
            return(false);
        }
 public void WhenTableIsPopulatedSupportingNullValues(string tableName, Table table)
 {
     var tableActions = new TableActions(database.ConnectionString);
     var tableData = new CollectionPopulatedTableData(table.Header, table.Rows.Select(x => x.Values));
     tableData.TransformData(new TableDataNullValueTransformer());
     tableActions.Insert(DatabaseObjectName.FromName(tableName), tableData);
 }
 public void WhenAViewCalledOfTheTableIsCreated(string viewName, string tableName)
 {
     var tableActions = new TableActions(database.ConnectionString);
     tableActions.CreateView(DatabaseObjectName.FromName(tableName), DatabaseObjectName.FromName(viewName));
 }
 public void WhenTheViewOfTheTableIsCreatedInTheSchema(string viewName, string tableName, string schemaName)
 {
     var tableActions = new TableActions(database.ConnectionString);
     tableActions.CreateView(new DatabaseObjectName(schemaName, tableName), new DatabaseObjectName(schemaName, viewName));
 }