Пример #1
0
        public void SearchForItemsByCriteria(Table table)
        {
            dynamic criteria = table.CreateDynamicInstance();
            string  category = criteria.category.ToString();
            string  type     = criteria.Type.ToString();
            string  Men      = criteria.subGroup.ToString();

            CategoryDropdown.Click();
            var options = Driver.FindElements(By.CssSelector("#searchDropdownBox > option"));

            foreach (IWebElement opt in options)
            {
                if (opt.Text.Contains(category))
                {
                    opt.Click();
                    break;
                }
            }

            SearchBox.SendKeys(type);
            SubmitSearch.Click();

            var leftNavBroserOptions = Driver.FindElements(By.CssSelector("div.left_nav.browseBox > ul >li"));

            foreach (IWebElement navOption in leftNavBroserOptions)
            {
                if (navOption.Text.Contains(Men))
                {
                    navOption.Click();
                    break;
                }
            }
        }
 protected override void OnInit(EventArgs e)
 {
     if (!IsPostBack)
     {
         CategoryDropdown.DataSource = from r in ProductInfoCatalog.RootCategories
                                       where shouldTake(r, false)
                                       select r;
         CategoryDropdown.DataBind();
     }
 }
Пример #3
0
 public void AddCategoryDropdowns(List <Category> categories)
 {
     CategoryDropdown.ClearOptions();
     foreach (Category cat in categories)
     {
         CategoryDropdown.options.Add(new Dropdown.OptionData {
             text = cat.Name
         });
     }
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                DataTable      categoryTable          = new DataTable();
                DataTable      subCategoryTable       = new DataTable();
                SqlDataAdapter dataAdapter            = null;
                SqlDataAdapter subCategoryDataAdapter = null;

                using (SqlConnection connection = Utility.ServerConnection.Connection())
                {
                    connection.Open();

                    using (SqlCommand command = Utility.ServerConnection.GetAllCategories(connection))
                    {
                        dataAdapter = new SqlDataAdapter(command);
                        dataAdapter.Fill(categoryTable);
                    }

                    using (SqlCommand subCategoryCommand = Utility.ServerConnection.GetSubCategories(connection, 1))
                    {
                        subCategoryDataAdapter = new SqlDataAdapter(subCategoryCommand);
                        subCategoryDataAdapter.Fill(subCategoryTable);
                    }
                }

                CategoryDropdown.DataSource     = categoryTable;
                CategoryDropdown.DataTextField  = "CategoryName";
                CategoryDropdown.DataValueField = "CategoryID";
                CategoryDropdown.DataBind();
                CategoryDropdown.Items.Add(new ListItem("All Categories"));

                SubCategoryDropdown.DataSource     = subCategoryTable;
                SubCategoryDropdown.DataTextField  = "SubCategoryName";
                SubCategoryDropdown.DataValueField = "SubCategoryID";
                SubCategoryDropdown.DataBind();
                SubCategoryDropdown.Items.Add(new ListItem("All SubCategories"));

                if (Session["SearchResults"] != null)
                {
                    SearchBox.Text = (string)Session["Search"];
                    CategoryDropdown.SelectedIndex = (int)Session["SelectedCategory"];
                    CategoryDropdown_SelectedIndexChanged(null, null);
                    SubCategoryDropdown.SelectedIndex = (int)Session["SelectedSubcategory"];

                    SearchButton_Click(null, null);
                }
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                QuestionBox.Text = (string)Session["SelectedQuestion"];

                SqlConnection  connection             = Utility.ServerConnection.Connection();
                SqlCommand     command                = Utility.ServerConnection.GetAllCategories(connection);
                SqlCommand     subCategoryCommand     = Utility.ServerConnection.GetSubCategories(connection, 1);
                DataTable      categoryTable          = new DataTable();
                DataTable      subCategoryTable       = new DataTable();
                SqlDataAdapter dataAdapter            = new SqlDataAdapter(command);
                SqlDataAdapter subCategoryDataAdapter = new SqlDataAdapter(subCategoryCommand);

                connection.Open();
                dataAdapter.Fill(categoryTable);
                subCategoryDataAdapter.Fill(subCategoryTable);

                CategoryDropdown.DataSource     = categoryTable;
                CategoryDropdown.DataTextField  = "CategoryName";
                CategoryDropdown.DataValueField = "CategoryID";
                CategoryDropdown.DataBind();

                SubCategoryDropdown.DataSource     = subCategoryTable;
                SubCategoryDropdown.DataTextField  = "SubCategoryName";
                SubCategoryDropdown.DataValueField = "SubCategoryID";
                SubCategoryDropdown.DataBind();

                string question = (string)Session["SelectedQuestion"];

                SqlCommand getQuestionIDWithName = Utility.ServerConnection.GetQuestionIDWithName(connection, question);
                questionID = (int)getQuestionIDWithName.ExecuteScalar();

                string category    = (string)Utility.ServerConnection.GetCategory(connection, questionID).ExecuteScalar();
                string subcategory = (string)Utility.ServerConnection.GetSubcategory(connection, questionID).ExecuteScalar();

                SetDropDownByValue(CategoryDropdown, category);
                CategoryDropdown_SelectedIndexChanged(null, null);
                SetDropDownByValue(SubCategoryDropdown, subcategory);

                SqlCommand    checkSBS = Utility.ServerConnection.CheckRoleQuestion(connection, questionID, 2);
                SqlDataReader reader   = checkSBS.ExecuteReader();

                SBSCheckBox.Checked = SBSViewable = reader.Read();
                reader.Close();

                SqlCommand checkDealer = Utility.ServerConnection.CheckRoleQuestion(connection, questionID, 3);
                reader = checkDealer.ExecuteReader();
                DealerCheckBox.Checked = DealerViewable = reader.Read();
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                SqlConnection  connection             = Utility.ServerConnection.Connection();
                SqlCommand     command                = Utility.ServerConnection.GetAllCategories(connection);
                SqlCommand     subCategoryCommand     = Utility.ServerConnection.GetSubCategories(connection, 1);
                DataTable      categoryTable          = new DataTable();
                DataTable      subCategoryTable       = new DataTable();
                SqlDataAdapter dataAdapter            = new SqlDataAdapter(command);
                SqlDataAdapter subCategoryDataAdapter = new SqlDataAdapter(subCategoryCommand);

                connection.Open();
                dataAdapter.Fill(categoryTable);
                subCategoryDataAdapter.Fill(subCategoryTable);

                CategoryDropdown.DataSource     = categoryTable;
                CategoryDropdown.DataTextField  = "CategoryName";
                CategoryDropdown.DataValueField = "CategoryID";
                CategoryDropdown.DataBind();

                SubCategoryDropdown.DataSource     = subCategoryTable;
                SubCategoryDropdown.DataTextField  = "SubCategoryName";
                SubCategoryDropdown.DataValueField = "SubCategoryID";
                SubCategoryDropdown.DataBind();

                int    questionID = -1;
                string question   = (string)Session["SelectedQuestion"];

                SqlCommand getQuestionIDWithName = Utility.ServerConnection.GetQuestionIDWithName(connection, question);
                questionID = (int)getQuestionIDWithName.ExecuteScalar();

                string category    = (string)Utility.ServerConnection.GetCategory(connection, questionID).ExecuteScalar();
                string subcategory = (string)Utility.ServerConnection.GetSubcategory(connection, questionID).ExecuteScalar();

                SetDropDownByValue(CategoryDropdown, category);
                CategoryDropdown_SelectedIndexChanged(null, null);
                SetDropDownByValue(SubCategoryDropdown, subcategory);
            }
        }
