예제 #1
0
        public async Task <IActionResult> CreateSkillLink(int[] skills, string linkLabel, string linkUrl, string skillString, string disciplineSearchString)
        {
            var currentUser = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var slID        = 0;

            //must create the skill link
            if (linkLabel != null && linkUrl != null)
            {
                linkUrl = linkUrl.ToLower();
                if (!linkUrl.Contains("constellation.citwdd.net") && !(linkUrl.Contains("http://") || linkUrl.Contains("https://")))
                {
                    linkUrl = "http://" + linkUrl;
                }

                SkillLink thisSL = new SkillLink();
                thisSL.SkillLinkOwner = currentUser;
                thisSL.SkillLinkUrl   = linkUrl;
                thisSL.SkilLinkLabel  = linkLabel;
                _context.Add(thisSL);
                await _context.SaveChangesAsync();

                //create the UserSkillLink join relationship
                slID = thisSL.SkillLinkID;

                if (!string.IsNullOrEmpty(skillString))
                {
                    var           cutString   = skillString.Substring(0, skillString.LastIndexOf("-") - 1);
                    UserSkill     stringSkill = _context.UserSkills.Where(i => i.Skills.SkillName == cutString).FirstOrDefault();
                    UserSkillLink ThisUSL     = new UserSkillLink();
                    ThisUSL.LinkID      = slID;
                    ThisUSL.UserSkillID = stringSkill.UserSkillID;
                    _context.Add(ThisUSL);
                    await _context.SaveChangesAsync();
                }

                foreach (var skill in skills)
                {
                    try
                    {
                        UserSkillLink ThisUSL = new UserSkillLink();
                        ThisUSL.LinkID      = slID;
                        ThisUSL.UserSkillID = skill;
                        _context.Add(ThisUSL);
                        await _context.SaveChangesAsync();
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            return(RedirectToAction("Index", "UserSkills", new { @disciplineSearchString = disciplineSearchString }));
        }
예제 #2
0
        public void DeleteSkills()
        {
            GlobalDefinitions.Wait();
            SkillLink.Click();
            IWebElement Delete = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//tbody[1]//tr[1]//td[3]//span[2]"));

            Delete.Click();
            //for deleting skill details

            IWebElement AddAlertPopup = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner"));
            String      AlertText     = AddAlertPopup.Text;

            GlobalDefinitions.Wait();
            Assert.IsTrue(AlertText.Contains("deleted"));
            Console.WriteLine(AlertText);
            //Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills deleted successfully");
            var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Skills deleted successfully");
        }
예제 #3
0
    public void LinkSkill(ISkill from, ISkill to)
    {
        bool CreateNew = true;

        foreach (SkillLink l in Links)
        {
            if (l.From.Contains(from))
            {
                l.AddToSkill(to);
                CreateNew = false;
            }
        }
        if (CreateNew)
        {
            SkillLink link = new SkillLink();
            link.AddFromSkill(from);
            link.AddToSkill(to);
            Links.Add(link);
        }
    }
예제 #4
0
        public void EditSkills()
        {
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills");

            GlobalDefinitions.Wait();
            SkillLink.Click();

            //This list gets the number of rows from the table
            //IList<IWebElement> rows = GlobalDefinitions.driver.FindElements(By.XPath(".//tr"));

            //This loop finds the first row which' title matches sRowValue
            IList <IWebElement> rows = GlobalDefinitions.driver.FindElements(By.XPath(".//tr"));

            //This loop finds the first row which' title matches sRowValue
            for (int i = 1; i < rows.Count; i++)
            {
                String sValue = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'C#')]")).Text;
                if (sValue == ExcelLib.ReadData(2, "Skill"))
                {
                    IWebElement Edit = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//tbody[1]//tr[1]//td[3]//span[1]//i[1]"));
                    Edit.Click();
                    AddSkillText.Clear();
                    AddSkillText.SendKeys(ExcelLib.ReadData(7, "Skill"));
                    UpdateSkill.Click();
                    break;
                }
            }
            GlobalDefinitions.Wait();
            IWebElement AddAlertPopup = GlobalDefinitions.driver.FindElement(By.ClassName("ns-box-inner"));
            String      AlertText     = AddAlertPopup.Text;

            GlobalDefinitions.Wait();
            Assert.IsTrue(AlertText.Contains("updated"));
            Console.WriteLine(AlertText);
            //saving screenshot
            var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Edit is successful");
        }
예제 #5
0
        public void AddSkills()
        {
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills");
            GlobalDefinitions.Wait();
            SkillLink.Click();

            //loop for multiple properties getting added at single shot
            int loopNum = Base.RowCount + 2;

            for (int rowNum = 2; rowNum <= loopNum; rowNum++)
            {
                GlobalDefinitions.Wait();
                AddNewSkillBtn.Click();
                AddSkillText.SendKeys(ExcelLib.ReadData(rowNum, "Skill"));

                //ChooseLang.SendKeys(ExcelLib.ReadData(2, "ChooseLangLevel"));
                ChooseSkill.Click();
                IWebElement   SkillLevelDrpdwn = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='ui bottom attached tab segment tooltip-target active']//select[@name='level']"));
                SelectElement chooseSkillLevel = new SelectElement(SkillLevelDrpdwn);
                //select.SelectByText(ConstantHelpers.LevelFluent);
                var SkillLevelData = ExcelLib.ReadData(rowNum, "ChooseSkillLevel");
                chooseSkillLevel.SelectByValue(SkillLevelData);

                AddSkill.Click();
                //GlobalDefinitions.Wait();
            }
            //saving screenshot
            var ScreenshotPath = Global.SaveScreenshot.SaveScreenshotClass(GlobalDefinitions.driver, "Adding is successful");
            //Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills added successfully");
            String ActualSkill = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'C#')]")).Text;

            Assert.AreEqual(ActualSkill, ExcelLib.ReadData(2, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualSkill1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'POM')]")).Text;

            Assert.AreEqual(ActualSkill1, ExcelLib.ReadData(3, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill1 + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualSkill2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Nunit')]")).Text;

            Assert.AreEqual(ActualSkill2, ExcelLib.ReadData(4, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill2 + " " + "is added");
            //Reading Language Level from Data excel sheet



            //Asserting the Skill level
            String ActualLevel = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Intermediate')]")).Text;

            Assert.AreEqual(ActualLevel, ExcelLib.ReadData(2, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualLevel1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text;

            Assert.AreEqual(ActualLevel1, ExcelLib.ReadData(3, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel1 + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualLevel2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text;

            Assert.AreEqual(ActualLevel2, ExcelLib.ReadData(4, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel2 + " " + "is added");
        }