Beispiel #1
0
        internal void SkillEdit()
        {
            // Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage");

            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[@data-tab='second']"));

            //Click Skill tab
            ClickSkilltab.Click();
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//*[@data-tab='second']//table//tbody//tr//td[3]//i[@class='outline write icon'])"));

            //Edit Skill
            EditSkill.Click();

            //Edit Skill
            AddnewSkill.Clear();
            AddnewSkill.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Skill"));

            //Edit Level
            SelectElement Edit = new SelectElement(SelectSkillLevel);

            Edit.SelectByText(GlobalDefinitions.ExcelLib.ReadData(3, "Skill Level"));

            //Click update
            UpdateSkill.Click();
        }
        public bool UpdateSkill(int userID, UpdateSkill newValue)
        {
            using (IDbConnection dbConnection = Connection)
            {
                string imageQuery = "UPDATE tblskill SET level = @level WHERE userid = @id AND skillid = @skillid";

                int rowsAffected = dbConnection.Execute(imageQuery, new { level = newValue.NewValue, id = userID, skillid = newValue.SkillID });

                return(rowsAffected > 0);
            }
        }
        public int updateskill(int skillid, string skillname, string skilldesc, int lmodifiedby)
        {
            UpdateSkill us = new UpdateSkill()
            {
                SkillId          = skillid,
                SkillName        = skillname,
                SkillDescription = skilldesc,
                LastModifiedBy   = lmodifiedby
            };

            return(new ProjectManagerCSD().updateskill(us));
        }
Beispiel #4
0
        /// <summary>
        ///Updates Skill Name and description in Skill Table.
        /// </summary>
        /// <param name="us"></param>
        /// <returns></returns>
        public int updateskill(UpdateSkill us)
        {
            SqlParameter[] param1 = new SqlParameter[4];

            param1[0]       = new SqlParameter("@skillId", SqlDbType.Int);
            param1[0].Value = us.SkillId;
            param1[1]       = new SqlParameter("@skillName", SqlDbType.VarChar);
            param1[1].Value = us.SkillName;
            param1[2]       = new SqlParameter("@skillDesc", SqlDbType.VarChar);
            param1[2].Value = us.SkillDescription;
            param1[3]       = new SqlParameter("@modifiedBy", SqlDbType.Int);
            param1[3].Value = us.LastModifiedBy;
            int j = SqlHelper.ExecuteNonQuery("Data Source=.;Initial Catalog=HRS;Integrated Security=True", CommandType.StoredProcedure, "[dbo].[spUpdateSkill]", param1);

            return(j);
        }
Beispiel #5
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");
        }
 public int updateskill(UpdateSkill us)
 {
     return(new CreateSkilldao().updateskill(us));
 }
Beispiel #7
0
 public int updateskill(UpdateSkill us)
 {
     return(new CreateSkillBusinessComponent().updateskill(us));
 }
 public void Put(int id, [FromBody]UpdateSkill newValue)
 {
     ur.UpdateSkill(id, newValue);
 }
Beispiel #9
0
        public RedirectToActionResult UpdateSkillAction(UpdateSkill skill)
        {
            InitialSystemInfo();
            if (!ModelState.IsValid)
            {
                ProcessModelState();
                return(RedirectToAction("AddSkill"));
            }
            //Check if id is correct
            var checkInDatabase = _context.Skills.Where(a => a.Id == skill.Id);

            if (!checkInDatabase.Any())
            {
                if ((string)TempData["Error"] != "")
                {
                    TempData["Error"] += "\n";
                }

                TempData["Error"] += "Please enter correct skill id!";
                return(RedirectToAction("AddSkill"));
            }
            //Check if duplicate field name with other field name
            var checkDuplication = _context.Skills
                                   .Where(a => a.NormalizedName == skill.Name.ToUpper());

            if (checkDuplication.Any() && checkDuplication.First().Id != skill.Id)
            {
                if ((string)TempData["Error"] != "")
                {
                    TempData["Error"] += "\n";
                }
                TempData["Error"] += "Entered duplicate skill name " + "\"" + skill.Name + "\" " + "!";
                return(RedirectToAction("AddSkill"));
            }
            var oldSkill = checkInDatabase.First();

            //Prepare to change status
            if (oldSkill.Status != skill.Status)
            {
                string oldStatus;
                string newStatus;
                switch (oldSkill.Status)
                {
                case FieldStatus.InUse:
                    oldStatus = "\"In Use\"";
                    break;

                case FieldStatus.InRequest:
                    oldStatus = "\"In Request\"";
                    break;

                default:
                    oldStatus = "\"No Longer Used\"";
                    break;
                }
                switch (skill.Status)
                {
                case FieldStatus.InUse:
                    newStatus = "\"In Use\"";
                    break;

                case FieldStatus.InRequest:
                    newStatus = "\"In Request\"";
                    break;

                default:
                    newStatus = "\"No Longer Used\"";
                    break;
                }

                oldSkill.Status = skill.Status;
                _context.Skills.Update(oldSkill);
                _context.SaveChanges();
                if ((string)TempData["Inform"] != "")
                {
                    TempData["Inform"] += "\n";
                }
                TempData["Inform"] += "Skill " + "\"" + oldSkill.Name + "\" " + "'s status changed from "
                                      + oldStatus + " to "
                                      + newStatus;
            }
            //Prepare to log
            if (oldSkill.Name != skill.Name)
            {
                var newName = skill.Name;
                var oldName = oldSkill.Name;
                oldSkill.Name           = skill.Name;
                oldSkill.NormalizedName = skill.Name.ToUpper();
                _context.Skills.Update(oldSkill);
                _context.SaveChanges();
                if ((string)TempData["Inform"] != "")
                {
                    TempData["Inform"] += "\n";
                }
                TempData["Inform"] += "Skill" + "\"" + skill.Name + "\" " + "'s name changed from "
                                      + oldName + " to "
                                      + newName;
            }
            TempData["Success"] = "Skill \"" + skill.Name + "\" updated!";
            return(RedirectToAction("AddSkill"));
        }
Beispiel #10
0
        public void UpdateSkill(Skill skill)
        {
            UpdateSkill UpdateSkill = new UpdateSkill(skill);

            UpdateSkill.Excute();
        }