Пример #7
0
    public void UpdateCategoryDropdowns(List <Category> categories)
    {
        string currentValue = CategoryDropdown.options[CategoryDropdown.value].text;

        CategoryDropdown.ClearOptions();
        CategoryDropdown.options.Add(new Dropdown.OptionData {
            text = "All"
        });
        foreach (Category cat in categories)
        {
            CategoryDropdown.options.Add(new Dropdown.OptionData {
                text = cat.Name
            });
        }
        int newIndex = CategoryDropdown.options.FindIndex(i => i.text.Equals(currentValue));

        CategoryDropdown.value = newIndex >= 0 ? newIndex : 0;
        CategoryDropdown.RefreshShownValue();
    }
Пример #8
0
    public void EditQuestion(Question question)
    {
        Question       = question;
        SettingStuffUp = true;
        ResetSettings();
        QuestionObject qObj = question.GetQuestionObject();

        foreach (Alternative alternative in qObj.Alternatives)
        {
            Admin_AlternativeTemplate altTemplate = Instantiate(AlternativeLinePrefab, AlternativeParent, false).GetComponent <Admin_AlternativeTemplate>();
            AlternativeTexts.Add(alternative.Text);
            altTemplate.AlternativeText.text = alternative.Text;
            AlternativeLineList.Add(altTemplate.gameObject);
            altTemplate.gameObject.SetActive(true);
        }
        foreach (QuestionLine questionLine in qObj.QuestionLines)
        {
            Admin_QuestionLineTemplate qLine = Instantiate(QuestionLinePrefab, QuestionLineParent, false).GetComponent <Admin_QuestionLineTemplate>();
            qLine.LineText.text = questionLine.Text;
            qLine.CorrectAlternativeDropdown.ClearOptions();
            foreach (string s in AlternativeTexts)
            {
                qLine.CorrectAlternativeDropdown.options.Add(new Dropdown.OptionData {
                    text = s
                });
            }
            qLine.CorrectAlternativeDropdown.value = AlternativeTexts.IndexOf(questionLine.CorrectAlternative.Text);
            CorrectAlternativeDropdownList.Add(qLine.CorrectAlternativeDropdown.GetComponent <Dropdown>());
            qLine.gameObject.SetActive(true);
            QuestionLineList.Add(qLine.gameObject);
        }
        AlternativeButtonHolder.SetAsLastSibling();
        QuestionButtonHolder.SetAsLastSibling();
        QuestionTextInput.text = question.QuestionText;
        //WARNING: Need fix for non singlular category searches (only capeable of working with a single category atm)
        CategoryDropdown.value = CategoryDropdown.options.FindIndex(i => i.text.Equals(question.CategoryList[0].Name));
        CategoryDropdown.RefreshShownValue();
        DifficultyDropdown.value = DifficultyDropdown.options.FindIndex(i => i.text.Equals(question.Weight.ToString()));
        DifficultyDropdown.RefreshShownValue();
        ActiveToggle.isOn = Convert.ToBoolean(Question.Active);
        SettingStuffUp    = false;
    }
