private void SearchSkill() { DAL dal = new DAL(); /*for (int i = SkillCollection.Count - 1; i >= 0; i--) * { * * SkillCollection.RemoveAt(i); * * }*/ SkillCollection.Clear(); DataTable dt = dal.Read("Select * from bit_skill WHERE (STATUS='ACTIVE' OR STATUS IS NULL) and " + SelectedSkillCols + " like '%" + SkillSearchString + "%'"); int i = 0; int index = 0; Skill skillFirstRecord = new Skill(); foreach (DataRow dr in dt.Rows) { index = i; if (index == 0) { skillFirstRecord = new Skill(dr); } Skill skill = new Skill(dr); SkillCollection.Add(skill); i++; } SelectedSkill = skillFirstRecord; //MessageBox.Show(SelectedSkillCols + SkillSearchString); }
private void AddSkill() { //SelectedSkill.Insert(); Skill skill = new Skill(); SkillCollection.Add(skill); SelectedSkill = skill; MessageBox.Show("Click Save button after entering the new skill.", "Skill", MessageBoxButton.OK, MessageBoxImage.Warning); IsEnabledAdd = false; IsEnabledSave = true; IsEnabledDelete = false; }
// Constructor of this viewModel public SkillManagementViewModel() { // 1. Its goind to connect to DAL and bring in the results to all skills // 2. We create objects of type skill and then add that object to our collection DAL dal = new DAL(); DataTable dt = dal.Read("Select * from bit_skill where (STATUS='ACTIVE' or status is null)"); foreach (DataRow dr in dt.Rows) { Skill skill = new Skill(dr); SkillCollection.Add(skill); } LoadFieldNameCombo(); }
public void SkillCollection_can_add_skill() { // AAA - Arrange, Act, Assert // Arrange var sut = new SkillCollection(); ISkill s1 = new Skill { SkillID = 101, Name = "PW7" }; // Act sut.Add(s1); // Assert Assert.Multiple(() => { Assert.That(sut.Count, Is.EqualTo(1)); Assert.That(sut[0].SkillID, Is.EqualTo(101)); Assert.That(sut[0].Name, Is.EqualTo("PW7")); }); }
public SkillCollection GetSkillsByAssociateID(int?id) { SkillCollection result = CreateNewSkillCollection(); if (id.HasValue && id >= 100) { var foundAssociateSkillIds = Context.AssociateSkillLinks .Where(e => e.AssociateID == id) .Select(e => e.SkillID); var foundAssociateSkills = Context.Skills .Where(e => foundAssociateSkillIds.Contains(e.SkillID)) .OrderBy(e => e.PresentationOrder) .ThenBy(e => e.Name); foreach (var foundSkill in foundAssociateSkills) { result.Add(GetSkillByID(foundSkill.SkillID)); } } /* * if (id.HasValue && id >= 100) * { * var foundAssociateRoleIds = Context.AssociateRoleLinks * .Where(e => e.AssociateID == id) * .Select(r => r.RoleID); * * var foundAssociateRoles = Context.Roles * .Where(r => foundAssociateRoleIds.Contains(r.RoleID)) * .OrderBy(r => r.PresentationOrder) * .ThenBy(r => r.Name); * * foreach (var foundRole in foundAssociateRoles) * { * result.Add(GetRoleByID(foundRole.RoleID)); * } * } * */ return(result); }
private static SkillCollection PopulateSkillCollection(DataTable assignmentSkillsData) { SkillCollection skills = null; if (assignmentSkillsData != null && assignmentSkillsData.Rows.Count > 0) { skills = new SkillCollection(); for (int index = 0; index < assignmentSkillsData.Rows.Count; index++) { skills.Add(new Skill()); skills[index].Code = assignmentSkillsData.Rows[index]["SkillCode"].ToString(); skills[index].Description = assignmentSkillsData.Rows[index]["SkillDesc"].ToString(); } } return skills; }
/// <summary> /// Convert dashboard business entity to Model /// </summary> /// <param name="argDashboardBE">Dashboard business Entity</param> /// <returns></returns> private Dashboard ConvertDashboardBEDataToModel(DashboardBE argDashboardBE) { #region Declarations Dashboard l_Dashboard = new Dashboard(); SkillCollection l_SkillCollection = new SkillCollection(); BadgeCollection l_BadgeCollection = new BadgeCollection(); ScheduleDemoCollection l_ScheduleDemoCollection = new ScheduleDemoCollection(); Badge l_Badge; Skills l_Skills; ScheduleDemo l_ScheduleDemo; #endregion try { if (argDashboardBE != null) { //Get User Details l_Dashboard.UserID = argDashboardBE.UserID; l_Dashboard.UserName = argDashboardBE.UserName; l_Dashboard.EmailID = argDashboardBE.EmailID; l_Dashboard.InitialSkillExists = argDashboardBE.InitialSkillExists; l_Dashboard.DisplayActionItems = argDashboardBE.UserID == GetLoggedInUserID() ? true : false; //Convert Skill and subskill set if (argDashboardBE.SkillsBECollection != null && argDashboardBE.SkillsBECollection.Count > 0) { foreach (var skill in argDashboardBE.SkillsBECollection) { l_Skills = new Skills(); l_Skills.SkillID = skill.SkillID; l_Skills.SkillName = skill.SkillName; l_Skills.SkillType = skill.SkillType; l_Skills.SkillPoints = skill.SkillPoints; l_Skills.SubSkillCollection = GetSubskillcollection(skill.SubSkillBECollection); l_SkillCollection.Add(l_Skills); } l_Dashboard.SkillsCollection = l_SkillCollection; l_Dashboard.SkillData = JsonConvert.SerializeObject(l_SkillCollection); } //Convert Badge if (argDashboardBE.BadgeBECollection != null && argDashboardBE.BadgeBECollection.Count > 0) { foreach (var badgeBE in argDashboardBE.BadgeBECollection) { l_Badge = new Badge(); l_Badge.BadgeID = badgeBE.BadgeID; l_Badge.BadgeName = badgeBE.BadgeName; l_Badge.BadgeURL = badgeBE.BadgeURL; l_Badge.BadgeCount = badgeBE.BadgeCount; l_BadgeCollection.Add(l_Badge); } l_Dashboard.BadgeCollection = l_BadgeCollection; } //Convert Demo Details if (argDashboardBE.ScheduleDemoBECollection != null && argDashboardBE.ScheduleDemoBECollection.Count > 0) { foreach (var demoBE in argDashboardBE.ScheduleDemoBECollection) { l_ScheduleDemo = new ScheduleDemo(); l_ScheduleDemo.DemoSchedule = demoBE.DemoSchedule; l_ScheduleDemo.Comments = demoBE.Comments; l_ScheduleDemo.UniqueID = demoBE.UniqueID; l_ScheduleDemo.Room = demoBE.Room; l_ScheduleDemo.SkillID = demoBE.SkillID; l_ScheduleDemo.SkillName = demoBE.SkillName; l_ScheduleDemo.SubSkillName = demoBE.SubSkillName; l_ScheduleDemo.UserID = demoBE.UserID; l_ScheduleDemo.EventConductedBy = demoBE.EventConductedBy; l_ScheduleDemoCollection.Add(l_ScheduleDemo); } l_Dashboard.ScheduleDemoCollection = l_ScheduleDemoCollection; } } } catch (Exception) { throw; } return(l_Dashboard); }