private void AddBadge() { var element = DefaultManager.Instance.DefaultBadge; DataManager.Instance.AddBadge(element); var vm = new BadgeViewModel(element); BadgeCollection.Add(vm); OnPropertyChanged("BadgeCollection"); CurrentBadge = vm; }
/// <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); }