Пример #9
0
        //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")]
        //private IWebElement ItemToDelete { get; set; }

        //[FindsBy(How = How.XPath, Using = "")]
        //private IWebElement  { get; set; }

        //[FindsBy(How = How.XPath, Using = "")]
        //private IWebElement  { get; set; }



        #endregion

        internal void AddSkill()
        {
            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Skill");

            ShareSkillBtn.Click();
            Global.GlobalDefinitions.wait(5);

            TitleTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            DescriptionTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            CategoryDropdown.Click();
            var category      = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div/select"));
            var selectElement = new SelectElement(category);

            selectElement.SelectByIndex(3);

            SubcategoryDropdown.Click();
            var subcategory    = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select"));
            var selectElement1 = new SelectElement(subcategory);

            selectElement1.SelectByIndex(3);

            TagsTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            TagsTextbox.SendKeys(Keys.Enter);

            TagsTextbox1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(3, "Tags"));
            TagsTextbox1.SendKeys(Keys.Enter);

            OneoffService.Click();
            Thread.Sleep(500);
            HourlyService.Click();
            Thread.Sleep(500);

            OnSite.Click();
            Thread.Sleep(500);
            Online.Click();


            StartdateTextbox.Click();
            StartdateTextbox.SendKeys(DateTime.Now.AddDays(5).ToString("dd/MM/yyyy"));

            EnddateTextbox.Click();
            EnddateTextbox.SendKeys(DateTime.Now.AddMonths(1).ToString("dd/MM/yyyy"));

            SunCheckBox.Click();
            SunStartTime.Click();
            SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            SunStartTime.SendKeys(Keys.Up);
            SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            SunEndTime.SendKeys(Keys.ArrowDown);

            MonCheckBox.Click();
            MonStartTime.Click();
            MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            MonStartTime.SendKeys(Keys.Up);
            MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            MonEndTime.SendKeys(Keys.ArrowDown);

            TueCheckBox.Click();
            TueStartTime.Click();
            TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            TueStartTime.SendKeys(Keys.Up);
            TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            TueEndTime.SendKeys(Keys.ArrowDown);

            WedCheckBox.Click();
            WedStartTime.Click();
            WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            WedStartTime.SendKeys(Keys.Up);
            WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            WedEndTime.SendKeys(Keys.ArrowDown);

            ThuCheckBox.Click();
            ThuStartTime.Click();
            ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            ThuStartTime.SendKeys(Keys.Up);
            ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            ThuEndTime.SendKeys(Keys.ArrowDown);

            FriCheckBox.Click();
            FriStartTime.Click();
            FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            FriStartTime.SendKeys(Keys.Up);
            FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            FriEndTime.SendKeys(Keys.ArrowDown);

            SatCheckBox.Click();
            SatStartTime.Click();
            SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            SatStartTime.SendKeys(Keys.Up);
            SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            SatEndTime.SendKeys(Keys.ArrowDown);

            SkillExchangeButton.Click();
            SkillExchangeTag.Click();
            SkillExchangeTag.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillToExchange"));
            SkillExchangeTag.SendKeys(Keys.Enter);

            CreditButton.Click();
            CreditAmount.Click();
            CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "CreditAmount"));

            PlusCircleIcon.Click();


            //Upload file
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\zodiac.jpg");
            Thread.Sleep(500);
            autoIt.Send("{ENTER}");

            Thread.Sleep(500);
            PlusCircleIcon.Click();

            AutoItX3 autoIt1 = new AutoItX3();

            autoIt1.WinActivate("Open");
            Thread.Sleep(500);
            autoIt1.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\doggie.jpg");
            Thread.Sleep(500);
            autoIt1.Send("{ENTER}");

            Thread.Sleep(500);
            RemoveItem.Click();

            HiddenRadioButton.Click();
            Thread.Sleep(1000);
            ActiveRadioButton.Click();

            SaveButton.Click();

            Global.GlobalDefinitions.wait(5);


            //Add Skill Verification
            ManageListingsTab.Click();

            Global.GlobalDefinitions.wait(5);

            string ExpectedText = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description");
            string ActualText   = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")).Text;

            if (ExpectedText.Equals(ActualText))
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Add Skill Successful");
                String img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Pass");
                test.Log(LogStatus.Info, "Image example: " + img);
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Add Skill UnSuccessful");
                String img1 = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Fail");
                test.Log(LogStatus.Info, "Image example: " + img1);
            }
        }